Rumba C++ SDK
Workspace.h File Reference
#include "Node.h"
#include "Document.h"
#include "Progress.h"
#include "ChannelMode.h"
#include <unordered_map>
#include <unordered_set>
#include <gsl/gsl>
#include <optional>

Go to the source code of this file.

Classes

class  maquina::Workspace
 

Namespaces

 maquina
 This version of the SDK is unstable, i-e, it may change with no warning.
 

Enumerations

enum  maquina::SelectionMode { maquina::SelectionMode::Replace, maquina::SelectionMode::Add, maquina::SelectionMode::Remove, maquina::SelectionMode::Invert }
 Specify a way to alter the active selection. More...
 
enum  maquina::PasteMode { maquina::PasteMode::Clear, maquina::PasteMode::Merge, maquina::PasteMode::Replace, maquina::PasteMode::Insert }
 Specify a way to paste the clipboard. More...
 
enum  maquina::MatchMirrorMode { maquina::MatchMirrorMode::automatic, maquina::MatchMirrorMode::mirror, maquina::MatchMirrorMode::no_mirror }
 Mirror mode used in match_to_channels. More...
 
enum  maquina::PasteType { maquina::PasteType::Null, maquina::PasteType::Soft, maquina::PasteType::Hard }
 
enum  maquina::FlattenMode { maquina::FlattenMode::In_Dest_Key, maquina::FlattenMode::Union_Keys, maquina::FlattenMode::All_Frames }
 Specify a way to flatten a layer into another. More...
 

Functions

MAQUINA_EXPORT Node maquina::workspace ()
 Return the workspace node. More...
 
MAQUINA_EXPORT Node maquina::active_document ()
 Return the active Document node. More...
 
MAQUINA_EXPORT void maquina::set_active_document (Node &document)
 Set the active Document node. More...
 
MAQUINA_EXPORT bool maquina::has_active_document ()
 Return true if there is an active Document node. More...
 
MAQUINA_EXPORT void maquina::set_document_factory (const std::function< maquina::Node()> &factory)
 Set a factory to create document plugin. More...
 
MAQUINA_EXPORT Plug maquina::background_progress ()
 Use this plug to be notified on background engine progress. More...
 
MAQUINA_EXPORT std::string maquina::active_document_filename ()
 Return the active document filename. More...
 
MAQUINA_EXPORT void maquina::undo ()
 Make a undo step. More...
 
MAQUINA_EXPORT void maquina::redo ()
 Make a redo step. More...
 
MAQUINA_EXPORT bool maquina::is_modifying ()
 Return true if modify_begin has been called but not modify_end yet. More...
 
MAQUINA_EXPORT void maquina::modify_begin (const char *modification_name, const gsl::span< const float > &interactive_frames={})
 Begin a modification of the current document. More...
 
MAQUINA_EXPORT void maquina::modify_curve_begin (const char *modification_name)
 Begin a modification of the current document. More...
 
MAQUINA_EXPORT bool maquina::modify_end ()
 End a modification of the current document. More...
 
MAQUINA_EXPORT bool maquina::modify_abort ()
 Cancel and rollback current modification. More...
 
MAQUINA_EXPORT void maquina::add_modify_action (const std::shared_ptr< maquina::CustomAction > &custom_action)
 Add a custom action to the current modifier. More...
 
MAQUINA_EXPORT bool maquina::delete_animation_graph (Node &node_to_delete, bool undo_stack=true)
 Delete properly the node animation graph. More...
 
MAQUINA_EXPORT float maquina::current_frame ()
 Shortcut for the active document current frame. More...
 
MAQUINA_EXPORT void maquina::set_current_frame (float frame)
 set the current frame More...
 
MAQUINA_EXPORT bool maquina::can_undo_blend ()
 Check if it's possible to undo blend. More...
 
MAQUINA_EXPORT void maquina::undo_blend (float undo_blend)
 Set the undo blend factor of the last modification. More...
 
MAQUINA_EXPORT Node maquina::duplicate_layer (Node &layer)
 Duplicate the layer and its animation. More...
 
MAQUINA_EXPORT void maquina::set_animated_plug_value (Plug &plug, const Value &value, float frame, bool create_curve, bool layer_value=false, int tangent_mode=-1)
 Set a value to plug, regarding the target layer and the current plug animation. More...
 
MAQUINA_EXPORT bool maquina::has_animated_plug (const Plug &plug)
 Check if the plug has an animated plug. More...
 
MAQUINA_EXPORT bool maquina::has_animated_plug_in_layer (const Plug &plug, Node &layer)
 Check if the plug has an animated plug in the layer. More...
 
MAQUINA_EXPORT std::vector< Node > maquina::in_animated_layers (const Plug &plug, bool skip_disabled=true)
 Return the animation layers that are modifying this plug. More...
 
MAQUINA_EXPORT bool maquina::has_target_layer (const Plug &plug)
 Check if the plug has a layer that can receive the plug animation. More...
 
MAQUINA_EXPORT Node maquina::target_layer (const Plug &plug)
 Return the layer receiving the plug animation. More...
 
MAQUINA_EXPORT Plug maquina::animated_plug (const Plug &plug)
 Return the animated plug, regarding the current layer. More...
 
MAQUINA_EXPORT Plug maquina::animated_plug_in_layer (const Plug &plug, Node &layer)
 Return the animated plug in the specific layer. More...
 
MAQUINA_EXPORT Value maquina::animated_plug_value_in_layer (const Plug &plug, const Node &layer, float frame)
 Return the animated plug value in the specific layer. More...
 
MAQUINA_EXPORT bool maquina::has_animated_channel (Plug &animated_plug)
 Check if the animated plug has an animated channel. More...
 
MAQUINA_EXPORT Plug maquina::animated_channel (Plug &animated_plug)
 Return the animated channel connected to a layer. More...
 
MAQUINA_EXPORT Value maquina::default_rig_value (Plug &plug)
 Return the default value if available. More...
 
MAQUINA_EXPORT void maquina::delete_channels_animation (std::vector< Plug > channels, bool all_layers=false)
 Reset the channels value in their target layer without removing the channel from the layer. More...
 
MAQUINA_EXPORT bool maquina::rig_matrix (Plug &plug, const std::string_view &srt_class_name="SRTToTransformNode")
 Rig a matrix plug. More...
 
MAQUINA_EXPORT void maquina::constrain_node (Node &constraint, Node &node)
 Constrain the node to the constraint. More...
 
MAQUINA_EXPORT void maquina::key_layer (Node &layer, float frame, bool default_value=false)
 Add a key frame on a layer. More...
 
MAQUINA_EXPORT std::vector< Node > maquina::selection ()
 Return the active selected maquina::Node objects. More...
 
MAQUINA_EXPORT std::vector< std::shared_ptr< NodeDelegate > > maquina::delegate_selection ()
 Return the active node delegate selection. More...
 
MAQUINA_EXPORT const std::vector< GeometryComponentSelection > & maquina::sub_component_selection ()
 Return the selected geometry components. More...
 
MAQUINA_EXPORT LastSelectedComponent maquina::last_selected_components ()
 Return the last selected components. More...
 
MAQUINA_EXPORT std::vector< std::string > maquina::selection_paths ()
 Return the paths of the active node delegate selection. More...
 
MAQUINA_EXPORT std::vector< std::shared_ptr< NodeDelegate > > maquina::tool_selection ()
 Return the active tool delegate selection. More...
 
MAQUINA_EXPORT void maquina::select (const std::vector< Node > &nodes, SelectionMode mode=SelectionMode::Replace)
 Update the active selection with a list of nodes according to the selection mode. More...
 
MAQUINA_EXPORT void maquina::select_delegate (std::vector< std::string > paths, SelectionMode mode=SelectionMode::Replace)
 Update the active selection with a list of node paths according to the selection mode. More...
 
MAQUINA_EXPORT void maquina::select_sub_component (std::vector< GeometryComponentSelection > &&selection, SelectionMode mode=SelectionMode::Replace, bool keep_sub_components=true)
 Update the active sub component selection with a node paths associated to selection weights. More...
 
MAQUINA_EXPORT std::unordered_set< std::string > maquina::selected_keys_channels (Node &anim_layer)
 Return the channels associated with the active key selection in a layer. More...
 
MAQUINA_EXPORT std::vector< Channel > maquina::channel_selection (ChannelMode channel_mode_filter)
 Return the selected channels. Selected channels are the selected nodes channels, filtered by the ChannelBox selection. More...
 
MAQUINA_EXPORT Value maquina::copy_keys (Node &anim_layer)
 Return a copy of the active key selection in a layer. More...
 
MAQUINA_EXPORT std::vector< std::pair< std::string, std::string > > maquina::match_channels (const Value &to_match)
 Return the best match between the channels to be pasted and the active selection. More...
 
MAQUINA_EXPORT std::pair< std::vector< std::pair< std::string, std::string > >, bool > maquina::match_to_channels (const std::unordered_set< std::string > &channels_to_match, const std::unordered_set< std::string > &selected_channels, MatchMirrorMode mirror_mode)
 Return the best match between the channels to be pasted and the active selection. More...
 
MAQUINA_EXPORT PasteType maquina::is_paste_valid (const Value &to_paste, const std::vector< std::pair< std::string, std::string > > &matched_channels, Node &dest_layer)
 Test if the targeted channels are open to be modified by the clipboard in a layer. More...
 
MAQUINA_EXPORT void maquina::paste_keys (const Value &to_paste, const std::vector< std::pair< std::string, std::string > > &matched_channels, Node &dest_layer, float frame_in, float frame_out, float to_frame, PasteMode mode=PasteMode::Merge, PasteType type=PasteType::Hard)
 Paste values onto matching channels in a targeted layer. More...
 
MAQUINA_EXPORT void maquina::paste_keys_on_curve (Node &anim_curve_node, const AnimCurve &curve, float frame_in, float frame_out, float to_frame, PasteMode mode=PasteMode::Merge)
 Paste the curve keys into an animation curve node. More...
 
MAQUINA_EXPORT void maquina::remove_keys (Node &anim_layer, bool normalize=true)
 Remove the active key selection in a layer. More...
 
MAQUINA_EXPORT void maquina::remove_key (Plug &plug, const float frame)
 Remove the key at frame in the active layer. More...
 
MAQUINA_EXPORT void maquina::transform_keys (Node &anim_layer)
 Transform the active key selection using the selection rubberband. More...
 
MAQUINA_EXPORT void maquina::transform_curve_keys (const Plug &plug, std::unordered_map< float, float > &original_to_transformed_keys)
 
MAQUINA_EXPORT int maquina::insert_key (const Plug &plug, float t, float v)
 
MAQUINA_EXPORT void maquina::time_warp_keys (Node &anim_layer)
 Time warp the active key selection using the selection rubberband. More...
 
MAQUINA_EXPORT void maquina::move_layer (Node &layer, int dest_id)
 Re-order layers. More...
 
MAQUINA_EXPORT void maquina::reparent_layers (Node &parent, const std::vector< Node > &layers)
 Move layers. More...
 
MAQUINA_EXPORT void maquina::ungroup_layer (Node &layer_group)
 Ungroup layer. More...
 
MAQUINA_EXPORT bool maquina::can_be_flatten (Node &layer)
 
MAQUINA_EXPORT void maquina::group_child_layers (Node &layer_group, std::vector< Node > &layers, const char *layer_type, bool recursive=false)
 
MAQUINA_EXPORT Node maquina::flatten_group (Node &layer_group, FlattenMode mode=FlattenMode::Union_Keys, int all_frames_interval=1, int all_frames_offset=0, int all_frames_tangents_mode=1)
 Flatten a group layer. More...
 
MAQUINA_EXPORT void maquina::flatten_layer (Node &layer, Node &dest_layer, FlattenMode mode=FlattenMode::Union_Keys, int all_frames_interval=1, int all_frames_offset=0, int all_frames_tangents_mode=1)
 Flatten a layer into the previous one. More...
 
MAQUINA_EXPORT void maquina::bake_layer (Node &layer, int interval=1, int offset=0, int tangents_mode=1)
 Bake the layer. More...
 
MAQUINA_EXPORT void maquina::bake_curve (Node &curve, const Plug &value_plug, int interval=1, int offset=0, int tangents_mode=1)
 Bake curve. More...
 
MAQUINA_EXPORT Node maquina::reference (Node &root, const std::wstring &filepath, const std::string &reference_root_name="", const ProgressCallback &progress={})
 Reference the content of a file into the project. More...
 
MAQUINA_EXPORT bool maquina::has_loader (const std::wstring &filepath)
 Is there a loader for this file type ? More...
 
MAQUINA_EXPORT Node maquina::load_node (Node &root, const std::wstring &filepath, const std::string &root_name="", const ProgressCallback &progress={})
 Load the content of a file into the project. More...
 
MAQUINA_EXPORT Dict maquina::extract_pose (const std::vector< std::string > &channels, float frame)
 Extract a pose from a selection of plugs. More...
 
MAQUINA_EXPORT Dict maquina::blend_poses (const Dict &from_pose, const Dict &to_pose, float weight)
 Blend from pose to pose using weight factor. More...
 
MAQUINA_EXPORT Dict maquina::matching_pose (const Dict &pose, const std::vector< std::string > &channels, MatchMirrorMode mirror_mode)
 Match a pose to a set of channels. More...
 
MAQUINA_EXPORT bool maquina::has_controller (const Plug &plug)
 Test if a controller is associated to a plug. More...
 
MAQUINA_EXPORT Node maquina::controller (const Plug &plug)
 Return the controller associated to a plug. More...
 
MAQUINA_EXPORT void maquina::init_crash_handler (const std::string &message, bool send_report, const std::wstring &app_name, const std::wstring &app_version, const std::string &recovery_file_extension, const std::string &post_dump_url)
 Init the crash handler with the message to attach to the crash reports. More...
 
MAQUINA_EXPORT Plug maquina::animation_node_channel_plug (Node &node)
 Get the channel plug (input of the rig) from an animation node (like an AnimCurveFloat node) More...
 
MAQUINA_EXPORT bool maquina::is_right (Node &asset, const std::string &name)
 Return true if the name is right using the asset mirroring rules. More...
 
MAQUINA_EXPORT bool maquina::is_left (Node &asset, const std::string &name)
 Return true if the name is left using the asset mirroring rules. More...
 
MAQUINA_EXPORT std::string maquina::asset_mirror (Node &asset, const std::string &name)
 Return the mirrored name using the asset mirroring rules. More...
 
MAQUINA_EXPORT std::string maquina::asset_mirror_path (Node &asset, const std::string &path)
 Return the mirrored path using the asset mirroring rules. More...
 
MAQUINA_EXPORT Node maquina::asset_mirror_node (Node &asset, const Node &node)
 Return the mirrored node using the asset mirroring rules. More...
 
MAQUINA_EXPORT bool maquina::asset_has_manipulator (Node &asset, const std::string &manipulator_name)
 Return true if the asset contain the manipulator. More...
 
MAQUINA_EXPORT Node maquina::asset_manipulator (Node &asset, const std::string &manipulator_name)
 Get the manipulator with the name manipulator name from this asset. More...
 
MAQUINA_EXPORT std::optional< Node > maquina::asset_controller (Node &asset, const std::string_view &controller_name)
 Get an asset controller if it exists, else return null. More...
 
MAQUINA_EXPORT bool maquina::asset_has_child (Node &asset, const std::string &name)
 Return true if the asset contain a child named name. More...
 
MAQUINA_EXPORT Node maquina::asset_child (Node &asset, const std::string &name)
 Get the first child node named name of this asset. More...
 
MAQUINA_EXPORT bool maquina::asset_child_has_manipulator (Node &asset, const Node &child)
 Return true if the asset child has a manipulator. More...
 
MAQUINA_EXPORT Node maquina::asset_child_manipulator (Node &asset, const Node &child)
 Get the manipulator associated to the asset child. More...
 
MAQUINA_EXPORT Node maquina::manipulator_controller (Node &manipulator)
 Get the controller related to this manipulator. More...
 
MAQUINA_EXPORT std::vector< Node > maquina::asset_controllers (Node &asset)
 Get the asset controllers. More...
 
MAQUINA_EXPORT void maquina::start_profiling ()
 Start an interactive profiling session. More...
 
MAQUINA_EXPORT void maquina::clear_profiling ()
 Clear the profiling session data. More...
 
MAQUINA_EXPORT std::vector< std::pair< std::string, Imath::V2f > > maquina::end_profiling ()
 Stop the interactive profiling session. More...
 
MAQUINA_EXPORT void maquina::load_document (const std::string_view &path, const ProgressCallback &progress={})
 Open a new Rumba/Guerilla project. More...
 
MAQUINA_EXPORT std::optional< Node > maquina::add_document (const std::string &path, const ProgressCallback &progress={})
 Add a new document in the current project and return it. Do not close any opened document. More...
 
MAQUINA_EXPORT Node maquina::add_new_document ()
 Add a new, empty document in the current project and return it. Do not close any opened document. More...
 
MAQUINA_EXPORT std::optional< Node > maquina::document (const std::string &path, bool comparable=false)
 Return the document node associated to that file path. More...
 
MAQUINA_EXPORT void maquina::new_document ()
 Close the current documents and create a new document. More...
 
MAQUINA_EXPORT bool maquina::is_demo_mode ()
 Test if Rumba/Guerilla is in demo mode. More...
 
MAQUINA_EXPORT void maquina::flush_observers ()
 Make sure all the observers have been called. More...
 
MAQUINA_EXPORT Node maquina::create_tool_geometry (const char *name, Node &parent)
 Create a geometry node for tools, i-e, not in a document. More...
 
MAQUINA_EXPORT void maquina::background_start ()
 Start the background evaluation engine. More...
 
MAQUINA_EXPORT void maquina::background_wait ()
 Wait for the baground evaluation engine. More...
 
MAQUINA_EXPORT Node maquina::asset_display (const Node &asset)
 
MAQUINA_EXPORT Value maquina::weighted_sum (const gsl::span< const Value > &values, const gsl::span< const double > &weights, int quat_iter=15, double quat_eps=1e-12)
 Computes the weighted sum of a set of values. More...
 
MAQUINA_EXPORT bool maquina::is_rig_mode_on ()
 Returns true if the rig mode is active, false otherwise. More...
 
MAQUINA_EXPORT void maquina::frame_camera (maquina::NodeDelegate &camera, const std::vector< std::shared_ptr< maquina::NodeDelegate >> &selection)
 Move a camera to contain a node selection. More...
 
MAQUINA_EXPORT std::vector< std::shared_ptr< maquina::NodeDelegate > > maquina::cameras ()
 Return the available cameras. More...
 
MAQUINA_EXPORT std::string maquina::beautify (const std::string &s)
 Format the label to a nice string. More...
 
MAQUINA_EXPORT Value maquina::default_value (const maquina::StringView &type_name)
 Return the default value of a type. More...
 
MAQUINA_EXPORT std::optional< Node > maquina::node_asset (const Node &node)
 Return the asset node associated with another node. More...
 
MAQUINA_EXPORT void maquina::pick (const std::function< void(const std::optional< std::string_view > &path)> &picking_callback)
 Start the picking process: register a function to call the next time a node delegate is selected or the picking process aborted. More...
 
MAQUINA_EXPORT bool maquina::is_picking ()
 Return true if the picking is started. More...
 
MAQUINA_EXPORT void maquina::stop_picking ()
 End the picking process, unregister the callback and call it with an empty value to signal the abort. More...
 
MAQUINA_EXPORT void maquina::notify_picking (const std::string_view &node_delegate_path)
 Call the picking callback. More...
 
MAQUINA_EXPORT Array maquina::trigger_event (const std::string_view &event_type, const Value &value=Value::default_value)
 Trigger an event, return an Array value with the triggered event returned values. More...
 
MAQUINA_EXPORT int maquina::register_event_callback (const std::string_view &event_type, std::function< Value(const Value &)> callback)
 Register an event callback, returns its ID for unregistering. More...
 
MAQUINA_EXPORT void maquina::unregister_event_callback (int callback_id)
 Unregister an event callback. More...
 
MAQUINA_EXPORT void maquina::enable_plug_listener (bool enable)
 If enable is false, stop flushing the plug listener handlers. More...
 
MAQUINA_EXPORT void maquina::create_type_alias (const std::string &previous_type_name, std::string new_type_name)
 Create a type alias. When reading an object of type 'previous_type_name', creates an object of type 'new_class_name'. More...
 
MAQUINA_EXPORT maquina::Plug maquina::widget_setting_plug (const std::string &setting_name, const std::string &widget_name, const maquina::Value &default_value)