Rumba C++ SDK
Workspace.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 
17 #include "Node.h"
18 #include "Document.h"
19 #include "Progress.h"
20 #include "ChannelMode.h"
21 #include <unordered_map>
22 #include <unordered_set>
23 #include <gsl/gsl>
24 #include <optional>
25 
28  namespace maquina
29  {
30  class Array;
31  class Dict;
32  class AnimCurve;
33  class CustomAction;
34  struct GeometryComponentSelection;
35  struct LastSelectedComponent;
36 
38  {
39  public:
40  virtual Node new_document();
41 
42  virtual Node load_document(
43  const std::string_view& path,
44  const ProgressCallback& progress={}
45  );
46 
56  virtual void set_current_frame(float frame);
57 
58  static void set_class_name(std::string class_name);
59 
61  Workspace(Node* node) : NodePlugin(node) {}
62  };
63 
66 
69 
71 
73 
76 
78  MAQUINA_EXPORT void set_document_factory(const std::function<maquina::Node()>& factory);
79 
82 
85 
87  MAQUINA_EXPORT void undo();
88 
90  MAQUINA_EXPORT void redo();
91 
94 
97  const char* modification_name,
98  const gsl::span<const float>& interactive_frames = {}
99  );
101  MAQUINA_EXPORT void modify_curve_begin(const char* modification_name);
102 
104 
105  MAQUINA_EXPORT bool modify_end();
106 
108 
110 
112  MAQUINA_EXPORT void add_modify_action(const std::shared_ptr<maquina::CustomAction>& custom_action);
113 
115 
116  MAQUINA_EXPORT bool delete_animation_graph(Node& node_to_delete, bool undo_stack=true);
117 
120 
122  MAQUINA_EXPORT void set_current_frame(float frame);
123 
126 
129 
131 
134  Node& layer
135  );
136 
138 
141  Plug& plug,
142  const Value& value,
143  float frame,
144  bool create_curve,
145  bool layer_value=false,
146  int tangent_mode=-1
147  );
148 
150 
152  const Plug& plug
153  );
154 
156 
158  const Plug& plug,
159  Node& layer
160  );
161 
163 
164  MAQUINA_EXPORT std::vector<Node> in_animated_layers(
165  const Plug& plug,
166  bool skip_disabled=true
167  );
168 
171  const Plug& plug
172  );
173 
175 
177  const Plug& plug
178  );
179 
181 
183  const Plug& plug
184  );
185 
187 
189  const Plug& plug,
190  Node& layer
191  );
192 
194 
199  const Plug& plug,
200  const Node& layer,
201  float frame
202  );
203 
205 
207  Plug& animated_plug
208  );
209 
211 
213  Plug& animated_plug
214  );
215 
218  Plug& plug
219  );
220 
223  std::vector<Plug> channels,
224  bool all_layers=false
225  );
226 
228 
231  Plug& plug,
232  const std::string_view& srt_class_name = "SRTToTransformNode"
233  );
234 
236 
238  Node& constraint,
239  Node& node
240  );
241 
243  /* A key will be added on all controllers already keyed in the layer */
245  Node& layer,
246  float frame,
247  bool default_value=false
248  );
249 
251 
252  MAQUINA_EXPORT std::vector<Node> selection();
253 
255 
256  MAQUINA_EXPORT std::vector<std::shared_ptr<NodeDelegate>> delegate_selection();
257 
259  MAQUINA_EXPORT const std::vector<GeometryComponentSelection>& sub_component_selection();
260 
262  MAQUINA_EXPORT LastSelectedComponent last_selected_components();
263 
265  MAQUINA_EXPORT std::vector<std::string> selection_paths();
266 
268  MAQUINA_EXPORT std::vector<std::shared_ptr<NodeDelegate>> tool_selection();
269 
271  enum class SelectionMode
272  {
273  Replace,
274  Add,
275  Remove,
276  Invert
277  };
278 
280  MAQUINA_EXPORT void select(
281  const std::vector<Node>& nodes,
283  );
284 
287  std::vector<std::string> paths,
289  );
290 
292 
297  std::vector<GeometryComponentSelection>&& selection,
299  bool keep_sub_components = true
300  );
301 
303  /* The return value is a list a channel full name */
304  MAQUINA_EXPORT std::unordered_set<std::string> selected_keys_channels(Node& anim_layer);
305 
307 
310  MAQUINA_EXPORT std::vector<Channel> channel_selection(ChannelMode channel_mode_filter);
311 
313  /* The return value is a LayerKeys user data
314  */
316  Node& anim_layer
317  );
318 
320  enum class PasteMode
321  {
322  Clear,
323  Merge,
324  Replace,
325  Insert
326  };
327 
329  /* This function is looking for the best match in the active selection that leads to the closest channel.
330  * A Channel is defined as DOCUMENT/ASSET.CTRL_SIDE_CHANNEL, comparison of two channels will give a matching score.
331  * With a score given to each channels of the active selection compare to a channel to paste, the highest score will be the targeted one
332  * The overall highest score is the only one that is returned
333  * Return value is a list of matching channels
334  */
335  MAQUINA_EXPORT std::vector< std::pair<std::string, std::string> > match_channels(
336  const Value& to_match
337  );
338 
340  enum class MatchMirrorMode
341  {
342  automatic,
343  mirror,
344  no_mirror
345  };
346 
348  /* This function is looking for the best match in the selected channels that leads to the closest channel.
349  * A Channel is defined as DOCUMENT/ASSET.CTRL_SIDE_CHANNEL, comparison of two channels will give a matching score.
350  * With a score given to each channels in the selected channels compare to a channel to paste, the highest score will be the targeted one
351  * The overall highest score is the only one that is returned
352  * Return value is a list of matching channels and a mirrored bool which is true if the channels have been matched to the mirrored controllers.
353  */
354  MAQUINA_EXPORT std::pair<std::vector< std::pair<std::string, std::string> >, bool> match_to_channels(
355  const std::unordered_set<std::string>& channels_to_match,
356  const std::unordered_set<std::string>& selected_channels,
357  MatchMirrorMode mirror_mode
358  );
359 
360  enum class PasteType
361  {
362  Null,
363  Soft,
364  Hard
365  };
366 
369  const Value& to_paste,
370  const std::vector< std::pair<std::string, std::string> >& matched_channels,
371  Node& dest_layer
372  );
373 
375 
380  const Value& to_paste,
381  const std::vector< std::pair<std::string, std::string> >& matched_channels, // Matching channels
382  Node& dest_layer,
383  float frame_in,
384  float frame_out,
385  float to_frame,
386  PasteMode mode = PasteMode::Merge,
387  PasteType type = PasteType::Hard
388  );
389 
391 
396  Node& anim_curve_node,
397  const AnimCurve& curve,
398  float frame_in,
399  float frame_out,
400  float to_frame,
402  );
403 
406  Node& anim_layer,
407  bool normalize=true
408  );
409 
412  Plug& plug,
413  const float frame
414  );
415 
417  MAQUINA_EXPORT void transform_keys(Node& anim_layer);
418  MAQUINA_EXPORT void transform_curve_keys(const Plug& plug, std::unordered_map<float, float>& original_to_transformed_keys);
419 
420  MAQUINA_EXPORT int insert_key(const Plug& plug, float t, float v);
421 
423  MAQUINA_EXPORT void time_warp_keys(Node& anim_layer);
424 
427  Node& layer,
428  int dest_id
429  );
430 
433  Node& parent,
434  const std::vector<Node>& layers
435  );
436 
439  Node& layer_group
440  );
441 
443  Node& layer
444  );
445 
446  // Extends the layers vector with the layer group children of type layer_type
448  Node& layer_group, //< The layer group
449  std::vector<Node>& layers, //< The layers vector to be completed
450  const char* layer_type, //< The type of layer we are looking for
451  bool recursive = false //< Go recursively in layer group children
452  );
453 
455  enum class FlattenMode
456  {
457  In_Dest_Key,
458  Union_Keys,
459  All_Frames
460  };
461 
463  /* The return value is the layer that contain the flatten result */
465  Node& layer_group,
467  int all_frames_interval = 1,
468  int all_frames_offset = 0,
469  int all_frames_tangents_mode = 1
470  );
471 
474  Node& layer,
475  Node& dest_layer,
477  int all_frames_interval=1,
478  int all_frames_offset=0,
479  int all_frames_tangents_mode=1
480  );
481 
484  Node& layer,
485  int interval = 1,
486  int offset = 0,
487  int tangents_mode = 1
488  );
489 
492  Node& curve,
493  const Plug& value_plug,
494  int interval = 1,
495  int offset = 0,
496  int tangents_mode = 1
497  );
498 
500 
505  Node& root,
506  const std::wstring& filepath,
507  const std::string& reference_root_name = "",
508  const ProgressCallback& progress={}
509  );
510 
512 
515  const std::wstring& filepath
516  );
517 
519 
524  Node& root,
525  const std::wstring& filepath,
526  const std::string& root_name = "",
527  const ProgressCallback& progress={}
528  );
529 
531 
533  const std::vector<std::string>& channels,
534  float frame
535  );
536 
538 
540  const Dict& from_pose,
541  const Dict& to_pose,
542  float weight
543  );
544 
546 
548  const Dict& pose,
549  const std::vector<std::string>& channels,
550  MatchMirrorMode mirror_mode
551  );
552 
554  MAQUINA_EXPORT bool has_controller(const Plug& plug);
555 
557  /*
558  * \raise{std::runtime_error,RuntimeError} if the node has no controller.
559  */
560  MAQUINA_EXPORT Node controller(const Plug& plug);
561 
563  MAQUINA_EXPORT void 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);
564 
566  /*
567  * \exception std::runtime_error if the node is not an animation node.
568  */
570 
572  MAQUINA_EXPORT bool is_right(Node& asset, const std::string& name);
573 
575  MAQUINA_EXPORT bool is_left(Node& asset, const std::string& name);
576 
578  MAQUINA_EXPORT std::string asset_mirror(Node& asset, const std::string& name);
579 
581  MAQUINA_EXPORT std::string asset_mirror_path(Node& asset, const std::string& path);
582 
584  /*
585  * \raise{std::runtime_error,RuntimeError} if unable to find node's mirror or asset is not an Asset
586  */
587  MAQUINA_EXPORT Node asset_mirror_node(Node& asset, const Node& node);
588 
590  MAQUINA_EXPORT bool asset_has_manipulator(Node& asset, const std::string& manipulator_name);
591 
593  /*
594  * \raise{std::runtime_error,RuntimeError} if unable to find or node is not an asset
595  */
596  MAQUINA_EXPORT Node asset_manipulator(Node& asset, const std::string& manipulator_name);
597 
599  /*
600  * \raise{std::runtime_error,RuntimeError} if node is not an asset
601  */
602  MAQUINA_EXPORT std::optional<Node> asset_controller(Node& asset, const std::string_view& controller_name);
603 
605  MAQUINA_EXPORT bool asset_has_child(Node& asset, const std::string& name);
607  /*
608  * \raise{std::runtime_error,RuntimeError} if unable to find or node is not an asset
609  */
610  MAQUINA_EXPORT Node asset_child(Node& asset, const std::string& name);
611 
613  MAQUINA_EXPORT bool asset_child_has_manipulator(Node& asset, const Node& child);
614 
616  /*
617  * \raise{std::runtime_error,RuntimeError} if unable to find or node is not an asset
618  */
619  MAQUINA_EXPORT Node asset_child_manipulator(Node& asset, const Node& child);
620 
622  MAQUINA_EXPORT Node manipulator_controller(Node& manipulator);
623 
625  MAQUINA_EXPORT std::vector<Node> asset_controllers(Node& asset);
626 
629 
632 
634 
635  MAQUINA_EXPORT std::vector<std::pair<std::string, Imath::V2f>> end_profiling();
636 
638 
640  const std::string_view& path,
641  const ProgressCallback& progress={}
642  );
643 
645 
646  MAQUINA_EXPORT std::optional<Node> add_document(
647  const std::string& path,
648  const ProgressCallback& progress={}
649  );
650 
653 
655  MAQUINA_EXPORT std::optional<Node> document(
656  const std::string& path,
657  bool comparable=false);
658 
661 
663 
665 
668 
670  MAQUINA_EXPORT Node create_tool_geometry(const char* name, Node& parent);
671 
674 
677 
678  // Return an Asset's Display node
679  /*
680  * \raise{std::runtime_error,RuntimeError} if no display node is available for this asset
681  */
682  MAQUINA_EXPORT Node asset_display(const Node& asset);
683 
685  MAQUINA_EXPORT void increment_dirty_token();
686 
707  MAQUINA_EXPORT Value weighted_sum(const gsl::span<const Value>& values, const gsl::span<const double>& weights, int quat_iter = 15, double quat_eps = 1e-12);
708 
711 
713  MAQUINA_EXPORT void frame_camera(maquina::NodeDelegate& camera, const std::vector<std::shared_ptr<maquina::NodeDelegate>>& selection);
714 
716  MAQUINA_EXPORT std::vector<std::shared_ptr<maquina::NodeDelegate>> cameras();
717 
719  MAQUINA_EXPORT std::string beautify(const std::string& s);
720 
721  // TODO optional
723  /*
724  * \raise{std::runtime_error,RuntimeError} if type_name has not been registered as a Value type.
725  */
726  MAQUINA_EXPORT Value default_value(const maquina::StringView& type_name);
727 
728  /* Delete this node if it is an orphan AnimLayerBlend node.
729  Returns true if the node is deleted.
730  Armless if the node is not an AnimLayerBlend node. */
732  MAQUINA_EXPORT bool delete_orphan_alb(Node& node, bool undo_stack);
733 
735 
736  MAQUINA_EXPORT std::optional<Node> node_asset(const Node& node);
737 
739 
741  MAQUINA_EXPORT void pick(const std::function<void(const std::optional<std::string_view>& path)>& picking_callback);
742 
744  MAQUINA_EXPORT bool is_picking();
745 
748 
750  MAQUINA_EXPORT void notify_picking(const std::string_view& node_delegate_path);
751 
752 
754  MAQUINA_EXPORT Array trigger_event(const std::string_view& event_type, const Value& value=Value::default_value);
755 
757 
766  [[nodiscard]]
767  MAQUINA_EXPORT int register_event_callback(const std::string_view& event_type, std::function<Value(const Value&)> callback);
768 
770  MAQUINA_EXPORT void unregister_event_callback(int callback_id);
771 
773  MAQUINA_EXPORT Imath::M44d reflection_matrix(const Node& node, const Node& mirrored_node);
775  MAQUINA_EXPORT Imath::M44d rest_transform(const Node& node);
776 
778  MAQUINA_EXPORT void enable_plug_listener(bool enable);
779 
781  MAQUINA_EXPORT void create_type_alias(const std::string& previous_type_name, std::string new_type_name);
782 
783  MAQUINA_EXPORT maquina::Plug widget_setting_plug(const std::string& setting_name, const std::string& widget_name, const maquina::Value& default_value);
784  }
MAQUINA_EXPORT void flush_observers()
Make sure all the observers have been called.
PasteType
Definition: Workspace.h:360
MAQUINA_EXPORT void set_current_frame(float frame)
set the current frame
MAQUINA_EXPORT Node manipulator_controller(Node &manipulator)
Get the controller related to this manipulator.
MAQUINA_EXPORT Node asset_child_manipulator(Node &asset, const Node &child)
Get the manipulator associated to the asset child.
MAQUINA_EXPORT void background_wait()
Wait for the baground evaluation engine.
MAQUINA_EXPORT void create_type_alias(const std::string &previous_type_name, std::string new_type_name)
Create a type alias. When reading an object of type &#39;previous_type_name&#39;, creates an object of type &#39;...
MAQUINA_EXPORT bool is_left(Node &asset, const std::string &name)
Return true if the name is left using the asset mirroring rules.
MAQUINA_EXPORT Dict blend_poses(const Dict &from_pose, const Dict &to_pose, float weight)
Blend from pose to pose using weight factor.
MAQUINA_EXPORT void set_document_factory(const std::function< maquina::Node()> &factory)
Set a factory to create document plugin.
MAQUINA_EXPORT bool is_picking()
Return true if the picking is started.
MAQUINA_EXPORT Node 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.
MAQUINA_EXPORT bool has_animated_plug_in_layer(const Plug &plug, Node &layer)
Check if the plug has an animated plug in the layer.
MAQUINA_EXPORT bool can_be_flatten(Node &layer)
MAQUINA_EXPORT Value 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.
MAQUINA_EXPORT void background_start()
Start the background evaluation engine.
MAQUINA_EXPORT void notify_picking(const std::string_view &node_delegate_path)
Call the picking callback.
MAQUINA_EXPORT void move_layer(Node &layer, int dest_id)
Re-order layers.
MAQUINA_EXPORT Node active_document()
Return the active Document node.
MAQUINA_EXPORT void modify_begin(const char *modification_name, const gsl::span< const float > &interactive_frames={})
Begin a modification of the current document.
MAQUINA_EXPORT bool is_demo_mode()
Test if Rumba/Guerilla is in demo mode.
Add to the active selection.
MAQUINA_EXPORT Plug animated_plug_in_layer(const Plug &plug, Node &layer)
Return the animated plug in the specific layer.
MAQUINA_EXPORT Node workspace()
Return the workspace node.
MAQUINA_EXPORT Dict matching_pose(const Dict &pose, const std::vector< std::string > &channels, MatchMirrorMode mirror_mode)
Match a pose to a set of channels.
MAQUINA_EXPORT bool rig_matrix(Plug &plug, const std::string_view &srt_class_name="SRTToTransformNode")
Rig a matrix plug.
MAQUINA_EXPORT Value default_rig_value(Plug &plug)
Return the default value if available.
MAQUINA_EXPORT Plug background_progress()
Use this plug to be notified on background engine progress.
MAQUINA_EXPORT std::vector< Node > asset_controllers(Node &asset)
Get the asset controllers.
FlattenMode
Specify a way to flatten a layer into another.
Definition: Workspace.h:455
MAQUINA_EXPORT bool asset_has_child(Node &asset, const std::string &name)
Return true if the asset contain a child named name.
Definition: ImathFrame.h:43
Keep both destination and origin layers key to perform the merge.
MAQUINA_EXPORT std::string asset_mirror_path(Node &asset, const std::string &path)
Return the mirrored path using the asset mirroring rules.
MAQUINA_EXPORT bool is_rig_mode_on()
Returns true if the rig mode is active, false otherwise.
MAQUINA_EXPORT bool is_right(Node &asset, const std::string &name)
Return true if the name is right using the asset mirroring rules.
MAQUINA_EXPORT void add_modify_action(const std::shared_ptr< maquina::CustomAction > &custom_action)
Add a custom action to the current modifier.
MAQUINA_EXPORT maquina::Plug widget_setting_plug(const std::string &setting_name, const std::string &widget_name, const maquina::Value &default_value)
MatchMirrorMode
Mirror mode used in match_to_channels.
Definition: Workspace.h:340
Do not try to match the selection controller&#39;s mirrored channels.
MAQUINA_EXPORT bool has_animated_channel(Plug &animated_plug)
Check if the animated plug has an animated channel.
MAQUINA_EXPORT std::optional< Node > asset_controller(Node &asset, const std::string_view &controller_name)
Get an asset controller if it exists, else return null.
MAQUINA_EXPORT void bake_layer(Node &layer, int interval=1, int offset=0, int tangents_mode=1)
Bake the layer.
MAQUINA_EXPORT void 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.
MAQUINA_EXPORT void remove_keys(Node &anim_layer, bool normalize=true)
Remove the active key selection in a layer.
Insert the clipboard at the destination frame.
MAQUINA_EXPORT Array 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. ...
Derive this class to create your own Node type.
Definition: NodePlugin.h:28
PasteMode
Specify a way to paste the clipboard.
Definition: Workspace.h:320
MAQUINA_EXPORT Node create_tool_geometry(const char *name, Node &parent)
Create a geometry node for tools, i-e, not in a document.
MAQUINA_EXPORT void time_warp_keys(Node &anim_layer)
Time warp the active key selection using the selection rubberband.
MAQUINA_EXPORT Node duplicate_layer(Node &layer)
Duplicate the layer and its animation.
MAQUINA_EXPORT bool has_target_layer(const Plug &plug)
Check if the plug has a layer that can receive the plug animation.
MAQUINA_EXPORT void redo()
Make a redo step.
MAQUINA_EXPORT std::vector< Node > in_animated_layers(const Plug &plug, bool skip_disabled=true)
Return the animation layers that are modifying this plug.
MAQUINA_EXPORT void 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 t...
MAQUINA_EXPORT void select(const std::vector< Node > &nodes, SelectionMode mode=SelectionMode::Replace)
Update the active selection with a list of nodes according to the selection mode. ...
MAQUINA_EXPORT bool asset_has_manipulator(Node &asset, const std::string &manipulator_name)
Return true if the asset contain the manipulator.
No paste match.
MAQUINA_EXPORT void ungroup_layer(Node &layer_group)
Ungroup layer.
MAQUINA_EXPORT Plug animated_channel(Plug &animated_plug)
Return the animated channel connected to a layer.
MAQUINA_EXPORT void transform_keys(Node &anim_layer)
Transform the active key selection using the selection rubberband.
MAQUINA_EXPORT Node asset_mirror_node(Node &asset, const Node &node)
Return the mirrored node using the asset mirroring rules.
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
MAQUINA_EXPORT void frame_camera(maquina::NodeDelegate &camera, const std::vector< std::shared_ptr< maquina::NodeDelegate >> &selection)
Move a camera to contain a node selection.
MAQUINA_EXPORT bool has_controller(const Plug &plug)
Test if a controller is associated to a plug.
MAQUINA_EXPORT std::unordered_set< std::string > selected_keys_channels(Node &anim_layer)
Return the channels associated with the active key selection in a layer.
MAQUINA_EXPORT std::vector< std::string > selection_paths()
Return the paths of the active node delegate selection.
MAQUINA_EXPORT std::vector< std::shared_ptr< maquina::NodeDelegate > > cameras()
Return the available cameras.
MAQUINA_EXPORT std::string asset_mirror(Node &asset, const std::string &name)
Return the mirrored name using the asset mirroring rules.
Only keep the destination layers key to perform the merge.
Soft paste match.
MAQUINA_EXPORT Value default_value(const maquina::StringView &type_name)
Return the default value of a type.
static const Value default_value
The default value.
Definition: Value.h:245
MAQUINA_EXPORT Node asset_display(const Node &asset)
MAQUINA_EXPORT Value animated_plug_value_in_layer(const Plug &plug, const Node &layer, float frame)
Return the animated plug value in the specific layer.
MAQUINA_EXPORT void 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...
MAQUINA_EXPORT Node controller(const Plug &plug)
Return the controller associated to a plug.
ChannelMode
The channel modes.
Definition: ChannelMode.h:23
MAQUINA_EXPORT void unregister_event_callback(int callback_id)
Unregister an event callback.
MAQUINA_EXPORT PasteType 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.
MAQUINA_EXPORT void constrain_node(Node &constraint, Node &node)
Constrain the node to the constraint.
Definition: Workspace.h:37
MAQUINA_EXPORT void start_profiling()
Start an interactive profiling session.
Hard paste match.
MAQUINA_EXPORT std::string active_document_filename()
Return the active document filename.
MAQUINA_EXPORT std::vector< std::pair< std::string, Imath::V2f > > end_profiling()
Stop the interactive profiling session.
MAQUINA_EXPORT const std::vector< GeometryComponentSelection > & sub_component_selection()
Return the selected geometry components.
MAQUINA_EXPORT std::optional< Node > 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.
MAQUINA_EXPORT Node 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.
#define MAQUINA_EXPORT
Definition: Export.h:31
MAQUINA_EXPORT std::vector< std::shared_ptr< NodeDelegate > > tool_selection()
Return the active tool delegate selection.
MAQUINA_EXPORT bool modify_abort()
Cancel and rollback current modification.
A node plug.
Definition: Plug.h:59
std::function< bool(float, const char *)> ProgressCallback
Definition: Progress.h:22
MAQUINA_EXPORT void undo_blend(float undo_blend)
Set the undo blend factor of the last modification.
Invert the active selection.
MAQUINA_EXPORT void group_child_layers(Node &layer_group, std::vector< Node > &layers, const char *layer_type, bool recursive=false)
MAQUINA_EXPORT void 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.
MAQUINA_EXPORT void enable_plug_listener(bool enable)
If enable is false, stop flushing the plug listener handlers.
SelectionMode
Specify a way to alter the active selection.
Definition: Workspace.h:271
MAQUINA_EXPORT void undo()
Make a undo step.
MAQUINA_EXPORT void 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.
Replace the active selection.
MAQUINA_EXPORT Value copy_keys(Node &anim_layer)
Return a copy of the active key selection in a layer.
MAQUINA_EXPORT bool has_loader(const std::wstring &filepath)
Is there a loader for this file type ?
MAQUINA_EXPORT float current_frame()
Shortcut for the active document current frame.
Force to match the selection controller&#39;s mirrored channels.
Remove from the active selection.
MAQUINA_EXPORT bool asset_child_has_manipulator(Node &asset, const Node &child)
Return true if the asset child has a manipulator.
MAQUINA_EXPORT Plug animated_plug(const Plug &plug)
Return the animated plug, regarding the current layer.
MAQUINA_EXPORT Dict extract_pose(const std::vector< std::string > &channels, float frame)
Extract a pose from a selection of plugs.
MAQUINA_EXPORT void 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.
MAQUINA_EXPORT std::vector< Node > selection()
Return the active selected maquina::Node objects.
MAQUINA_EXPORT Node target_layer(const Plug &plug)
Return the layer receiving the plug animation.
MAQUINA_EXPORT Node add_new_document()
Add a new, empty document in the current project and return it. Do not close any opened document...
MAQUINA_EXPORT std::vector< std::pair< std::string, std::string > > match_channels(const Value &to_match)
Return the best match between the channels to be pasted and the active selection. ...
MAQUINA_EXPORT Node 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.
MAQUINA_EXPORT std::string beautify(const std::string &s)
Format the label to a nice string.
MAQUINA_EXPORT Node asset_child(Node &asset, const std::string &name)
Get the first child node named name of this asset.
MAQUINA_EXPORT bool is_modifying()
Return true if modify_begin has been called but not modify_end yet.
MAQUINA_EXPORT void reparent_layers(Node &parent, const std::vector< Node > &layers)
Move layers.
MAQUINA_EXPORT void load_document(const std::string_view &path, const ProgressCallback &progress={})
Open a new Rumba/Guerilla project.
MAQUINA_EXPORT void modify_curve_begin(const char *modification_name)
Begin a modification of the current document.
MAQUINA_EXPORT std::optional< Node > node_asset(const Node &node)
Return the asset node associated with another node.
MAQUINA_EXPORT std::vector< Channel > channel_selection(ChannelMode channel_mode_filter)
Return the selected channels. Selected channels are the selected nodes channels, filtered by the Chan...
If no match found, try to match the selection controller&#39;s mirrored channels.
MAQUINA_EXPORT Node asset_manipulator(Node &asset, const std::string &manipulator_name)
Get the manipulator with the name manipulator name from this asset.
MAQUINA_EXPORT std::vector< std::shared_ptr< NodeDelegate > > delegate_selection()
Return the active node delegate selection.
This interface gives a high level access to the document structure.
Definition: NodeDelegate.h:72
MAQUINA_EXPORT LastSelectedComponent last_selected_components()
Return the last selected components.
Create a key at all frame to bake the whole animation of two layers into a single layer...
MAQUINA_EXPORT bool has_active_document()
Return true if there is an active Document node.
MAQUINA_EXPORT void stop_picking()
End the picking process, unregister the callback and call it with an empty value to signal the abort...
MAQUINA_EXPORT bool modify_end()
End a modification of the current document.
MAQUINA_EXPORT void transform_curve_keys(const Plug &plug, std::unordered_map< float, float > &original_to_transformed_keys)
MAQUINA_EXPORT bool delete_animation_graph(Node &node_to_delete, bool undo_stack=true)
Delete properly the node animation graph.
MAQUINA_EXPORT void 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...
MAQUINA_EXPORT Plug animation_node_channel_plug(Node &node)
Get the channel plug (input of the rig) from an animation node (like an AnimCurveFloat node) ...
MAQUINA_EXPORT void bake_curve(Node &curve, const Plug &value_plug, int interval=1, int offset=0, int tangents_mode=1)
Bake curve.
MAQUINA_EXPORT void 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.
Clear destination before paste.
MAQUINA_EXPORT void 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.
MAQUINA_EXPORT void set_active_document(Node &document)
Set the active Document node.
MAQUINA_EXPORT bool has_animated_plug(const Plug &plug)
Check if the plug has an animated plug.
Merge the clipboard with the destination.
MAQUINA_EXPORT std::optional< Node > document(const std::string &path, bool comparable=false)
Return the document node associated to that file path.
MAQUINA_EXPORT bool can_undo_blend()
Check if it&#39;s possible to undo blend.
MAQUINA_EXPORT int insert_key(const Plug &plug, float t, float v)
MAQUINA_EXPORT void key_layer(Node &layer, float frame, bool default_value=false)
Add a key frame on a layer.
MAQUINA_EXPORT int register_event_callback(const std::string_view &event_type, std::function< Value(const Value &)> callback)
Register an event callback, returns its ID for unregistering.
MAQUINA_EXPORT void clear_profiling()
Clear the profiling session data.
MAQUINA_EXPORT void remove_key(Plug &plug, const float frame)
Remove the key at frame in the active layer.
MAQUINA_EXPORT void new_document()
Close the current documents and create a new document.
Base class of all Rumba nodes.
Definition: Node.h:37
Base class of all Rumba values.
Definition: Value.h:34
MAQUINA_EXPORT std::pair< std::vector< std::pair< std::string, std::string > >, bool > 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. ...