Class TCastleTransformManipulate

Unit

Declaration

type TCastleTransformManipulate = class(TComponent)

Description

Allow to select, move, rotate, scale a group of TCastleTransform instances.

This component implements common 3D editing operations:

  • Selection (when Mode = mmSelect). To use this, call SetSelected. Multiple transform instances can be selected at once.

    This component does never itself change the selected objects. It relies on external code to call SetSelected whenever the selection changes.

    This component merely visualizes the selected objects.

  • Move, rotate or scale a selected transformation. To use this, set MainSelected to the transformation that should be modified, and set Mode to the desired operation.

    This component fully implements moving, rotating and scaling. It displays a proper "gizmo" to perform this for user, and it modifies the selected transformation when user drags the gizmo. Use events like OnTransformModified and OnTransformModifyEnd to get notified when the transformation is modified.

    TODO: Right now we allow to move/rotate/scale only a single transformation, that's why we rely on the MainSelected property. In the future, we should allow to move/rotate/scale multiple transforms, and then MainSelected property will be removed, and we will just transform all instances given as SetSelected.

Hierarchy

  • TObject
  • TPersistent
  • TComponent
  • TCastleTransformManipulate

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure SetSelected(const Selected: TComponentList); overload;
Public procedure SetSelected(const Selected: array of TComponent); overload;

Properties

Public property OnTransformModified: TNotifyEvent read FOnTransformModified write FOnTransformModified;
Public property OnTransformModifyEnd: TNotifyEvent read FOnTransformModifyEnd write FOnTransformModifyEnd;
Public property MainSelected: TCastleTransform read FMainSelected write SetMainSelected;
Public property Pickable: Boolean read FPickable write SetPickable default true;
Public property Mode: TManipulateMode read FMode write SetMode default mmSelect;

Description

Methods

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure SetSelected(const Selected: TComponentList); overload;

Pass a list of TCastleTransform instances to visualize them as selected. In the future, these will also be used to move/rotate/scale.

The argument Selected may be Nil, which is treated just like passing an empty list.

Instance of other classes on the Selected list are allowed, and they are just ignored.

The list Selected does not become owned by this class. You can free it whenever you want, even immediately after calling this method, we don't keep any reference to it – we copy the contents.

Public procedure SetSelected(const Selected: array of TComponent); overload;

This item has no description.

Properties

Public property OnTransformModified: TNotifyEvent read FOnTransformModified write FOnTransformModified;

Called whenever we modify the MainSelected state by moving/rotating/scaling. Useful e.g. to mark the design as "modified".

Public property OnTransformModifyEnd: TNotifyEvent read FOnTransformModifyEnd write FOnTransformModifyEnd;

Called when we stop dragging (to move/rotate/scale). Useful e.g. to mark new state as "next undo step".

Public property MainSelected: TCastleTransform read FMainSelected write SetMainSelected;

Current TCastleTransform for potential move/rotate/scale (depending on Mode). Nil to not visualize anything.

TODO: we'd like to remove this property at some point, gizmos to transform should work on multi-selection too, thus rely on SetSelected.

Public property Pickable: Boolean read FPickable write SetPickable default true;

Modify this property temporarily to influnce ray collisions. If your code uses ray collisions (non-physical) using e.g. MyViewport.Items.WorldRay and you don't want to ever pick the internal "gizmo" scenes for manipulating, then set this temporarily to False.

Public property Mode: TManipulateMode read FMode write SetMode default mmSelect;

Current mode of operation.


Generated by PasDoc 0.16.0-snapshot.