Navigation
API > API/Plugins > API/Plugins/ModelingComponents
A mechanic for displaying a sequence of control points and moving them about. Has an interactive initialization mode for first setting the points.
When editing, hold shift to select multiple points. Hold Ctrl to add an extra point along an edge. To add points to either end of the sequence, first select either the first or last point and then hold Ctrl. Backspace deletes currently selected points. In edit mode, holding Shift generally toggles the snapping behavior (makes it opposite of the current SnappingEnabled setting), though this is not yet implemented while the gizmo is being dragged.
TODO:
- Make it possible to open/close loop in edit mode
- Improve display of occluded control points (checkerboard the material)
- Allow deselection of vertices by clicking away?
- Lump the point/line set components into PreviewGeometryActor.
| Name | UCurveControlPointsMechanic |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Mechanics/CurveControlPointsMechanic.h |
| Include Path | #include "Mechanics/CurveControlPointsMechanic.h" |
Syntax
UCLASS (MinimalAPI)
class UCurveControlPointsMechanic :
public UInteractionMechanic ,
public IClickBehaviorTarget ,
public IHoverBehaviorTarget
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UInteractionMechanic → UCurveControlPointsMechanic
Implements Interfaces
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~UCurveControlPointsMechanic() |
Some other standard functions. | Mechanics/CurveControlPointsMechanic.h |
Classes
| Name | Remarks |
|---|---|
| FOrderedPoints | We want some way to store the control point sequence that lets us easily associate points with their renderable and hit-testable representations, since we need to alter all of these together as points get moved or added. |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| OnModeChangedEvent | TMulticastDelegate_NoParams< void > | This delegate is called when the mode of the mechanic changes (i.e., we leave or re-enter interactive initialization) | Mechanics/CurveControlPointsMechanic.h |
| OnPointsChangedEvent | TMulticastDelegate_NoParams< void > | This delegate is called every time the control point sequence is altered. | Mechanics/CurveControlPointsMechanic.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ClickBehavior | TObjectPtr< USingleClickInputBehavior > | Behaviors used for moving points around and hovering them. | Mechanics/CurveControlPointsMechanic.h | |
| HoverBehavior | TObjectPtr< UMouseHoverBehavior > | Mechanics/CurveControlPointsMechanic.h | ||
| OnModeChanged | OnModeChangedEvent | Mechanics/CurveControlPointsMechanic.h | ||
| OnPointsChanged | OnPointsChangedEvent | Mechanics/CurveControlPointsMechanic.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddSnapLine
(
int32 LineID, |
Adds additional line to snap points to. | Mechanics/CurveControlPointsMechanic.h | |
int32 AppendPoint
(
const FVector3d& PointCoordinates |
Mechanics/CurveControlPointsMechanic.h | ||
void ClearPoints() |
Clears all points in the mechanic. | Mechanics/CurveControlPointsMechanic.h | |
void DeleteSelectedPoints () |
Deletes currently selected points- can be called on a key press from the parent tool. | Mechanics/CurveControlPointsMechanic.h | |
void ExpireChanges() |
Expires any changes currently associated with the mechanic in the undo/redo stack. | Mechanics/CurveControlPointsMechanic.h | |
void ExtractPointPositions
(
TArray< FVector3d >& PositionsOut |
Outputs the positions of the points in the control point sequence. | Mechanics/CurveControlPointsMechanic.h | |
bool GetIsLoop() |
Returns whether the underlying sequence of control points is a loop. | Mechanics/CurveControlPointsMechanic.h | |
int32 GetNumPoints() |
Gives number of points currently managed by the mechanic. | Mechanics/CurveControlPointsMechanic.h | |
virtual void Initialize
(
const TArray< FVector3d >& Points, |
Functions used for initializing the mechanic. | Mechanics/CurveControlPointsMechanic.h | |
bool IsInInteractiveIntialization() |
Mechanics/CurveControlPointsMechanic.h | ||
void RemoveSnapLine
(
int32 LineID |
Mechanics/CurveControlPointsMechanic.h | ||
void SetAutoRevertToInteractiveInitialization
(
bool bOn |
When true, if the number of control points falls below the mins required (through deletion by the user), the mechanic automatically falls back into interactive intialization mode. | Mechanics/CurveControlPointsMechanic.h | |
void SetInteractiveInitialization
(
bool bOn |
Interactive initialization mode allows the user to click multiple times to initialize the curve (without having to hold Ctrl), and to transition to edit mode by clicking the last or first points (provided the minimal numbers of points have been met) | Mechanics/CurveControlPointsMechanic.h | |
void SetIsLoop
(
bool bIsLoop |
Mechanics/CurveControlPointsMechanic.h | ||
void SetMinPointsToLeaveInteractiveInitialization
(
int32 MinForLoop, |
In interactive intialization mode, these minimums determine how many points must exist before initialization mode can be left. | Mechanics/CurveControlPointsMechanic.h | |
void SetPlane
(
const UE::Geometry::FFrame3d& DrawPlaneIn |
Sets the plane on which new points are added on the ends and in which the points are moved. | Mechanics/CurveControlPointsMechanic.h | |
void SetSnappingEnabled
(
bool bOn |
TODO: It is simple to allow the points to be moved arbitrarily, not just inside the plane, if we ever want to use the mechanic somewhere where that is desirable. | Mechanics/CurveControlPointsMechanic.h | |
void SetWorld
(
UWorld* World |
Mechanics/CurveControlPointsMechanic.h |
Overridden from UInteractionMechanic
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Render
(
IToolsContextRenderAPI* RenderAPI |
Mechanics/CurveControlPointsMechanic.h | ||
virtual void Setup
(
UInteractiveTool* ParentTool |
Mechanics/CurveControlPointsMechanic.h | ||
virtual void Shutdown() |
Mechanics/CurveControlPointsMechanic.h |
Overridden from IClickBehaviorTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FInputRayHit IsHitByClick
(
const FInputDeviceRay& ClickPos |
IClickBehaviorTarget implementation. | Mechanics/CurveControlPointsMechanic.h | |
virtual void OnClicked
(
const FInputDeviceRay& ClickPos |
Mechanics/CurveControlPointsMechanic.h |
Overridden from IModifierToggleBehaviorTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnUpdateModifierState
(
int ModifierID, |
IModifierToggleBehaviorTarget implementation, inherited through IClickBehaviorTarget. | Mechanics/CurveControlPointsMechanic.h |
Overridden from IHoverBehaviorTarget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FInputRayHit BeginHoverSequenceHitTest
(
const FInputDeviceRay& PressPos |
IHoverBehaviorTarget implementation. | Mechanics/CurveControlPointsMechanic.h | |
virtual void OnBeginHover
(
const FInputDeviceRay& DevicePos |
Mechanics/CurveControlPointsMechanic.h | ||
virtual void OnEndHover() |
Mechanics/CurveControlPointsMechanic.h | ||
virtual bool OnUpdateHover
(
const FInputDeviceRay& DevicePos |
Mechanics/CurveControlPointsMechanic.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ChangeSelection
(
int32 NewPointID, |
These issue undo/redo change objects, and must therefore not be called in undo/redo code. | Mechanics/CurveControlPointsMechanic.h | |
void ClearHover() |
Mechanics/CurveControlPointsMechanic.h | ||
void ClearSelection() |
Mechanics/CurveControlPointsMechanic.h | ||
int32 DeletePoint
(
int32 SequencePosition |
Mechanics/CurveControlPointsMechanic.h | ||
bool DeselectPoint
(
int32 PointID |
Mechanics/CurveControlPointsMechanic.h | ||
void GizmoTransformChanged
(
UTransformProxy* Proxy, |
Callbacks we'll receive from the gizmo proxy. | Mechanics/CurveControlPointsMechanic.h | |
void GizmoTransformEnded
(
UTransformProxy* Proxy |
Mechanics/CurveControlPointsMechanic.h | ||
void GizmoTransformStarted
(
UTransformProxy* Proxy |
Mechanics/CurveControlPointsMechanic.h | ||
bool HitTest
(
const FInputDeviceRay& ClickPos, |
Mechanics/CurveControlPointsMechanic.h | ||
int32 InsertPointAt
(
int32 SequencePosition, |
All of the following do not issue undo/redo change objects. | Mechanics/CurveControlPointsMechanic.h | |
void SelectPoint
(
int32 PointID |
Mechanics/CurveControlPointsMechanic.h | ||
void UpdateGizmoLocation() |
Mechanics/CurveControlPointsMechanic.h | ||
void UpdateGizmoVisibility() |
Mechanics/CurveControlPointsMechanic.h | ||
void UpdatePointLocation
(
int32 PointID, |
Mechanics/CurveControlPointsMechanic.h | ||
void UpdateSnapHistoryPoint
(
int32 Index, |
Mechanics/CurveControlPointsMechanic.h | ||
void UpdateSnapTargetsForHover() |
Mechanics/CurveControlPointsMechanic.h |