ufe  1.0
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>

Public Types

typedef std::shared_ptr< Transform3dPtr
 

Public Member Functions

 Transform3d ()
 Constructor. More...
 
 Transform3d (const Transform3d &)=default
 Default copy constructor. More...
 
virtual ~Transform3d ()
 Destructor. More...
 
virtual const Pathpath () const =0
 
virtual SceneItem::Ptr sceneItem () const =0
 
virtual TranslateUndoableCommand::Ptr translateCmd ()=0
 
virtual void translate (double x, double y, double z)=0
 
virtual Vector3d translation () const =0
 
virtual RotateUndoableCommand::Ptr rotateCmd ()=0
 
virtual void rotate (double x, double y, double z)=0
 
virtual ScaleUndoableCommand::Ptr scaleCmd ()=0
 
virtual void scale (double x, double y, double z)=0
 
virtual TranslateUndoableCommand::Ptr rotatePivotTranslateCmd ()=0
 
virtual void rotatePivotTranslate (double x, double y, double z)=0
 
virtual Vector3d rotatePivot () const =0
 
virtual TranslateUndoableCommand::Ptr scalePivotTranslateCmd ()=0
 
virtual void scalePivotTranslate (double x, double y, double z)=0
 
virtual Vector3d scalePivot () 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 bool addObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool removeObserver (const SceneItem::Ptr &item, 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)
 

Detailed Description

Abstract base class for 3D transform interface.

This base class defines the interface that run-times 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 run-time 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 83 of file transform3d.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 86 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 ( )
virtual

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.

◆ exclusiveMatrix()

Matrix4d Ufe::Transform3d::exclusiveMatrix ( ) const

Retrieve the exclusive Matrix of the object. This matrix includes the transformation's inclusive matrix of this object's parent, without the object itself.

Returns
Exclusive Matrix4d of the 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 run-times, to determine if any path they are responsible for is being observed.

Parameters
runTimeIdrun-time Id to find observers on.
Returns
True if any path of given run-time Id are being observed.

◆ inclusiveMatrix()

Matrix4d Ufe::Transform3d::inclusiveMatrix ( ) const

Retrieve the inclusive Matrix of the object. This matrix includes the transformation's inclusive matrix of this object's parent, and the object itself.

Returns
Inclusive Matrix4d of the SceneItem.

◆ 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.

◆ path()

virtual const Path& Ufe::Transform3d::path ( ) const
pure virtual
Returns
the object's Path.

◆ removeObserver()

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 
)
pure virtual

Rotate object to given value.

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

◆ rotateCmd()

virtual RotateUndoableCommand::Ptr Ufe::Transform3d::rotateCmd ( )
pure virtual

Create an undoable rotate command

Returns
Undoable command whose undo restores the rotation's position

◆ rotatePivot()

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

Retrieve the rotate pivot point for the object.

Returns
The rotate pivot point.

◆ rotatePivotTranslate()

virtual void Ufe::Transform3d::rotatePivotTranslate ( double  x,
double  y,
double  z 
)
pure virtual

Translate the rotate pivot point.

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

◆ rotatePivotTranslateCmd()

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::rotatePivotTranslateCmd ( )
pure virtual

Create an undoable command to translate the rotate pivot point.

Returns
Undoable command whose undo restores the rotate pivot's position

◆ scale()

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

Scale object to given values.

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

◆ scaleCmd()

virtual ScaleUndoableCommand::Ptr Ufe::Transform3d::scaleCmd ( )
pure virtual

Create an undoable scale command

Returns
Undoable command whose undo restores the scale's value

◆ scalePivot()

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

Retrieve the scale pivot point for the object.

Returns
The scale pivot point.

◆ scalePivotTranslate()

virtual void Ufe::Transform3d::scalePivotTranslate ( double  x,
double  y,
double  z 
)
pure virtual

Translate the scale pivot point.

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

◆ scalePivotTranslateCmd()

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::scalePivotTranslateCmd ( )
pure virtual

Create an undoable command to translate the scale pivot point.

Returns
Undoable command whose undo restores the scale pivot's position

◆ sceneItem()

virtual SceneItem::Ptr Ufe::Transform3d::sceneItem ( ) const
pure virtual
Returns
the object's SceneItem.

◆ segmentExclusiveMatrix()

virtual Matrix4d Ufe::Transform3d::segmentExclusiveMatrix ( ) const
pure virtual

Retrieve the exclusive Matrix of the object, for all objects in the tail segment of the object's path, excluding the object itself. The tail segment exclusive matrix and inclusive matrices of other segments of a path are multiplied together by exclusiveMatrix(), from head to tail, to obtain the full transformation. In the case of a trivial single segment path, the segmentExclusiveMatrix and the exclusiveMatrix are the same.

Returns
The PathSegment's exclusive transform matrix

◆ segmentInclusiveMatrix()

virtual Matrix4d Ufe::Transform3d::segmentInclusiveMatrix ( ) const
pure virtual

Retrieve the inclusive Matrix of the object, for all objects in the tail segment of the object's path, including the object itself. The segment inclusive matrices of a path are multiplied together by inclusiveMatrix(), from head to tail, to obtain the full transformation. In the case of a trivial single segment path, the segmentInclusiveMatrix and the inclusiveMatrix are the same.

Returns
The PathSegment's transform matrix

◆ transform3d()

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

Convenience method that calls the 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's Transform3d to retrieve
Returns
Transform3d of the given SceneItem

◆ translate()

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

Translate object to the given position.

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

◆ translateCmd()

virtual TranslateUndoableCommand::Ptr Ufe::Transform3d::translateCmd ( )
pure virtual

Create an undoable translate command

Returns
Undoable command whose undo restores the translate's position

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