ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::Transform3d Class Referenceabstract

Abstract base class for 3D transform interface. More...

#include <transform3d.h>

Inheritance diagram for Ufe::Transform3d:
Collaboration diagram for Ufe::Transform3d:

Public Types

typedef std::shared_ptr< Transform3dPtr
 
typedef bool(* RemoveObserverItemType) (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
typedef bool(* RemoveObserverPathType) (const Path &path, const Observer::Ptr &obs)
 
- Public Types inherited from Ufe::Transform3dRead
typedef std::shared_ptr< Transform3dReadPtr
 

Public Member Functions

 Transform3d ()
 Constructor. More...
 
 Transform3d (const Transform3d &)=default
 Default copy constructor. More...
 
virtual ~Transform3d () override
 Destructor. More...
 
virtual TranslateUndoableCommand::Ptr translateCmd (double x, double y, double z)=0
 
TranslateUndoableCommand::Ptr translateCmd ()
 
virtual void translate (double x, double y, double z)
 
virtual Vector3d translation () const =0
 
virtual RotateUndoableCommand::Ptr rotateCmd (double x, double y, double z)=0
 
RotateUndoableCommand::Ptr rotateCmd ()
 
virtual void rotate (double x, double y, double z)
 
virtual Vector3d rotation () const =0
 
virtual ScaleUndoableCommand::Ptr scaleCmd (double x, double y, double z)=0
 
ScaleUndoableCommand::Ptr scaleCmd ()
 
virtual void scale (double x, double y, double z)
 
virtual Vector3d scale () const =0
 
virtual TranslateUndoableCommand::Ptr rotatePivotCmd (double x, double y, double z)=0
 
TranslateUndoableCommand::Ptr rotatePivotCmd ()
 
virtual void rotatePivot (double x, double y, double z)
 
virtual Vector3d rotatePivot () const =0
 
virtual TranslateUndoableCommand::Ptr scalePivotCmd (double x, double y, double z)=0
 
TranslateUndoableCommand::Ptr scalePivotCmd ()
 
virtual void scalePivot (double x, double y, double z)
 
virtual Vector3d scalePivot () const =0
 
virtual TranslateUndoableCommand::Ptr translateRotatePivotCmd (double x, double y, double z)
 
TranslateUndoableCommand::Ptr translateRotatePivotCmd ()
 
virtual void translateRotatePivot (double x, double y, double z)
 
virtual Vector3d rotatePivotTranslation () const
 
virtual TranslateUndoableCommand::Ptr translateScalePivotCmd (double x, double y, double z)
 
TranslateUndoableCommand::Ptr translateScalePivotCmd ()
 
virtual void translateScalePivot (double x, double y, double z)
 
virtual Vector3d scalePivotTranslation () const
 
virtual RotateUndoableCommand::Ptr rotateAxisCmd (double x, double y, double z)
 
RotateUndoableCommand::Ptr rotateAxisCmd ()
 
virtual void rotateAxis (double x, double y, double z)
 
virtual Vector3d rotateAxis () const
 
virtual ShearUndoableCommand::Ptr shearCmd (double xy, double xz, double yz)
 
ShearUndoableCommand::Ptr shearCmd ()
 
virtual void shear (double xy, double xz, double yz)
 
virtual Vector3d shear () const
 
virtual SetMatrix4dUndoableCommand::Ptr setMatrixCmd (const Matrix4d &m)=0
 
virtual void setMatrix (const Matrix4d &m)
 
- Public Member Functions inherited from Ufe::Transform3dRead
 Transform3dRead ()
 Constructor. More...
 
 Transform3dRead (const Transform3dRead &)=default
 Default copy constructor. More...
 
virtual ~Transform3dRead ()
 Destructor. More...
 
virtual const Pathpath () const =0
 
virtual SceneItem::Ptr sceneItem () const =0
 
virtual Matrix4d matrix () const =0
 
Matrix4d inclusiveMatrix () const
 
Matrix4d exclusiveMatrix () const
 
virtual Matrix4d segmentInclusiveMatrix () const =0
 
virtual Matrix4d segmentExclusiveMatrix () const =0
 

Static Public Member Functions

static Ptr transform3d (const SceneItem::Ptr &item)
 
static Ptr editTransform3d (const SceneItem::Ptr &item, const EditTransform3dHint &hint=EditTransform3dHint())
 
static bool addObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool removeObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool removeObserver (const Path &path, const Observer::Ptr &obs)
 
static std::size_t nbObservers (const SceneItem::Ptr &item)
 
static bool hasObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool hasObservers (const Path &path)
 
static bool hasObservers (Rtid runTimeId)
 
static void notify (const Path &path)
 
- Static Public Member Functions inherited from Ufe::Transform3dRead
static Ptr transform3dRead (const SceneItem::Ptr &item)
 

Detailed Description

Abstract base class for 3D transform interface.

This base class defines the interface that runtimes can implement to transform objects in 3D, for a given selection item. These include operations like:

  • translating an item
  • rotating an item
  • scaling an item
  • translating an item's rotate pivot point
  • translating an item's scale pivot point
  • returning the inclusive matrix of the item (including the item's local transformation)
  • returning the exclusive matrix of the item (excluding the item's local transformation)

Each operation has two calls, one with undo capability, and one without. Providing undo capability typically involves code complexity, and using undo capability incurs runtime cost in processing and memory. Therefore, non- interactive use of this interface should use calls without undo capability.

All operations on the item are done in its local coordinate system, and are absolute. It is the responsibility of the application to convert operations done in any other coordinate system (e.g. world, or another object's coordinate system) back into a UFE item's local coordinates. Similarly, the application must convert relative transformations back into absolute for the UFE item.

As with the rest of UFE, observation is done through the Observer Pattern. Observers can be added to an individual scene item, to be notified when an object's transformation changes.

To avoid the memory-consuming "one proxy object per scene object" approach, Transform3d interface objects should be obtained and used within a local scope, and not stored. Transform3d interfaces should be considered stateless, and can be bound to new selection items.

Definition at line 153 of file transform3d.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<Transform3d> Ufe::Transform3d::Ptr

Definition at line 156 of file transform3d.h.

◆ RemoveObserverItemType

typedef bool(* Ufe::Transform3d::RemoveObserverItemType) (const SceneItem::Ptr &item, const Observer::Ptr &obs)

Definition at line 201 of file transform3d.h.

◆ RemoveObserverPathType

typedef bool(* Ufe::Transform3d::RemoveObserverPathType) (const Path &path, const Observer::Ptr &obs)

Definition at line 215 of file transform3d.h.

Constructor & Destructor Documentation

◆ Transform3d() [1/2]

Ufe::Transform3d::Transform3d ( )

Constructor.

◆ Transform3d() [2/2]

Ufe::Transform3d::Transform3d ( const Transform3d )
default

Default copy constructor.

◆ ~Transform3d()

virtual Ufe::Transform3d::~Transform3d ( )
overridevirtual

Destructor.

Member Function Documentation

◆ addObserver()

static bool Ufe::Transform3d::addObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Add observation on the argument item for Transform3d changes.

Parameters
itemSceneItem to observe.
obsObserver to add.
Returns
True if the observer is added. Add does nothing and returns false if the observer is already present.

◆ editTransform3d()

static Ptr Ufe::Transform3d::editTransform3d ( const SceneItem::Ptr item,
const EditTransform3dHint hint = EditTransform3dHint() 
)
static

Convenience method that calls the Ufe::Transform3d::editTransform3d() method on the Transform3d handler for the item. Returns a null pointer if the argument is null, or has an empty path.

Parameters
itemSceneItem on which to create Transform3d interface.
hintContextual information for Transform3d interface creation.
Returns
Transform3d for the given SceneItem

◆ hasObserver()

static bool Ufe::Transform3d::hasObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Query observation on argument item for transform changes.

Parameters
itemSceneItem to check if has observation.
obsObserver to query.
Returns
True if there is observation on argument item for transform changes.

◆ hasObservers() [1/2]

static bool Ufe::Transform3d::hasObservers ( const Path path)
static
Parameters
pathPath to verify if being observed.
Returns
True if the given path is being observed.

◆ hasObservers() [2/2]

static bool Ufe::Transform3d::hasObservers ( Rtid  runTimeId)
static

Helper query for runtimes, to determine if any path they are responsible for is being observed.

Parameters
runTimeIdruntime Id to find observers on.
Returns
True if any path of given runtime Id are being observed.

◆ nbObservers()

static std::size_t Ufe::Transform3d::nbObservers ( const SceneItem::Ptr item)
static

Number of observed on the given SceneItem.

Parameters
itemSceneItem to count observes on.
Returns
Number of observers on SceneItem.

◆ notify()

static void Ufe::Transform3d::notify ( const Path path)
static

Notify all observers of the item with this path. If no observer exists, does nothing.

Parameters
pathPath to use on the notify action.

◆ removeObserver() [1/2]

static bool Ufe::Transform3d::removeObserver ( const Path path,
const Observer::Ptr obs 
)
static

Remove observation on the argument path for transform changes. This method can remove observation from a Path when the corresponding SceneItem is already invalid.

Parameters
pathpath to remove observation on.
obsObserver to remove.
Returns
True if the observer is removed. False if the observer isn't found.

◆ removeObserver() [2/2]

static bool Ufe::Transform3d::removeObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Remove observation on the argument item for transform changes.

Parameters
itemSceneItem to remove observation on.
obsObserver to remove.
Returns
True if the observer is removed. False if the observer isn't found.

◆ rotate()

virtual void Ufe::Transform3d::rotate ( double  x,
double  y,
double  z 
)
inlinevirtual

Rotate object to given value. Default implementation calls rotateCmd() and executes the returned command, if non-null

Parameters
xvalue to rotate on the X-axis, in degrees.
yvalue to rotate on the Y-axis, in degrees.
zvalue to rotate on the Z-axis, in degrees.

Definition at line 300 of file transform3d.h.

◆ rotateAxis() [1/2]

virtual Vector3d Ufe::Transform3d::rotateAxis ( ) const
inlinevirtual

Retrieve the Euler angle XYZ rotation axis, in degrees.

Returns
The object's rotate axis, in degrees.

Definition at line 501 of file transform3d.h.

◆ rotateAxis() [2/2]

virtual void Ufe::Transform3d::rotateAxis ( double  x,
double  y,
double  z 
)
inlinevirtual

Set the rotate axis to given value. Default implementation calls rotateAxisCmd() and executes the returned command, if non-null.

Parameters
xvalue to rotate on the X-axis, in degrees.
yvalue to rotate on the Y-axis, in degrees.
zvalue to rotate on the Z-axis, in degrees.

Definition at line 492 of file transform3d.h.

◆ rotateAxisCmd() [1/2]

RotateUndoableCommand::Ptr Ufe::Transform3d::rotateAxisCmd ( )
inline

Definition at line 484 of file transform3d.h.

◆ rotateAxisCmd() [2/2]

virtual RotateUndoableCommand::Ptr Ufe::Transform3d::rotateAxisCmd ( double  x,
double  y,
double  z 
)
inlinevirtual

Create an undoable command to set the rotate axis, an extra rotation to adjust the local axis prior to applying the rotate attribute. Euler angle rotation order is XYZ. The command is not executed. The default implementation in this class is to return a null pointer.

Parameters
xvalue to rotate on the X-axis, in degrees.
yvalue to rotate on the Y-axis, in degrees.
zvalue to rotate on the Z-axis, in degrees.
Returns
Undoable command whose undo restores the original rotation.

Definition at line 478 of file transform3d.h.

◆ rotateCmd() [1/2]

RotateUndoableCommand::Ptr Ufe::Transform3d::rotateCmd ( )
inline

Definition at line 292 of file transform3d.h.

◆ rotateCmd() [2/2]

virtual RotateUndoableCommand::Ptr Ufe::Transform3d::rotateCmd ( double  x,
double  y,
double  z 
)
pure virtual

Create an undoable rotate command. Euler angle rotation order is XYZ. The command is not executed.

Parameters
xvalue to rotate on the X-axis, in degrees.
yvalue to rotate on the Y-axis, in degrees.
zvalue to rotate on the Z-axis, in degrees.
Returns
Undoable command whose undo restores the original rotation.

◆ rotatePivot() [1/2]

virtual Vector3d Ufe::Transform3d::rotatePivot ( ) const
pure virtual

Retrieve the rotate pivot point for the object.

Returns
The rotate pivot point.

◆ rotatePivot() [2/2]

virtual void Ufe::Transform3d::rotatePivot ( double  x,
double  y,
double  z 
)
inlinevirtual

Translate the rotate pivot point. Default implementation calls rotatePivotCmd() and executes the returned command, if non-null.

Parameters
xvalue to translate on the X-axis.
yvalue to translate on the Y-axis.
zvalue to translate on the Z-axis.

Definition at line 356 of file transform3d.h.

◆ rotatePivotCmd() [1/2]

TranslateUndoableCommand::Ptr Ufe::Transform3d::rotatePivotCmd ( )
inline

Definition at line 348 of file transform3d.h.

◆ rotatePivotCmd() [2/2]

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::rotatePivotCmd ( double  x,
double  y,
double  z 
)
pure virtual

Create an undoable command to translate the rotate pivot point. The command is not executed.

Parameters
xX-axis translation.
yY-axis translation.
zZ-axis translation.
Returns
Undoable command whose undo restores the rotate pivot's position

◆ rotatePivotTranslation()

virtual Vector3d Ufe::Transform3d::rotatePivotTranslation ( ) const
inlinevirtual

Retrieve the rotate pivot correction for the object. The default implementation in this class is to return a zero vector.

Returns
The rotate pivot correction.

Definition at line 429 of file transform3d.h.

◆ rotation()

virtual Vector3d Ufe::Transform3d::rotation ( ) const
pure virtual

Retrieve the rotation value set for the object, in degrees. Euler angle rotation order is XYZ.

Returns
The object's rotation, in degrees.

◆ scale() [1/2]

virtual Vector3d Ufe::Transform3d::scale ( ) const
pure virtual

Retrieve the scale value set for the object.

Returns
The object's scale.

◆ scale() [2/2]

virtual void Ufe::Transform3d::scale ( double  x,
double  y,
double  z 
)
inlinevirtual

Scale object to given values. Default implementation calls scaleCmd() and executes the returned command, if non-null.

Parameters
xvalue to scale on the X-axis.
yvalue to scale on the Y-axis.
zvalue to scale on the Z-axis.

Definition at line 328 of file transform3d.h.

◆ scaleCmd() [1/2]

ScaleUndoableCommand::Ptr Ufe::Transform3d::scaleCmd ( )
inline

Definition at line 320 of file transform3d.h.

◆ scaleCmd() [2/2]

virtual ScaleUndoableCommand::Ptr Ufe::Transform3d::scaleCmd ( double  x,
double  y,
double  z 
)
pure virtual

Create an undoable scale command. The command is not executed.

Parameters
xvalue to scale on the X-axis.
yvalue to scale on the Y-axis.
zvalue to scale on the Z-axis.
Returns
Undoable command whose undo restores the scale's value

◆ scalePivot() [1/2]

virtual Vector3d Ufe::Transform3d::scalePivot ( ) const
pure virtual

Retrieve the scale pivot point for the object.

Returns
The scale pivot point.

◆ scalePivot() [2/2]

virtual void Ufe::Transform3d::scalePivot ( double  x,
double  y,
double  z 
)
inlinevirtual

Translate the scale pivot point. Default implementation calls scalePivotCmd() and executes the returned command, if non-null.

Parameters
xvalue to translate on the X-axis.
yvalue to translate on the Y-axis.
zvalue to translate on the Z-axis.

Definition at line 384 of file transform3d.h.

◆ scalePivotCmd() [1/2]

TranslateUndoableCommand::Ptr Ufe::Transform3d::scalePivotCmd ( )
inline

Definition at line 376 of file transform3d.h.

◆ scalePivotCmd() [2/2]

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::scalePivotCmd ( double  x,
double  y,
double  z 
)
pure virtual

Create an undoable command to translate the scale pivot point. The command is not executed.

Parameters
xX-axis translation.
yY-axis translation.
zZ-axis translation.
Returns
Undoable command whose undo restores the scale pivot's position

◆ scalePivotTranslation()

virtual Vector3d Ufe::Transform3d::scalePivotTranslation ( ) const
inlinevirtual

Retrieve the scale pivot correction for the object. The default implementation in this class is to return a zero vector.

Returns
The scale pivot correction.

Definition at line 466 of file transform3d.h.

◆ setMatrix()

virtual void Ufe::Transform3d::setMatrix ( const Matrix4d m)
inlinevirtual

Set the object's local transform to the argument matrix. Implementation in this class executes the command returned by setMatrixCmd(), if non-null.

Parameters
mComplete local transformation for the object.

Definition at line 550 of file transform3d.h.

◆ setMatrixCmd()

virtual SetMatrix4dUndoableCommand::Ptr Ufe::Transform3d::setMatrixCmd ( const Matrix4d m)
pure virtual

Create an undoable command to set the object's local transform to the argument matrix. The command is not executed.

Parameters
mComplete local transformation for the object.
Returns
Undoable command whose undo restores the original matrix.

◆ shear() [1/2]

virtual Vector3d Ufe::Transform3d::shear ( ) const
inlinevirtual

Retrieve the shear for the object. The default implementation in this class is to return a zero vector.

Returns
The (xy, xz, yz) shear.

Definition at line 536 of file transform3d.h.

◆ shear() [2/2]

virtual void Ufe::Transform3d::shear ( double  xy,
double  xz,
double  yz 
)
inlinevirtual

Change the shear. Default implementation calls shearCmd() and executes the returned command, if non-null.

Parameters
xyxy shearing.
xzxz shearing.
yzyz shearing.

Definition at line 526 of file transform3d.h.

◆ shearCmd() [1/2]

ShearUndoableCommand::Ptr Ufe::Transform3d::shearCmd ( )
inline

Definition at line 518 of file transform3d.h.

◆ shearCmd() [2/2]

virtual ShearUndoableCommand::Ptr Ufe::Transform3d::shearCmd ( double  xy,
double  xz,
double  yz 
)
inlinevirtual

Create an undoable command to change the shearing in (xy, xz, yz). The command is not executed. The default implementation in this class is to return a null pointer.

Parameters
xyxy shearing.
xzxz shearing.
yzyz shearing.
Returns
Undoable command whose undo restores the original shearing.

Definition at line 512 of file transform3d.h.

◆ transform3d()

static Ptr Ufe::Transform3d::transform3d ( const SceneItem::Ptr item)
static

Convenience method that calls the Ufe::Transform3dHandler::transform3d() method on the Transform3d handler for the item. Returns a null pointer if the argument is null, or has an empty path.

Parameters
itemSceneItem on which to create Transform3d interface.
Returns
Transform3d for the given SceneItem

◆ translate()

virtual void Ufe::Transform3d::translate ( double  x,
double  y,
double  z 
)
inlinevirtual

Translate object to the given position. Default implementation calls translateCmd() and executes the returned command, if non-null.

Parameters
xvalue to translate to the X-axis.
yvalue to translate to the Y-axis.
zvalue to translate to the Z-axis.

Definition at line 272 of file transform3d.h.

◆ translateCmd() [1/2]

TranslateUndoableCommand::Ptr Ufe::Transform3d::translateCmd ( )
inline

Definition at line 264 of file transform3d.h.

◆ translateCmd() [2/2]

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::translateCmd ( double  x,
double  y,
double  z 
)
pure virtual

Create an undoable translate command. The command is not executed.

Parameters
xX-axis translation.
yY-axis translation.
zZ-axis translation.
Returns
Undoable command whose undo restores the original translation.

◆ translateRotatePivot()

virtual void Ufe::Transform3d::translateRotatePivot ( double  x,
double  y,
double  z 
)
inlinevirtual

Change the rotate pivot correction. Default implementation calls translateRotatePivotCmd() and executes the returned command, if non-null.

Parameters
xvalue to translate on the X-axis.
yvalue to translate on the Y-axis.
zvalue to translate on the Z-axis.

Definition at line 419 of file transform3d.h.

◆ translateRotatePivotCmd() [1/2]

TranslateUndoableCommand::Ptr Ufe::Transform3d::translateRotatePivotCmd ( )
inline

Definition at line 410 of file transform3d.h.

◆ translateRotatePivotCmd() [2/2]

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::translateRotatePivotCmd ( double  x,
double  y,
double  z 
)
inlinevirtual

Create an undoable command to change the rotate pivot correction. This is used when it is desired to move the rotate pivot point without affecting the overall transformation matrix. The command is not executed. The default implementation in this class is to return a null pointer.

Parameters
xX-axis translation.
yY-axis translation.
zZ-axis translation.
Returns
Undoable command whose undo restores the rotate pivot correction

Definition at line 404 of file transform3d.h.

◆ translateScalePivot()

virtual void Ufe::Transform3d::translateScalePivot ( double  x,
double  y,
double  z 
)
inlinevirtual

Change the scale pivot correction. Default implementation calls translateScalePivotCmd() and executes the returned command, if non-null.

Parameters
xvalue to translate on the X-axis.
yvalue to translate on the Y-axis.
zvalue to translate on the Z-axis.

Definition at line 456 of file transform3d.h.

◆ translateScalePivotCmd() [1/2]

TranslateUndoableCommand::Ptr Ufe::Transform3d::translateScalePivotCmd ( )
inline

Definition at line 448 of file transform3d.h.

◆ translateScalePivotCmd() [2/2]

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::translateScalePivotCmd ( double  x,
double  y,
double  z 
)
inlinevirtual

Create an undoable command to change the scale pivot correction. This is used when it is desired to move the scale pivot point without affecting the overall transformation matrix. The command is not executed. The default implementation in this class is to return a null pointer.

Parameters
xX-axis translation.
yY-axis translation.
zZ-axis translation.
Returns
Undoable command whose undo restores the scale pivot correction

Definition at line 442 of file transform3d.h.

◆ translation()

virtual Vector3d Ufe::Transform3d::translation ( ) const
pure virtual

Retrieve the translate value set for the object.

Returns
The object's translate vector.

The documentation for this class was generated from the following file: