Rumba C++ SDK
NodePlugin.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 "Export.h"
18 #include "Node.h"
19 
20  namespace maquina
21  {
22  class Plug;
23  class Value;
24  class Modifier;
25  class NodeSet;
26 
29  {
30  public:
31  NodePlugin (Node *node) : _node(node->_impl) {}
32  virtual ~NodePlugin() {}
33 
35 
37  virtual void on_first_init(bool /*undo_stack*/) {};
38 
40 
44  virtual void on_delete(bool /*undo_stack*/) {};
45 
47 
54  virtual void on_add_to_document() {};
55 
57 
64  virtual void on_remove_from_document() {};
65 
67 
70  virtual void on_input_connection(const Plug& /*output*/, const Plug& /*input*/, bool /*serial*/) {};
72 
75  virtual void on_output_connection(const Plug& /*output*/, const Plug& /*input*/, bool /*serial*/) {};
77 
80  virtual void on_input_disconnection(const Plug& /*output*/, const Plug& /*input*/) {};
82 
85  virtual void on_output_disconnection(const Plug& /*output*/, const Plug& /*input*/) {};
86 
88 
91  virtual void relationship(NodeSet& set) const;
92 
94 
95  virtual std::shared_ptr<NodeDelegate> node_delegate() const;
96 
104 
106  virtual std::optional<Plug> channel_switch_output() const { return {}; }
107 
109  virtual std::vector<Plug> channel_switch_inputs() const { return {}; }
110 
112  virtual std::optional<Plug> channel_switch_sub_channel(const std::string_view& sub_channel) const { return {}; }
113 
116  Node node() const
118  {
119  return _node.lock();
120  }
121 
123 
126  virtual std::string selection_path() const;
127 
128  private:
129  std::weak_ptr<Impl> _node;
130  };
131  }
Definition: NodeSet.h:21
NodePlugin(Node *node)
Definition: NodePlugin.h:31
virtual void on_delete(bool)
Prepare the node to be deleted.
Definition: NodePlugin.h:44
virtual void on_input_connection(const Plug &, const Plug &, bool)
Callback called when an a connection has been done between an output plug and a plug of this node as ...
Definition: NodePlugin.h:70
Derive this class to create your own Node type.
Definition: NodePlugin.h:28
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
virtual void on_output_disconnection(const Plug &, const Plug &)
Callback called when an a connection has been broken between a plug of this node as output and an inp...
Definition: NodePlugin.h:85
virtual void on_input_disconnection(const Plug &, const Plug &)
Callback called when an a connection has been broken between an output plug and a plug of this node a...
Definition: NodePlugin.h:80
virtual void on_add_to_document()
Callback called when the node is added to the document.
Definition: NodePlugin.h:54
virtual std::optional< Plug > channel_switch_sub_channel(const std::string_view &sub_channel) const
Return the plug for the sub channel name if available.
Definition: NodePlugin.h:112
#define MAQUINA_EXPORT
Definition: Export.h:31
A node plug.
Definition: Plug.h:59
virtual std::optional< Plug > channel_switch_output() const
If that not is a channel switch node, return the output channel plug.
Definition: NodePlugin.h:106
virtual ~NodePlugin()
Definition: NodePlugin.h:32
virtual std::vector< Plug > channel_switch_inputs() const
Return the input channel plugs.
Definition: NodePlugin.h:109
virtual void on_remove_from_document()
Callback called when the node is removed from the document.
Definition: NodePlugin.h:64
virtual void on_output_connection(const Plug &, const Plug &, bool)
Callback called when an a connection has been done between a plug of this node as output and an input...
Definition: NodePlugin.h:75
virtual void on_first_init(bool)
Perform the one shot initialization tasks for this node.
Definition: NodePlugin.h:37
Base class of all Rumba nodes.
Definition: Node.h:37