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::Camera Class Referenceabstract

Abstract base class for camera interface. More...

#include <camera.h>

Public Types

enum  Projection { Perspective , Orthographic }
 
typedef std::shared_ptr< CameraPtr
 
typedef bool(* RemoveObserverItemType) (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
typedef bool(* RemoveObserverPathType) (const Path &path, const Observer::Ptr &obs)
 

Public Member Functions

 Camera ()
 Constructor. More...
 
 Camera (const Camera &)=default
 Default copy constructor. More...
 
virtual ~Camera ()
 Destructor. More...
 
virtual const Pathpath () const =0
 
virtual SceneItem::Ptr sceneItem () const =0
 
virtual HorizontalApertureUndoableCommand::Ptr horizontalApertureCmd (float ha)=0
 
virtual void horizontalAperture (float ha)
 
virtual float horizontalAperture () const =0
 
virtual VerticalApertureUndoableCommand::Ptr verticalApertureCmd (float va)=0
 
virtual void verticalAperture (float va)
 
virtual float verticalAperture () const =0
 
virtual HorizontalApertureOffsetUndoableCommand::Ptr horizontalApertureOffsetCmd (float hao)=0
 
virtual void horizontalApertureOffset (float hao)
 
virtual float horizontalApertureOffset () const =0
 
virtual VerticalApertureOffsetUndoableCommand::Ptr verticalApertureOffsetCmd (float vao)=0
 
virtual void verticalApertureOffset (float vao)
 
virtual float verticalApertureOffset () const =0
 
virtual FStopUndoableCommand::Ptr fStopCmd (float fs)=0
 
virtual void fStop (float fs)
 
virtual float fStop () const =0
 
virtual FocalLengthUndoableCommand::Ptr focalLengthCmd (float fl)=0
 
virtual void focalLength (float fl)
 
virtual float focalLength () const =0
 
virtual FocusDistanceUndoableCommand::Ptr focusDistanceCmd (float fd)=0
 
virtual void focusDistance (float fd)
 
virtual float focusDistance () const =0
 
virtual NearClipPlaneUndoableCommand::Ptr nearClipPlaneCmd (float ncp)=0
 
virtual void nearClipPlane (float ncp)
 
virtual float nearClipPlane () const =0
 
virtual FarClipPlaneUndoableCommand::Ptr farClipPlaneCmd (float fcp)=0
 
virtual void farClipPlane (float fcp)
 
virtual float farClipPlane () const =0
 
virtual ProjectionUndoableCommand::Ptr projectionCmd (Projection p)=0
 
virtual void projection (Projection p)
 
virtual Projection projection () const =0
 

Static Public Member Functions

static Ptr camera (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 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)
 

Detailed Description

Abstract base class for camera interface.

This base class defines the interface that runtimes can implement for cameras.

To determine the transform of a camera attach a transform3d interface to the scene item, or to the first ancestor scene item which is a Transform3d.

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.

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, Camera interface objects should be obtained and used within a local scope, and not stored. Camera interfaces should be considered stateless, and can be bound to new selection items.

Definition at line 49 of file camera.h.

Member Typedef Documentation

◆ Ptr

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

Definition at line 52 of file camera.h.

◆ RemoveObserverItemType

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

Definition at line 90 of file camera.h.

◆ RemoveObserverPathType

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

Definition at line 102 of file camera.h.

Member Enumeration Documentation

◆ Projection

Enumerator
Perspective 
Orthographic 

Definition at line 54 of file camera.h.

Constructor & Destructor Documentation

◆ Camera() [1/2]

Ufe::Camera::Camera ( )

Constructor.

◆ Camera() [2/2]

Ufe::Camera::Camera ( const Camera )
default

Default copy constructor.

◆ ~Camera()

virtual Ufe::Camera::~Camera ( )
virtual

Destructor.

Member Function Documentation

◆ addObserver()

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

Add observation on the argument item for Camera 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.

◆ camera()

static Ptr Ufe::Camera::camera ( const SceneItem::Ptr item)
static

Convenience method that calls the Ufe::CameraHandler::camera() method on the Camera handler for the item. Returns a null pointer if the argument is null, is an empty path or if the item does not support the Camera interface.

Parameters
itemSceneItem's Camera to retrieve
Returns
Camera of the given SceneItem

◆ farClipPlane() [1/2]

virtual float Ufe::Camera::farClipPlane ( ) const
pure virtual

Retrieve the far clip plane for the camera

Returns
the far clip plane.

◆ farClipPlane() [2/2]

virtual void Ufe::Camera::farClipPlane ( float  fcp)
inlinevirtual

Set the far clip plane. Default implementation calls farClipPlaneCmd() and executes the returned command, if non-null.

Parameters
fcpthe new far clip plane.

Definition at line 343 of file camera.h.

◆ farClipPlaneCmd()

virtual FarClipPlaneUndoableCommand::Ptr Ufe::Camera::farClipPlaneCmd ( float  fcp)
pure virtual

Create an undoable command to set the far clip plane. The command is not executed.

Parameters
fcpthe new far clip plane.
Returns
Undoable command whose undo restores the camera's far clip plane

◆ focalLength() [1/2]

virtual float Ufe::Camera::focalLength ( ) const
pure virtual

Retrieve the focal length for the camera

Returns
the focal length in millimeters

◆ focalLength() [2/2]

virtual void Ufe::Camera::focalLength ( float  fl)
inlinevirtual

Set the focal length. Default implementation calls focalLengthCmd() and executes the returned command, if non-null.

Parameters
flthe new focal length in millimeters.

Definition at line 274 of file camera.h.

◆ focalLengthCmd()

virtual FocalLengthUndoableCommand::Ptr Ufe::Camera::focalLengthCmd ( float  fl)
pure virtual

Create an undoable command to set the focal length. The command is not executed.

Parameters
flthe new focal length in millimeters.
Returns
Undoable command whose undo restores the camera's focal length

◆ focusDistance() [1/2]

virtual float Ufe::Camera::focusDistance ( ) const
pure virtual

Retrieve the focus distance for the camera

Returns
the focus distance in millimeters

◆ focusDistance() [2/2]

virtual void Ufe::Camera::focusDistance ( float  fd)
inlinevirtual

Set the focus distance. Default implementation calls focusDistanceCmd() and executes the returned command, if non-null.

Parameters
fdthe new focus distance in millimeters.

Definition at line 297 of file camera.h.

◆ focusDistanceCmd()

virtual FocusDistanceUndoableCommand::Ptr Ufe::Camera::focusDistanceCmd ( float  fd)
pure virtual

Create an undoable command to set the focus distance. The command is not executed.

Parameters
fdthe new focus distance in millimeters.
Returns
Undoable command whose undo restores the camera's focus distance

◆ fStop() [1/2]

virtual float Ufe::Camera::fStop ( ) const
pure virtual

Retrieve the fStop for the camera

Returns
the fStop in millimeters

◆ fStop() [2/2]

virtual void Ufe::Camera::fStop ( float  fs)
inlinevirtual

Set the fStop. Default implementation calls fStopCmd() and executes the returned command, if non-null.

Parameters
fsthe new fStop in millimeters.

Definition at line 251 of file camera.h.

◆ fStopCmd()

virtual FStopUndoableCommand::Ptr Ufe::Camera::fStopCmd ( float  fs)
pure virtual

Create an undoable command to set the fStop. The command is not executed.

Parameters
fsthe new fStop in millimeters.
Returns
Undoable command whose undo restores the camera's fStop

◆ hasObserver()

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

Query observation on argument item for camera changes.

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

◆ hasObservers() [1/2]

static bool Ufe::Camera::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::Camera::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.

◆ horizontalAperture() [1/2]

virtual float Ufe::Camera::horizontalAperture ( ) const
pure virtual

Retrieve the horizontal aperture for the camera

Returns
the horizontal aperture in inches

◆ horizontalAperture() [2/2]

virtual void Ufe::Camera::horizontalAperture ( float  ha)
inlinevirtual

Set the horizontal aperture. Default implementation calls horizontalApertureCmd() and executes the returned command, if non-null.

Parameters
hathe new horizontal aperture in inches.

Definition at line 159 of file camera.h.

◆ horizontalApertureCmd()

virtual HorizontalApertureUndoableCommand::Ptr Ufe::Camera::horizontalApertureCmd ( float  ha)
pure virtual

Create an undoable command to set the horizontal aperture. The command is not executed.

Parameters
hathe new horizontal aperture in inches.
Returns
Undoable command whose undo restores the camera's horizontal aperture

◆ horizontalApertureOffset() [1/2]

virtual float Ufe::Camera::horizontalApertureOffset ( ) const
pure virtual

Retrieve the horizontal aperture offset for the camera

Returns
the horizontal aperture offset in inches

◆ horizontalApertureOffset() [2/2]

virtual void Ufe::Camera::horizontalApertureOffset ( float  hao)
inlinevirtual

Set the horizontal aperture offset. Default implementation calls horizontalApertureOffsetCmd() and executes the returned command, if non-null.

Parameters
haothe new horizontal aperture offset in inches.

Definition at line 205 of file camera.h.

◆ horizontalApertureOffsetCmd()

virtual HorizontalApertureOffsetUndoableCommand::Ptr Ufe::Camera::horizontalApertureOffsetCmd ( float  hao)
pure virtual

Create an undoable command to set the horizontal aperture offset. The command is not executed.

Parameters
haothe new horizontal aperture offset in inches.
Returns
Undoable command whose undo restores the camera's horizontal aperture offset

◆ nbObservers()

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

Number of observers on the given SceneItem.

Parameters
itemSceneItem for which to count observers.
Returns
Number of observers on SceneItem.

◆ nearClipPlane() [1/2]

virtual float Ufe::Camera::nearClipPlane ( ) const
pure virtual

Retrieve the near clip plane for the camera

Returns
the near clip plane.

◆ nearClipPlane() [2/2]

virtual void Ufe::Camera::nearClipPlane ( float  ncp)
inlinevirtual

Set the near clip plane. Default implementation calls nearClipPlaneCmd() and executes the returned command, if non-null.

Parameters
ncpthe new near clip plane.

Definition at line 320 of file camera.h.

◆ nearClipPlaneCmd()

virtual NearClipPlaneUndoableCommand::Ptr Ufe::Camera::nearClipPlaneCmd ( float  ncp)
pure virtual

Create an undoable command to set the near clip plane. The command is not executed.

Parameters
ncpthe new near clip plane.
Returns
Undoable command whose undo restores the camera's near clip plane

◆ notify()

static void Ufe::Camera::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::Camera::path ( ) const
pure virtual
Returns
the object's Path.

◆ projection() [1/2]

virtual Projection Ufe::Camera::projection ( ) const
pure virtual

Retrieve the projection for the camera

Returns
the projection

◆ projection() [2/2]

virtual void Ufe::Camera::projection ( Projection  p)
inlinevirtual

Set the projection. Default implementation calls projectionCmd() and executes the returned command, if non-null.

Parameters
pthe new projection.

Definition at line 366 of file camera.h.

◆ projectionCmd()

virtual ProjectionUndoableCommand::Ptr Ufe::Camera::projectionCmd ( Projection  p)
pure virtual

Create an undoable command to set the projection. The command is not executed.

Parameters
pthe new projection.
Returns
Undoable command whose undo restores the camera's projection

◆ removeObserver() [1/2]

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

Remove observation on the argument path for transform changes.

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::Camera::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.

◆ sceneItem()

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

◆ verticalAperture() [1/2]

virtual float Ufe::Camera::verticalAperture ( ) const
pure virtual

Retrieve the vertical aperture for the camera

Returns
the vertical aperture in inches

◆ verticalAperture() [2/2]

virtual void Ufe::Camera::verticalAperture ( float  va)
inlinevirtual

Set the vertical aperture. Default implementation calls verticalApertureCmd() and executes the returned command, if non-null.

Parameters
vathe new vertical aperture in inches.

Definition at line 182 of file camera.h.

◆ verticalApertureCmd()

virtual VerticalApertureUndoableCommand::Ptr Ufe::Camera::verticalApertureCmd ( float  va)
pure virtual

Create an undoable command to set the vertical aperture. The command is not executed.

Parameters
vathe new vertical aperture in inches.
Returns
Undoable command whose undo restores the camera's vertical aperture

◆ verticalApertureOffset() [1/2]

virtual float Ufe::Camera::verticalApertureOffset ( ) const
pure virtual

Retrieve the vertical aperture offset for the camera

Returns
the vertical aperture offset in inches

◆ verticalApertureOffset() [2/2]

virtual void Ufe::Camera::verticalApertureOffset ( float  vao)
inlinevirtual

Set the vertical aperture offset. Default implementation calls verticalApertureOffsetCmd() and executes the returned command, if non-null.

Parameters
vaothe new vertical aperture offset in inches.

Definition at line 228 of file camera.h.

◆ verticalApertureOffsetCmd()

virtual VerticalApertureOffsetUndoableCommand::Ptr Ufe::Camera::verticalApertureOffsetCmd ( float  vao)
pure virtual

Create an undoable command to set the vertical aperture offset. The command is not executed.

Parameters
vaothe new vertical aperture offset in inches.
Returns
Undoable command whose undo restores the camera's vertical aperture offset

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