ConstraintDrawSize
ConstraintDrawSize
#Overview
name: ConstraintDrawSize
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ConstraintDrawSize is to control the size of constraints when rendering them in the Physics Asset Editor within Unreal Engine 5. This setting variable is primarily used for visualization purposes in the editor, allowing developers to adjust the visual representation of physics constraints.
ConstraintDrawSize is primarily used in the Physics Asset Editor module of Unreal Engine 5. It is referenced in the Persona and PhysicsAssetEditor subsystems, which are part of the editor toolset for working with skeletal meshes and physics assets.
The value of this variable is typically set in the UPhysicsAssetEditorOptions class, which is a configuration class for the Physics Asset Editor. It is initialized with a default value of 1.0f in the constructor of UPhysicsAssetEditorOptions.
ConstraintDrawSize interacts with other rendering and physics-related variables, such as CollisionViewMode, ConstraintViewMode, and PhysicsBlend. These variables collectively determine how physics assets are visualized in the editor.
Developers should be aware that changing ConstraintDrawSize affects only the visual representation of constraints in the editor and does not impact the actual physics simulation or gameplay. It’s purely for visualization purposes to help with editing and debugging physics assets.
Best practices when using this variable include:
- Adjust the value to find a balance between visibility and clutter in the editor viewport.
- Use it in conjunction with other visualization options to get a clear understanding of the physics setup.
- Remember to save the configuration after changing the value to persist it across editor sessions.
- Be mindful that very large or small values might make it difficult to work with constraints in the editor.
- Consider different values for different types of projects or assets, as the optimal size may vary depending on the scale and complexity of your physics setups.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:523, section: [/Script/UnrealEd.PhysicsAssetEditorOptions]
- INI Section:
/Script/UnrealEd.PhysicsAssetEditorOptions
- Raw value:
1.0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:48
Scope (from outer to inner):
file
function FPhysicsAssetRenderSettings::FPhysicsAssetRenderSettings
Source code excerpt:
, ConstraintViewportManipulationFlags(EConstraintTransformComponentFlags::All)
, ConstraintTransformComponentDisplayRelativeToDefaultFlags(EConstraintTransformComponentFlags::None)
, ConstraintDrawSize(1.0f)
, PhysicsBlend(1.0f)
, bHideKinematicBodies(false)
, bHideSimulatedBodies(false)
, bRenderOnlySelectedConstraints(false)
, bShowCOM(false)
, bShowConstraintsAsPoints(false)
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:255
Scope (from outer to inner):
file
function void FPhysicsAssetRenderSettings::ResetEditorViewportOptions
Source code excerpt:
CollisionViewMode = DefaultObject.CollisionViewMode;
ConstraintViewMode = DefaultObject.ConstraintViewMode;
ConstraintDrawSize = DefaultObject.ConstraintDrawSize;
PhysicsBlend = DefaultObject.PhysicsBlend;
bHideKinematicBodies = DefaultObject.bHideKinematicBodies;
bHideSimulatedBodies = DefaultObject.bHideSimulatedBodies;
bRenderOnlySelectedConstraints = DefaultObject.bRenderOnlySelectedConstraints;
bShowConstraintsAsPoints = DefaultObject.bShowConstraintsAsPoints;
bDrawViolatedLimits = DefaultObject.bDrawViolatedLimits;
#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:472
Scope (from outer to inner):
file
namespace PhysicsAssetRender
function void DebugDrawConstraints
Source code excerpt:
if ((BoneIndex1 != INDEX_NONE) && (BoneIndex2 != INDEX_NONE))
{
const float DrawScale = ConstraintArrowScale * RenderSettings->ConstraintDrawSize;
FTransform Con1Frame = GetConstraintMatrix(SkeletalMeshComponent, ConstraintSetup, EConstraintFrame::Frame1, BoneIndex1);
FTransform Con2Frame = GetConstraintMatrix(SkeletalMeshComponent, ConstraintSetup, EConstraintFrame::Frame2, BoneIndex2);
// Remove scaling from constraint frame transforms so that constraint limit cones etc are all drawn at the same scale.
Con1Frame.RemoveScaling();
Con2Frame.RemoveScaling();
ConstraintSetup->DefaultInstance.DrawConstraint(PDI, RenderSettings->ConstraintDrawSize, DrawScale, bDrawLimits, bDrawSelected, Con1Frame, Con2Frame, RenderSettings->bShowConstraintsAsPoints, RenderSettings->bDrawViolatedLimits);
}
}
PDI->SetHitProxy(NULL);
}
#Loc: <Workspace>/Engine/Source/Editor/Persona/Public/PhysicsAssetRenderUtils.h:89
Scope: file
Source code excerpt:
UPROPERTY()
float ConstraintDrawSize;
UPROPERTY()
float PhysicsBlend;
UPROPERTY()
bool bHideKinematicBodies;
#Loc: <Workspace>/Engine/Source/Editor/PhysicsAssetEditor/Private/PhysicsAssetEditor.cpp:3936
Scope (from outer to inner):
file
function TSharedRef<SWidget> FPhysicsAssetEditor::MakeConstraintScaleWidget
lambda-function
Source code excerpt:
.MinSliderValue(0.0f)
.MaxSliderValue(4.0f)
.Value_Lambda([this]() { return SharedData->EditorOptions->ConstraintDrawSize; })
.OnValueChanged_Lambda([this](float InValue) { SharedData->EditorOptions->ConstraintDrawSize = InValue; })
.OnValueCommitted_Lambda([this](float InValue, ETextCommit::Type InCommitType)
{
SharedData->EditorOptions->ConstraintDrawSize = InValue;
SharedData->EditorOptions->SaveConfig();
ViewportCommandList->WidgetInteraction(TEXT("ConstraintScaleWidget"));
})
]
];
}
#Loc: <Workspace>/Engine/Source/Editor/PhysicsAssetEditor/Private/PhysicsAssetEditorSkeletalMeshComponent.cpp:121
Scope (from outer to inner):
file
function void UPhysicsAssetEditorSkeletalMeshComponent::DebugDraw
Source code excerpt:
RenderSettings->CollisionViewMode = SharedData->GetCurrentCollisionViewMode(SharedData->bRunningSimulation);
RenderSettings->ConstraintViewMode = SharedData->GetCurrentConstraintViewMode(SharedData->bRunningSimulation);
RenderSettings->ConstraintDrawSize = SharedData->EditorOptions->ConstraintDrawSize;
RenderSettings->PhysicsBlend = SharedData->EditorOptions->PhysicsBlend;
RenderSettings->bHideKinematicBodies = SharedData->EditorOptions->bHideKinematicBodies;
RenderSettings->bHideSimulatedBodies = SharedData->EditorOptions->bHideSimulatedBodies;
RenderSettings->bRenderOnlySelectedConstraints = SharedData->EditorOptions->bRenderOnlySelectedConstraints;
RenderSettings->bShowConstraintsAsPoints = SharedData->EditorOptions->bShowConstraintsAsPoints;
RenderSettings->bDrawViolatedLimits = SharedData->EditorOptions->bDrawViolatedLimits;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Preferences/PhysicsAssetEditorOptions.h:121
Scope (from outer to inner):
file
class class UPhysicsAssetEditorOptions : public UObject
Source code excerpt:
/** Controls how large constraints are drawn in Physics Asset Editor */
UPROPERTY(config)
float ConstraintDrawSize;
/** View mode for meshes in edit mode */
UPROPERTY(config)
EPhysicsAssetEditorMeshViewMode MeshViewMode;
/** View mode for collision in edit mode */
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PreferenceStubs.cpp:45
Scope (from outer to inner):
file
function UPhysicsAssetEditorOptions::UPhysicsAssetEditorOptions
Source code excerpt:
bDrawViolatedLimits = false;
bSimulationFloorCollisionEnabled = true;
ConstraintDrawSize = 1.0f;
// view options
MeshViewMode = EPhysicsAssetEditorMeshViewMode::Solid;
CollisionViewMode = EPhysicsAssetEditorCollisionViewMode::Solid;
ConstraintViewMode = EPhysicsAssetEditorConstraintViewMode::AllLimits;
SimulationMeshViewMode = EPhysicsAssetEditorMeshViewMode::Solid;