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 with any number of transforms. 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, call SetSelected with exactly one transform. And set Mode to the desired operation, like mmTranslate.

    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. In the future, we plan to allow to move/rotate/scale multiple transforms.

Hierarchy

  • TObject
  • TPersistent
  • TComponent
  • TCastleTransformManipulate

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure SetSelected(const NewSelected: TComponentList); overload;
Public procedure SetSelected(const NewSelected: array of TComponent); overload;
Public function SelectedCount: Integer;

Properties

Public property OnTransformModified: TNotifyEvent read FOnTransformModified write FOnTransformModified;
Public property OnTransformModifyEnd: TNotifyEvent read FOnTransformModifyEnd write FOnTransformModifyEnd;
Public property Pickable: Boolean read FPickable write SetPickable default true;
Public property Mode: TManipulateMode read FMode write SetMode default mmSelect;
Public property Selected[const Index: Integer]: TCastleTransform read GetSelected;

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 NewSelected: TComponentList); overload;

Pass a list of TCastleTransform instances to visualize them as selected and to manipulate them (move/rotate/scale).

TODO: Right now, manipulating (move/rotate/scale) works only for a single transform. You cannot pass more than one item on the NewSelected list if you want to have move/rotate/scale working.

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

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

The list NewSelected 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 NewSelected: array of TComponent); overload;

This item has no description.

Public function SelectedCount: Integer;

Count of currently selected items.

See also
Selected
Currently selected items, use indexes from 0 to SelectedCount - 1.

Properties

Public property OnTransformModified: TNotifyEvent read FOnTransformModified write FOnTransformModified;

Called whenever we modify the transformation of selected transformations 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 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.

Public property Selected[const Index: Integer]: TCastleTransform read GetSelected;

Currently selected items, use indexes from 0 to SelectedCount - 1. This is equivalent to the contents of last SetSelected call, but filtered to contain only TCastleTransform instances that can be manipulated.


Generated by PasDoc 0.16.0-snapshot.