bShowConstraintsAsPoints

bShowConstraintsAsPoints

#Overview

name: bShowConstraintsAsPoints

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 bShowConstraintsAsPoints is to control the visual representation of constraints in the Physics Asset Editor within Unreal Engine 5. It is used to toggle between displaying constraints as points or in their full, detailed form.

This setting variable is primarily used in the Physics Asset Editor module and the Persona editor subsystem, which are part of Unreal Engine’s editor tools for working with physics assets and skeletal meshes.

The value of this variable is set in several places:

  1. It is initialized to false in the UPhysicsAssetEditorOptions constructor.
  2. It can be toggled by the user through the ToggleDrawConstraintsAsPoints() function in the Physics Asset Editor.
  3. It is saved to and loaded from the editor configuration.

This variable interacts with other rendering and visualization settings in the Physics Asset Editor, such as bDrawViolatedLimits and bRenderOnlySelectedConstraints.

Developers should be aware that:

  1. This setting affects the visual representation of constraints in the editor, not the actual behavior of the physics simulation.
  2. Changing this setting may impact the clarity and detail of constraint visualization, which could affect how easily users can understand and edit complex physics setups.

Best practices when using this variable include:

  1. Providing a clear UI option for users to toggle this setting, as it can significantly change the visual feedback in the editor.
  2. Consider the complexity of the physics asset when deciding whether to use point representation or full constraint visualization. For complex assets with many constraints, using points might reduce visual clutter.
  3. Ensure that toggling this option properly updates all relevant views and doesn’t leave any inconsistent visual states in the editor.
  4. When writing documentation or tutorials for the Physics Asset Editor, mention this option and its effects on the visualization to help users understand what they’re seeing.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:524, section: [/Script/UnrealEd.PhysicsAssetEditorOptions]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:54

Scope (from outer to inner):

file
function     FPhysicsAssetRenderSettings::FPhysicsAssetRenderSettings

Source code excerpt:

	, bRenderOnlySelectedConstraints(false)
	, bShowCOM(false)
	, bShowConstraintsAsPoints(false)
	, bDrawViolatedLimits(false)
	, BoneUnselectedColor(170, 155, 225)
	, NoCollisionColor(200, 200, 200)
	, COMRenderColor(255, 255, 100)
	, COMRenderSize(5.0f)
	, InfluenceLineLength(2.0f)

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:260

Scope (from outer to inner):

file
function     void FPhysicsAssetRenderSettings::ResetEditorViewportOptions

Source code excerpt:

	bHideSimulatedBodies = DefaultObject.bHideSimulatedBodies;
	bRenderOnlySelectedConstraints = DefaultObject.bRenderOnlySelectedConstraints;
	bShowConstraintsAsPoints = DefaultObject.bShowConstraintsAsPoints;
	bDrawViolatedLimits = DefaultObject.bDrawViolatedLimits;
}

namespace PhysicsAssetRender
{
	void DebugDraw(USkeletalMeshComponent* const SkeletalMeshComponent, UPhysicsAsset* const PhysicsAsset, FPrimitiveDrawInterface* PDI)

#Loc: <Workspace>/Engine/Source/Editor/Persona/Private/PhysicsAssetRenderUtils.cpp:480

Scope (from outer to inner):

file
namespace    PhysicsAssetRender
function     void DebugDrawConstraints

Source code excerpt:

							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:107

Scope: file

Source code excerpt:


	UPROPERTY()
	bool bShowConstraintsAsPoints;

	UPROPERTY()
	bool bDrawViolatedLimits;

	// Draw colors
	UPROPERTY()

#Loc: <Workspace>/Engine/Source/Editor/PhysicsAssetEditor/Private/PhysicsAssetEditor.cpp:2744

Scope (from outer to inner):

file
function     void FPhysicsAssetEditor::ToggleDrawConstraintsAsPoints

Source code excerpt:

void FPhysicsAssetEditor::ToggleDrawConstraintsAsPoints()
{
	SharedData->EditorOptions->bShowConstraintsAsPoints = !SharedData->EditorOptions->bShowConstraintsAsPoints;
	SharedData->EditorOptions->SaveConfig();
}

bool FPhysicsAssetEditor::IsDrawingConstraintsAsPoints() const
{
	return SharedData->EditorOptions->bShowConstraintsAsPoints;
}

void FPhysicsAssetEditor::ToggleDrawViolatedLimits()
{
	SharedData->EditorOptions->bDrawViolatedLimits = !SharedData->EditorOptions->bDrawViolatedLimits;
	SharedData->EditorOptions->SaveConfig();

#Loc: <Workspace>/Engine/Source/Editor/PhysicsAssetEditor/Private/PhysicsAssetEditorSkeletalMeshComponent.cpp:126

Scope (from outer to inner):

file
function     void UPhysicsAssetEditorSkeletalMeshComponent::DebugDraw

Source code excerpt:

		RenderSettings->bHideSimulatedBodies = SharedData->EditorOptions->bHideSimulatedBodies;
		RenderSettings->bRenderOnlySelectedConstraints = SharedData->EditorOptions->bRenderOnlySelectedConstraints;
		RenderSettings->bShowConstraintsAsPoints = SharedData->EditorOptions->bShowConstraintsAsPoints;
		RenderSettings->bDrawViolatedLimits = SharedData->EditorOptions->bDrawViolatedLimits;

		// Draw Bodies.
		{
			auto TransformFn = [this](const UPhysicsAsset* PhysicsAsset, const FTransform& BoneTM, const int32 BodyIndex, const EAggCollisionShape::Type PrimType, const int32 PrimIndex, const float Scale) { return this->GetPrimitiveTransform(BoneTM, BodyIndex, PrimType, PrimIndex, Scale);  };
			auto ColorFn = [this](const int32 BodyIndex, const EAggCollisionShape::Type PrimitiveType, const int32 PrimitiveIndex, const FPhysicsAssetRenderSettings& Settings) { return this->GetPrimitiveColor(BodyIndex, PrimitiveType, PrimitiveIndex); };

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Preferences/PhysicsAssetEditorOptions.h:105

Scope (from outer to inner):

file
class        class UPhysicsAssetEditorOptions : public UObject

Source code excerpt:

	/** Whether to draw constraints as points */
	UPROPERTY(config)
	uint32 bShowConstraintsAsPoints:1;

	/** Whether to highlight limits that have been violated */
	UPROPERTY(config)
	uint32 bDrawViolatedLimits:1;

	/** Whether to only render selected constraints */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PreferenceStubs.cpp:42

Scope (from outer to inner):

file
function     UPhysicsAssetEditorOptions::UPhysicsAssetEditorOptions

Source code excerpt:

	InterpolationSpeed = 50.f;

	bShowConstraintsAsPoints = false;
	bDrawViolatedLimits = false;
	bSimulationFloorCollisionEnabled = true;
	ConstraintDrawSize = 1.0f;

	// view options
	MeshViewMode = EPhysicsAssetEditorMeshViewMode::Solid;