|
Rumba C++ SDK
|
A node plug. More...
#include <Plug.h>
Classes | |
| class | Flags |
| struct | Key |
| class | Outputs |
| A Plug accessor to the outputs. More... | |
Public Types | |
| enum | DependencyFlags { Automatic = -2 } |
| Dependency flags to pass to add_value_dependency. More... | |
| enum | TypeEvaluationMode { TypeEvaluationMode::Default = 0, TypeEvaluationMode::Exact = 1, TypeEvaluationMode::Approximation = 2 } |
| The plug's type evaluation modes. More... | |
| enum | EvaluationMode { EvaluationMode::Interactive = 0, EvaluationMode::Exact = 1, EvaluationMode::NoEvaluation = 2, EvaluationMode::Rest = 3 } |
| The value evaluation modes. More... | |
| enum | Status { Status::Default, Status::Overridden, Status::Animated } |
| Status of the plug. More... | |
Public Member Functions | |
| Plug (const char *name, const Value &value, uint32_t flags=0) | |
| Create a free plug (i.e. not attached to a Node). More... | |
| std::string | name () const |
| Return the plug name. More... | |
| std::string | full_name () const |
| Return the plug full name starting at the workspace node. More... | |
| std::string | document_path () const |
| Returns the path of this plug starting at the document node. More... | |
| std::string | nice_name () const |
| Returns the name of this plug to be displayed in UI (extracted from the 'nice_name' property of the description). More... | |
| std::string | type_name (TypeEvaluationMode mode=TypeEvaluationMode::Default) const |
| Returns the name of the type the plug. More... | |
| std::shared_ptr< AttributeDescriptor > | description () const |
| Returns the plug's description. More... | |
| void | set_description (const std::string &description, bool undo_stack=false) |
| Set the description of this plug. More... | |
| void | set_default_value (const Value &value) |
| Set the default value of this plug. More... | |
| Value | default_value () const |
| Return the default plug value. More... | |
| Value | rest_value () const |
| Return the rest plug value. More... | |
| void | force_varying (bool force) |
| Value | value (const QueryContext &qc=QueryContext::at_current_frame, EvaluationMode mode=EvaluationMode::Interactive) const |
| Get the plug value. More... | |
| bool | as_bool () const |
| Returns the plug value as a bool. More... | |
| int | as_int () const |
| Returns the plug value as an integer. More... | |
| float | as_float () const |
| Returns the plug value as a float. More... | |
| double | as_double () const |
| Returns the plug value as a double. More... | |
| const std::string & | as_string () const |
| Returns the plug value as a string. More... | |
| std::wstring | as_wstring () const |
| const Imath::V2d & | as_V2d () const |
| Returns the plug value as a V2d. More... | |
| const Imath::V3d & | as_V3d () const |
| Returns the plug value as a V3d. More... | |
| const Imath::V4d & | as_V4d () const |
| Returns the plug value as a V4d. More... | |
| const Imath::V2i & | as_V2i () const |
| Returns the plug value as a V2i. More... | |
| const Imath::V3i & | as_V3i () const |
| Returns the plug value as a V3i. More... | |
| const Imath::V4i & | as_V4i () const |
| Returns the plug value as a V4i. More... | |
| const Imath::M44d & | as_M44d () const |
| Returns the plug value as a M44d. More... | |
| const Imath::Box3f & | as_Box3f () const |
| Returns the plug value as a Box3f. More... | |
| const Imath::Color4f & | as_Color4f () const |
| Returns the plug value as a Color4f. More... | |
| const Imath::Quatd & | as_Quatd () const |
| Returns the plug value as a Quatd. More... | |
| std::shared_ptr< const class UserData > | as_user_data () const |
| Returns the plug value as a user data. More... | |
| void | set_value (const Value &value, bool undo_stack=false) |
| Set a value. More... | |
| void | set_value (const Value &value, const PartialInvalidationPtr pi, bool undo_stack=false) |
| Set a value along with PartialInvalidation data. More... | |
| void | set_value (const Value &value, const ModificationContext &mc) |
| Set a value. More... | |
| void | set_value (const Value &value, const ModificationContext &mc, int32_t start, int32_t end) |
| Set a value with a custom invalidation range. More... | |
| bool | can_connect (const Plug &other) const |
| Check if the plug can be connected. More... | |
| bool | depend_on (const gsl::span< const Plug > &plugs) const |
| Return true if this plug depends on one of the plugs. More... | |
| bool | is_connected () const |
| Return true if the plug has an input connection. More... | |
| bool | is_connection_serialized () const |
| Return true if the node connection has to be serialized. More... | |
| bool | is_internal () const |
| Return true if this plug should be ignored by users and the UI. More... | |
| bool | is_channel () const |
| Return true if this plug is a channel. A channel is a plug visible and animatable by the animator. More... | |
| void | set_channel (bool channel) |
| Set the channel status of this plug. More... | |
| bool | is_constant () const |
| Return true if the plug value is constant in time. More... | |
| bool | is_evaluated () const |
| Return true if this plug is evaluated. More... | |
| bool | is_output () const |
| Return true if this plug is an output. More... | |
| bool | is_keyable () const |
| Return true if this plug is keyable. More... | |
| bool | is_main_plug () const |
| Return true if the plug is a main plug, i-e, is displayed by default. More... | |
| bool | is_auto_connect () const |
| Return true if the plug connects when a node is dropped over a connection. More... | |
| bool | is_dynamic () const |
| Return true if the plug is dynamic. More... | |
| bool | is_referenced_dynamic () const |
| Return true if the plug is dynamic and comes from a referenced node. More... | |
| bool | is_animable () const |
| Return true if this plug is animable. More... | |
| bool | is_mutable () const |
| Return true if this plug is mutable (i.e. can be modified). More... | |
| bool | is_referenced_connection () const |
| Return true if the input connection has been done in a referenced node. More... | |
| Plug::Status | status () const |
| Return the plug status. More... | |
| void | connect (const Plug &src, bool undo_stack=false, bool serialize=false) |
| Connect src to this plug. More... | |
| void | disconnect (bool undo_stack=false) |
| Disconnect the plug connected into this. More... | |
| void | disconnect_outputs (bool undo_stack=false) |
| Disconnect all the plugs this plug is connected into. More... | |
| void | add_dynamic_valued_dependency (const Plug &dependence, int32_t time_offset=0, bool undo_stack=false, bool serialize=false) |
| void | add_valued_dependency (const Plug &dependence, int32_t index=-1, int32_t time_offset=0, bool undo_stack=false, bool serialize=false) |
| void | remove_dynamic_valued_dependency (const Plug &dependence, bool undo_stack=true) |
| void | remove_valued_dependency (const Plug &dependence, bool undo_stack=true) |
| void | remove_dynamic_valued_dependency (uint32_t index, bool undo_stack=true) |
| void | remove_valued_dependency (uint32_t index, bool undo_stack=true) |
| void | remove_all_dynamic_valued_dependencies (bool undo_stack=true) |
| void | remove_all_valued_dependencies (bool undo_stack=true) |
| std::vector< Plug > | notification_dependencies () |
| void | add_notification_dependency (const Plug &dependence, bool serialize=false) |
| void | remove_notification_dependency (const Plug &dependence, bool notify=true) |
| void | remove_all_notification_dependencies (bool notify=true) |
| std::vector< Plug > | back_dependencies () |
| size_t | back_dependencies_count () |
| std::vector< Plug > | valued_dependencies () |
| Plug | valued_dependence (int dep_index) const |
| uint32_t | valued_dependencies_count () const |
| The number of valued dependencies for this plug. More... | |
| bool | has_valued_dependency (const Plug &plug) const |
| void | touch () |
| void | touch (int first_frame, int last_frame, bool rest) |
| void | set_to_default () |
| Reset the plug default value flag. More... | |
| uint32_t | flags () const |
| Return the plug flags. More... | |
| void | set_flags (uint32_t flags) |
| Set the plug flags. More... | |
| Plug | input () const |
| Get the input plug. More... | |
| Plug | input_origin () const |
| Outputs | outputs () const |
| Return the node plugs iteration. More... | |
| std::vector< Plug > | channel_plugs () const |
| std::vector< Channel > | channels () const |
| Return all the plug's channels. More... | |
| std::shared_ptr< Channel > | channel () const |
| If this plug has a single channel, return it, return nullptr otherwise. More... | |
| std::shared_ptr< Channel > | channel (ChannelType channel_type) const |
| Return the specified channel if available, return nullptr otherwise. More... | |
| bool | has_node () const |
| Node | node () const |
| std::vector< Plug > | walk_down () const |
| Returns the next plugs to visit to traverse the graph from inputs to outputs, stating at this plug. More... | |
| bool | operator== (const Plug &o) const |
| bool | operator!= (const Plug &o) const |
| std::shared_ptr< NodeDelegate > | node_delegate () const |
| Return a node delegate for this plug. More... | |
| std::unordered_map< float, Key > | key_frames () const |
| Get the plug keys in targeted layer. More... | |
| std::unordered_map< float, Key > | key_frames_in_layer (const Node &layer) const |
| Get the plug keys in the layer. More... | |
Static Public Member Functions | |
| static bool | validate_name (const char *plug_name) |
| Return true if the name is a valid plug name. More... | |
Public Attributes | |
| void * | _plug |
Static Public Attributes | |
| static const int32_t | AllFrames = int32_t(0x80000000) |
A node plug.
A Plug is a node attribute. It can hold a Value object.
A Plug can be an input Plug, in that case, another plug can be connected into it and propagate its value in it.
A plug can be an output Plug, in that case, its value is evaluated using dependancies on other plugs and an evaluation function. Output Plugs can't have an input connection.
|
strong |
The value evaluation modes.
|
strong |
|
strong |
| maquina::Plug::Plug | ( | const char * | name, |
| const Value & | value, | ||
| uint32_t | flags = 0 |
||
| ) |
| void maquina::Plug::add_dynamic_valued_dependency | ( | const Plug & | dependence, |
| int32_t | time_offset = 0, |
||
| bool | undo_stack = false, |
||
| bool | serialize = false |
||
| ) |
Add a dynamic valued dependence to this plug.
The evaluation function of this plug will receive values from the given dependence plug. The dependence is added at the end of the current dynamic depencency list. {std::runtime_error,RuntimeError} if this plug is not evaluated.
| dependence | the new dependence plug |
| undo_stack | if true, use a modification to be able to revert this action |
| serialize | if true and undo_stack is false, this dependency will be serialized on save. |
| void maquina::Plug::add_notification_dependency | ( | const Plug & | dependence, |
| bool | serialize = false |
||
| ) |
| void maquina::Plug::add_valued_dependency | ( | const Plug & | dependence, |
| int32_t | index = -1, |
||
| int32_t | time_offset = 0, |
||
| bool | undo_stack = false, |
||
| bool | serialize = false |
||
| ) |
| bool maquina::Plug::as_bool | ( | ) | const |
Returns the plug value as a bool.
You must be sure the plug value is an integer, a float or a boolean or you get false.
| const Imath::Box3f& maquina::Plug::as_Box3f | ( | ) | const |
Returns the plug value as a Box3f.
You must be sure the plug value is a Box3f or you will have an empty box.
| const Imath::Color4f& maquina::Plug::as_Color4f | ( | ) | const |
Returns the plug value as a Color4f.
You must be sure the plug value is a Color4f or you will have {0,0,0,0}.
| double maquina::Plug::as_double | ( | ) | const |
Returns the plug value as a double.
You must be sure the plug value is an integer, a float or a boolean or you get 0.0.
| float maquina::Plug::as_float | ( | ) | const |
Returns the plug value as a float.
You must be sure the plug value is an integer, a float or a boolean or you get 0.f.
| int maquina::Plug::as_int | ( | ) | const |
Returns the plug value as an integer.
You must be sure the plug value is an integer, a float or a boolean or you get 0.
| const Imath::M44d& maquina::Plug::as_M44d | ( | ) | const |
Returns the plug value as a M44d.
You must be sure the plug value is a M44d or you will have an identity matrix.
| const Imath::Quatd& maquina::Plug::as_Quatd | ( | ) | const |
Returns the plug value as a Quatd.
You must be sure the plug value is a Quatd or you will have an identity quaternion.
| const std::string& maquina::Plug::as_string | ( | ) | const |
Returns the plug value as a string.
You must be sure the plug value is a string or you will have an empty string.
| std::shared_ptr<const class UserData> maquina::Plug::as_user_data | ( | ) | const |
Returns the plug value as a user data.
If the underlying time is not a used data, a nullptr is returned.
| const Imath::V2d& maquina::Plug::as_V2d | ( | ) | const |
Returns the plug value as a V2d.
You must be sure the plug value is a V2d or you will have {0,0}.
| const Imath::V2i& maquina::Plug::as_V2i | ( | ) | const |
Returns the plug value as a V2i.
You must be sure the plug value is a V2i or you will have {0,0}.
| const Imath::V3d& maquina::Plug::as_V3d | ( | ) | const |
Returns the plug value as a V3d.
You must be sure the plug value is a V3d or you will have {0,0,0}.
| const Imath::V3i& maquina::Plug::as_V3i | ( | ) | const |
Returns the plug value as a V3i.
You must be sure the plug value is a V3i or you will have {0,0,0}.
| const Imath::V4d& maquina::Plug::as_V4d | ( | ) | const |
Returns the plug value as a V4d.
You must be sure the plug value is a V4d or you will have {0,0,0,0}.
| const Imath::V4i& maquina::Plug::as_V4i | ( | ) | const |
Returns the plug value as a V4i.
You must be sure the plug value is a V4i or you will have {0,0,0,0}.
| std::wstring maquina::Plug::as_wstring | ( | ) | const |
| std::vector<Plug> maquina::Plug::back_dependencies | ( | ) |
| size_t maquina::Plug::back_dependencies_count | ( | ) |
| bool maquina::Plug::can_connect | ( | const Plug & | other | ) | const |
Check if the plug can be connected.
Check if a loop would be created by connecting those two plugs
| other | The plug to be connected |
| std::shared_ptr<Channel> maquina::Plug::channel | ( | ) | const |
If this plug has a single channel, return it, return nullptr otherwise.
| std::shared_ptr<Channel> maquina::Plug::channel | ( | ChannelType | channel_type | ) | const |
Return the specified channel if available, return nullptr otherwise.
| std::vector<Plug> maquina::Plug::channel_plugs | ( | ) | const |
| std::vector<Channel> maquina::Plug::channels | ( | ) | const |
Return all the plug's channels.
| void maquina::Plug::connect | ( | const Plug & | src, |
| bool | undo_stack = false, |
||
| bool | serialize = false |
||
| ) |
Connect src to this plug.
The value of src will be propagated to this plug.If true, the connection will be serialized in the file. If undo_stack is true, the connection is assumed to be serialized, and serialize is ignored.
| src | The source plug |
| undo_stack | If true, the connection is reverted if an undo is performed. Ignored if undo_stack is true. |
| Value maquina::Plug::default_value | ( | ) | const |
Return the default plug value.
The default value is the value the plug has been created with. This is not the REST value (the value with no animation).
| bool maquina::Plug::depend_on | ( | const gsl::span< const Plug > & | plugs | ) | const |
Return true if this plug depends on one of the plugs.
| plugs | A list of plug to check for dependency |
| std::shared_ptr<AttributeDescriptor> maquina::Plug::description | ( | ) | const |
Returns the plug's description.
| void maquina::Plug::disconnect | ( | bool | undo_stack = false | ) |
Disconnect the plug connected into this.
If true, the connection is restored if an undo is performed. Ignored if undo_stack is false.
| void maquina::Plug::disconnect_outputs | ( | bool | undo_stack = false | ) |
Disconnect all the plugs this plug is connected into.
If true, the connections are restored if an undo is performed. Ignored if undo_stack is false.
| std::string maquina::Plug::document_path | ( | ) | const |
Returns the path of this plug starting at the document node.
| uint32_t maquina::Plug::flags | ( | ) | const |
Return the plug flags.
| void maquina::Plug::force_varying | ( | bool | force | ) |
Force the value of this plug to be time varying. true if this plug should always be considered as time varying, false if the evaluation engine should determine it iself.
| std::string maquina::Plug::full_name | ( | ) | const |
Return the plug full name starting at the workspace node.
| bool maquina::Plug::has_node | ( | ) | const |
| bool maquina::Plug::has_valued_dependency | ( | const Plug & | plug | ) | const |
Check if this plug has a valued dependency on another plug.
| plug | The plug we want to check if is a dependence. |
| Plug maquina::Plug::input | ( | ) | const |
Get the input plug.
| std::runtime_error | if the plug is not connected |
| Plug maquina::Plug::input_origin | ( | ) | const |
Get the connection chain origin of a plug.
If this plug has a connection, this method returns the connection chain origin, i.e. the plug without connection that propagate its value to this plug. If this plug is not connected, the real input is the plug itself.
| bool maquina::Plug::is_animable | ( | ) | const |
Return true if this plug is animable.
| bool maquina::Plug::is_auto_connect | ( | ) | const |
Return true if the plug connects when a node is dropped over a connection.
A node should have an input and an output plug for every types the node can auto connect.
| bool maquina::Plug::is_channel | ( | ) | const |
Return true if this plug is a channel. A channel is a plug visible and animatable by the animator.
| bool maquina::Plug::is_connected | ( | ) | const |
Return true if the plug has an input connection.
| bool maquina::Plug::is_connection_serialized | ( | ) | const |
Return true if the node connection has to be serialized.
| bool maquina::Plug::is_constant | ( | ) | const |
Return true if the plug value is constant in time.
| bool maquina::Plug::is_dynamic | ( | ) | const |
Return true if the plug is dynamic.
A dynamic plug can be dynamically created or removed, except if it comes from a referenced node.
| bool maquina::Plug::is_evaluated | ( | ) | const |
Return true if this plug is evaluated.
| bool maquina::Plug::is_internal | ( | ) | const |
Return true if this plug should be ignored by users and the UI.
| bool maquina::Plug::is_keyable | ( | ) | const |
Return true if this plug is keyable.
| bool maquina::Plug::is_main_plug | ( | ) | const |
Return true if the plug is a main plug, i-e, is displayed by default.
| bool maquina::Plug::is_mutable | ( | ) | const |
Return true if this plug is mutable (i.e. can be modified).
| bool maquina::Plug::is_output | ( | ) | const |
Return true if this plug is an output.
| bool maquina::Plug::is_referenced_connection | ( | ) | const |
Return true if the input connection has been done in a referenced node.
| bool maquina::Plug::is_referenced_dynamic | ( | ) | const |
Return true if the plug is dynamic and comes from a referenced node.
A dynamic plug can be dynamically created or removed, except if it comes from a referenced node.
| std::unordered_map<float, Key> maquina::Plug::key_frames | ( | ) | const |
Get the plug keys in targeted layer.
Get the plug keys in the layer.
| std::string maquina::Plug::name | ( | ) | const |
Return the plug name.
| std::string maquina::Plug::nice_name | ( | ) | const |
Returns the name of this plug to be displayed in UI (extracted from the 'nice_name' property of the description).
| Node maquina::Plug::node | ( | ) | const |
| std::shared_ptr<NodeDelegate> maquina::Plug::node_delegate | ( | ) | const |
Return a node delegate for this plug.
| std::vector<Plug> maquina::Plug::notification_dependencies | ( | ) |
|
inline |
|
inline |
| Outputs maquina::Plug::outputs | ( | ) | const |
Return the node plugs iteration.
| void maquina::Plug::remove_all_dynamic_valued_dependencies | ( | bool | undo_stack = true | ) |
Remove all the dynamic valued dependencies from this plug. Internal dependencies are not removed.
| undo_stack | if true, use a modification to be able to revert this action. |
| void maquina::Plug::remove_all_notification_dependencies | ( | bool | notify = true | ) |
| void maquina::Plug::remove_all_valued_dependencies | ( | bool | undo_stack = true | ) |
| void maquina::Plug::remove_dynamic_valued_dependency | ( | const Plug & | dependence, |
| bool | undo_stack = true |
||
| ) |
Remove a dynamic valued dependence from this plug.
The dependence is identified by the given plug. If there is more than one dependence on the given plug, on the first one is removed (the one with the smallest index). (see modify_begin()).
| dependence | dependence plug |
| undo_stack | if true, use a modification to be able to revert this action. {std::runtime_error,RuntimeError} if this plug is an internal dependency and not a dynamic one. |
| void maquina::Plug::remove_dynamic_valued_dependency | ( | uint32_t | index, |
| bool | undo_stack = true |
||
| ) |
Remove a valued dependence from this plug.
The dependence is identified by an index.
| index | index of the dependence |
| undo_stack | if true, use a modification to be able to revert this action. {std::runtime_error,RuntimeError} if this dependency is internal and not dynamic. |
| void maquina::Plug::remove_notification_dependency | ( | const Plug & | dependence, |
| bool | notify = true |
||
| ) |
| void maquina::Plug::remove_valued_dependency | ( | const Plug & | dependence, |
| bool | undo_stack = true |
||
| ) |
| void maquina::Plug::remove_valued_dependency | ( | uint32_t | index, |
| bool | undo_stack = true |
||
| ) |
| Value maquina::Plug::rest_value | ( | ) | const |
Return the rest plug value.
The rest value is the value of the plug without animation (all animation layers disabled). This is not the DEFAULT value (the initial plug's value).
| void maquina::Plug::set_channel | ( | bool | channel | ) |
Set the channel status of this plug.
| void maquina::Plug::set_default_value | ( | const Value & | value | ) |
Set the default value of this plug.
| void maquina::Plug::set_description | ( | const std::string & | description, |
| bool | undo_stack = false |
||
| ) |
Set the description of this plug.
| void maquina::Plug::set_flags | ( | uint32_t | flags | ) |
Set the plug flags.
| void maquina::Plug::set_to_default | ( | ) |
Reset the plug default value flag.
| void maquina::Plug::set_value | ( | const Value & | value, |
| bool | undo_stack = false |
||
| ) |
Set a value.
| void maquina::Plug::set_value | ( | const Value & | value, |
| const PartialInvalidationPtr | pi, | ||
| bool | undo_stack = false |
||
| ) |
Set a value along with PartialInvalidation data.
| void maquina::Plug::set_value | ( | const Value & | value, |
| const ModificationContext & | mc | ||
| ) |
Set a value.
| void maquina::Plug::set_value | ( | const Value & | value, |
| const ModificationContext & | mc, | ||
| int32_t | start, | ||
| int32_t | end | ||
| ) |
Set a value with a custom invalidation range.
The plug is set to the new value, but its back dependent plugs will be invalidated but only on the frame range specified by the user.
| Plug::Status maquina::Plug::status | ( | ) | const |
Return the plug status.
Check if the plug is overriden, animated or untouched
| void maquina::Plug::touch | ( | ) |
| void maquina::Plug::touch | ( | int | first_frame, |
| int | last_frame, | ||
| bool | rest | ||
| ) |
Invalidate a plug sub domain
| first_frame | The first frame to invalidate. |
| last_frame | The last frame to invalidate. |
| rest | If true, invalidate the rest value of this plug. |
| std::string maquina::Plug::type_name | ( | TypeEvaluationMode | mode = TypeEvaluationMode::Default | ) | const |
Returns the name of the type the plug.
|
static |
Return true if the name is a valid plug name.
| Value maquina::Plug::value | ( | const QueryContext & | qc = QueryContext::at_current_frame, |
| EvaluationMode | mode = EvaluationMode::Interactive |
||
| ) | const |
Get the plug value.
| qc | Specifies the context of the value query (the frame or the default value) |
| mode | Specifies the method to use to evaluate the value |
| Plug maquina::Plug::valued_dependence | ( | int | dep_index | ) | const |
The n-th valued dependence. {std::runtime_error,RuntimeError} if n is bigger than the number of dependencies.
| std::vector<Plug> maquina::Plug::valued_dependencies | ( | ) |
Return all valued dependencies of this plug, ordered by their indices.
| uint32_t maquina::Plug::valued_dependencies_count | ( | ) | const |
The number of valued dependencies for this plug.
| std::vector<Plug> maquina::Plug::walk_down | ( | ) | const |
Returns the next plugs to visit to traverse the graph from inputs to outputs, stating at this plug.
This function will returns all the output plugs which depend on this plug and all the plugs connected to this plug.
| void* maquina::Plug::_plug |
|
static |