Rumba C++ SDK
|
This interface gives a high level access to the document structure. More...
#include <NodeDelegate.h>
Classes | |
class | AttributeDelegate |
A node attribute delegate. More... | |
class | AttributeIterator |
A node attribute iterator. More... | |
class | AttributeIteratorDelegate |
A node attribute iterator delegate to implement in the plugin. More... | |
struct | Attributes |
A node attributes iteration. More... | |
class | ChildIterator |
A node attribute iterator. More... | |
class | ChildIteratorDelegate |
A node attribute iterator delegate to implement a child iterator in the plugin. More... | |
class | Children |
A node children iteration. More... | |
class | Observer |
An object to keep an observer alive. More... | |
Public Types | |
enum | MutableFlags { ScaleX = 0x001, ScaleY = 0x002, ScaleZ = 0x004, Scale = ScaleX|ScaleY|ScaleZ, RotateX = 0x008, RotateY = 0x010, RotateZ = 0x020, Rotate = RotateX|RotateY|RotateZ, TranslateX = 0x040, TranslateY = 0x080, TranslateZ = 0x100, Translate = TranslateX|TranslateY|TranslateZ, AllComponents = Scale|Rotate|Translate } |
Public Member Functions | |
virtual std::shared_ptr< NodeDelegate > | parent ()=0 |
Returns the parent node. More... | |
virtual maquina::StringView | name () const =0 |
The node's name. More... | |
virtual std::string | path () const =0 |
Returns the full path to the node. More... | |
virtual Imath::Box3d | bounding_box () const |
Returns the bounding_box of the node. More... | |
virtual bool | is_node () const |
Return true if this node delegate is a Rumba Node. More... | |
virtual StringView | ui_description () const |
Return UI description for this node delegate, empty if not specified. More... | |
virtual Node | node () const |
Return the node behind this node delegate. More... | |
virtual bool | operator== (const NodeDelegate &o) const =0 |
Return true if both nodes are the same or both nodes are invalid. More... | |
virtual bool | operator!= (const NodeDelegate &o) const =0 |
Return true if the nodes are different or if one is invalid. More... | |
virtual std::shared_ptr< NodeDelegate > | find (const StringView &path) |
Returns descendent node_delegate using a path starting at this node. More... | |
virtual int | child_count () const |
Returns the number of children in the node. More... | |
virtual std::shared_ptr< NodeDelegate > | child (const StringView &name) |
Return a node child using its name. More... | |
virtual int | attribute_count () const |
Returns the number of attributes. More... | |
virtual std::shared_ptr< AttributeDelegate > | attribute (const StringView &name) |
Return a node attribute using its name. More... | |
virtual void | channels (std::unordered_set< Plug > &set) const |
Attributes | attributes () |
virtual bool | has_transform () const |
Return true if this node is has a transformation matrix. More... | |
virtual Imath::M44d | matrix (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node's local matrix which transforms a point from the local node space to the parent space. More... | |
virtual Imath::M44d | world_matrix (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node's world matrix which transforms a point from the local node space to the world space. More... | |
virtual Imath::M44d | parent_world_matrix (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node parent's world matrix which transforms a point from the parent space to the world space. More... | |
virtual Imath::V3d | rotate_pivot (const QueryContext &qc=QueryContext::at_current_frame) const |
virtual Imath::V3d | scale_pivot (const QueryContext &qc=QueryContext::at_current_frame) const |
virtual Imath::V3d | joint_orient (const QueryContext &qc=QueryContext::at_current_frame) const |
virtual int | mutable_flags () const |
Returns the mutable transformation component. More... | |
virtual void | start_transform (const QueryContext &qc=QueryContext::at_current_frame) |
Start a transform modification, time to backup an initial state. More... | |
virtual Imath::V3d | scale (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the scale of the node matrix. More... | |
virtual void | set_scale (const Imath::V3d &scale, const ModificationContext &mc=ModificationContext::layer) |
Set the scale of the node matrix. More... | |
virtual Imath::V3d | rotation (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node matrix's rotation as euler radians angles in the order returned by rotation_order. More... | |
virtual Imath::Eulerd::Order | rotate_order (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node rotate order. More... | |
virtual void | set_rotation (const Imath::V3d &rotation, const ModificationContext &mc=ModificationContext::layer) |
Set the transformation rotation. More... | |
virtual Imath::V3d | translation (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the node's translation. More... | |
virtual void | set_translation (const Imath::V3d &translation, const ModificationContext &mc=ModificationContext::layer) |
Set the translation of the node matrix. More... | |
virtual std::shared_ptr< Observer > | create_transform_observer (const std::function< void()> &func, bool in_interactive=true) |
virtual bool | is_camera () const |
Returns true if this node is a camera. More... | |
virtual bool | is_orthographic (const QueryContext &qc=QueryContext::at_current_frame) const |
Does this camera has an orthographic projection. More... | |
virtual float | orthographic_width (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the orthographic width, the length projected in the width of the camera image. More... | |
virtual void | set_orthographic_width (float width, const ModificationContext &mc) |
Set the orthographic width. More... | |
virtual float | center_of_interest (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the center of interest, the distance of the point the camera is looking at. More... | |
virtual void | set_center_of_interest (float coi, const ModificationContext &mc) |
Set the center of interest. More... | |
virtual float | focal_length (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the focal length, in mm. More... | |
virtual void | set_focal_length (float fl, const ModificationContext &mc) |
Set the focal length, in mm. More... | |
virtual float | horizontal_aperture (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the horizontal aperture, in cm. More... | |
virtual void | set_horizontal_aperture (float horizontal_aperture, const ModificationContext &mc) |
Set the horizontal aperture, in cm. More... | |
virtual float | vertical_aperture (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the vertical aperture, in cm. More... | |
virtual void | set_vertical_aperture (float vertical_aperture, const ModificationContext &mc) |
Set the vertical aperture, in cm. More... | |
virtual float | near_clipping_plane (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the near clipping plane. More... | |
virtual void | set_near_clipping_plane (float near_clipping_plane, const ModificationContext &mc) |
Set the near clipping plane. More... | |
virtual float | far_clipping_plane (const QueryContext &qc=QueryContext::at_current_frame) const |
Return the far clipping plane. More... | |
virtual void | set_far_clipping_plane (float far_clipping_plane, const ModificationContext &mc) |
Set the far clipping plane. More... | |
Public Member Functions inherited from maquina::UserData | |
virtual | ~UserData () |
virtual StringView | type_name () const =0 |
virtual std::shared_ptr< NodeDelegate > | node_delegate (const std::shared_ptr< NodeDelegate > &, const StringView &) const |
Override this method if the final type has a NodeDelegate. More... | |
virtual bool | has_node_delegate () const |
Static Public Member Functions | |
static Imath::V3d | extract_translation (const Imath::M44d &matrix, const Imath::V3d &scale_pivot, const Imath::V3d &rotate_pivot) |
An helper function to extract the translation component out of a local matrix and pivots. More... | |
Protected Member Functions | |
virtual std::shared_ptr< ChildIteratorDelegate > | _children_begin () |
Return the begin iterator of the attributes. More... | |
virtual std::shared_ptr< ChildIteratorDelegate > | _children_end () |
Return the end iterator of the attributes. More... | |
virtual std::shared_ptr< AttributeIteratorDelegate > | _attributes_begin () |
Return the begin iterator of the attributes. More... | |
virtual std::shared_ptr< AttributeIteratorDelegate > | _attributes_end () |
Return the end iterator of the attributes. More... | |
This interface gives a high level access to the document structure.
Using this class, not only the API nodes structure can be traversed but also the values.
The values can present a hierarchical structure which is managed by the value itself.
For exemple, a USD reader Rumba node exposes the USD file structure to the Rumba user interface with special USD values and a specialized NodeDelegate.
This class can be used to traverse the document in a user interface.
Deriving this class, one can also define a value internal hierarchy.
Those objects are invalid if the document structure changes. So they shall be keeped only during the traversal and not used if the current node has been destroyed.
If you need to keep references on a node, use a path on this node. The path is a string like "/nodeA/nodeB/nodeC.plugA/nodeD/nodeE". Here "nodeA", "nodeB" and "nodeC" are valid rumba:Node objects. "plugA" is the name of a plug of "nodeC". "nodeD" and "nodeE" are nodes served by the value stored in "plugA". "nodeD" and "nodeE" do not really exist in the document.
The matrix of the node delegate is decomposed in different components: scale, shear, rotation, translation, scale_pivots, rotate_pivot and joint_orient.
The formula to get the local matrix is (using post multiplication) : matrix = [-scale_pivot] * [scale] * [shear] * [scale_pivot] * [-rotate_pivot] * [rotate] * [joint_orient] * [rotate_pivot] * [translation]
The formula to get the world matrix is (using post multiplication) : world_matrix = matrix * parent_world_matrix
|
virtual |
Returns the bounding_box of the node.
Reimplemented in maquina::NodeDelegateRumba.
|
virtual |
Returns descendent node_delegate using a path starting at this node.
If the node_delegate does not exist, returns nullptr.
Reimplemented in maquina::NodeDelegateRumba.
|
virtual |
Return true if this node delegate is a Rumba Node.
Reimplemented in maquina::NodeDelegateRumba.
|
pure virtual |
|
virtual |
Return the node behind this node delegate.
std::runtime_error | if the node delegate is not mapped to a Node |
Reimplemented in maquina::NodeDelegateRumba.
|
pure virtual |
Return true if the nodes are different or if one is invalid.
Implemented by the plug-in.
Implemented in maquina::NodeDelegateRumba.
|
pure virtual |
Return true if both nodes are the same or both nodes are invalid.
Implemented by the plug-in.
Implemented in maquina::NodeDelegateRumba.
|
pure virtual |
|
pure virtual |
Returns the full path to the node.
Implemented by the plug-in.
Implemented in maquina::NodeDelegateRumba.
|
virtual |
Return UI description for this node delegate, empty if not specified.
Reimplemented in maquina::NodeDelegateRumba.