HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Node.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Node_h__
10 #define __HOM_Node_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_NetworkMovableItem.h"
14 #include "HOM_BinaryString.h"
15 #include "HOM_EnumModules.h"
16 #include "HOM_IterableList.h"
17 #include "HOM_PtrOrNull.h"
18 #include <PY/PY_OpaqueObject.h>
19 #include <string>
20 #include <vector>
21 
22 class HOM_StickyNote;
23 class HOM_NodeConnection;
24 class HOM_NodeGroup;
25 class HOM_NodeType;
27 class HOM_Parm;
28 class HOM_ParmTuple;
29 class HOM_IndirectInput;
31 class HOM_HDAModule;
34 class HOM_ParmTemplate;
35 class HOM_DopSimulation;
36 class HOM_DopObject;
38 class HOM_NodeInfoTree;
39 class CL_Clip;
40 
42 
43 class HOM_API HOM_Node : virtual public HOM_NetworkMovableItem
44 {
45 public:
47  : HOM_NetworkMovableItem(HOM_networkItemType::Node)
48  { HOM_CONSTRUCT_OBJECT(this) }
49  HOM_Node(const HOM_Node &node)
51  { HOM_CONSTRUCT_OBJECT(this) }
52  ~HOM_Node() override
53  { HOM_DESTRUCT_OBJECT(this) }
54 
55  virtual bool operator==(HOM_PtrOrNull<HOM_Node> node) = 0;
56  virtual bool operator!=(HOM_PtrOrNull<HOM_Node> node) = 0;
57 
58  int __hash__() override = 0;
59  std::string __repr__() override = 0;
60  virtual std::string __str__() = 0;
61 
62  virtual bool isNetwork() = 0;
63  virtual bool isEditable() = 0;
64 
65  SWIGOUT(%newobject type;)
66  SWIGOUT(%warnfilter(321) type;)
67  virtual HOM_NodeType *type() = 0;
68  virtual HOM_NodeTypeCategory *childTypeCategory() = 0;
69 
70  virtual bool isFlagReadable(HOM_EnumValue &flag) = 0;
71  virtual bool isFlagWritable(HOM_EnumValue &flag) = 0;
72  virtual bool isGenericFlagSet(HOM_EnumValue &flag) = 0;
73  virtual void setGenericFlag(HOM_EnumValue &flag, bool value) = 0;
74 
75  virtual bool isDisplayDescriptiveNameFlagSet() = 0;
76  virtual void setDisplayDescriptiveNameFlag(bool on) = 0;
77 
78  virtual std::vector<std::string> errors() = 0;
79  virtual std::vector<std::string> warnings() = 0;
80  virtual std::vector<std::string> messages() = 0;
81 
82  SWIGOUT(%newobject node;)
83  SWIGOUT(%kwargs node;)
84  virtual HOM_Node* node(const char* node_path) = 0;
85 
86  SWIGOUT(%kwargs nodes;)
87  virtual std::vector<HOM_ElemPtr<HOM_Node> > nodes(
88  const std::vector<std::string>& node_paths) = 0;
89 
90  SWIGOUT(%newobject item;)
91  SWIGOUT(%kwargs item;)
92  virtual HOM_NetworkMovableItem* item(const char* item_path) = 0;
93 
94  SWIGOUT(%kwargs items;)
95  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> > items(
96  const std::vector<std::string>& item_paths) = 0;
97 
98  SWIGOUT(%kwargs glob;)
99  virtual std::vector<HOM_ElemPtr<HOM_Node> > glob(
100  const char *pattern, bool ignore_case=false) = 0;
101 
102  SWIGOUT(%kwargs recursiveGlob;)
103  virtual std::vector<HOM_ElemPtr<HOM_Node> > recursiveGlob(
104  const char *pattern,
105  HOM_EnumValue &filter = HOM_nodeTypeFilter::NoFilter,
106  bool include_subnets = true) = 0;
107 
108  SWIGOUT(%newobject createNode;)
109  SWIGOUT(%kwargs createNode;)
110  virtual HOM_Node* createNode(
111  const char* node_type_name,
112  const char* node_name=NULL,
113  bool run_init_scripts=true,
114  bool load_contents=true,
115  bool exact_type_name=false,
116  bool force_valid_node_name=false) = 0;
117 
118  virtual int inputIndex(const char *input_name) = 0;
119  virtual int outputIndex(const char *output_name) = 0;
120 
121  virtual void setInput(
122  int input_index,
123  HOM_NetworkMovableItem *item_to_become_input,
124  int output_index = 0) = 0;
125 
126  virtual void setNamedInput(
127  const char *input_name,
128  HOM_NetworkMovableItem *item_to_become_input,
129  const char *output_name) = 0;
130 
131  virtual void setNamedInput(
132  const char *input_name,
133  HOM_NetworkMovableItem *item_to_become_input,
134  int output_index) = 0;
135 
136  virtual void setFirstInput(
137  HOM_NetworkMovableItem *item_to_become_input,
138  int output_index = 0) = 0;
139 
140  SWIGOUT(%kwargs setNextInput;)
141  virtual void setNextInput(
142  HOM_NetworkMovableItem *item_to_become_input,
143  int output_index = 0,
144  bool unordered_only = false) = 0;
145 
146  virtual void insertInput(
147  int input_index,
148  HOM_NetworkMovableItem *item_to_become_input,
149  int output_index = 0) = 0;
150 
151  virtual int numOrderedInputs() = 0;
152 
153  virtual std::vector<HOM_ElemPtr<HOM_Node> > inputs() = 0;
154 
155  SWIGOUT(%warnfilter(321) input;)
156  virtual HOM_Node *input(int input_index) = 0;
157  virtual HOM_Node *inputFollowingOutputs(int input_index) = 0;
158 
159  virtual std::vector<HOM_ElemPtr<HOM_NodeConnection> > inputConnections() = 0;
160 
161  SWIGOUT(%newobject inputConnectors;)
162  virtual HOM_IterableList<std::vector<HOM_ElemPtr<HOM_NodeConnection> > > *
163  inputConnectors() = 0;
164 
165  SWIGOUT(%kwargs inputAncestors;)
166  virtual std::vector<HOM_ElemPtr<HOM_Node> > inputAncestors(
167  bool include_ref_inputs = true,
168  bool follow_subnets = false,
169  bool only_used_inputs = false) = 0;
170 
171  virtual std::vector<std::string> inputNames() = 0;
172  virtual std::vector<std::string> inputLabels() = 0;
173 
174  virtual std::map<std::string, std::string> editableInputStrings(
175  int input_index) = 0;
176  virtual std::string editableInputString(int input_index,
177  const char *key) = 0;
178  virtual void setEditableInputString(int input_index,
179  const char *key, const char *value) = 0;
180 
181  virtual std::vector<std::string> outputNames() = 0;
182  virtual std::vector<std::string> outputLabels() = 0;
183 
184  virtual std::vector<HOM_ElemPtr<HOM_Node> > outputs() = 0;
185 
186  virtual std::vector<HOM_ElemPtr<HOM_NodeConnection> >
187  outputConnections() = 0;
188 
189  SWIGOUT(%newobject outputConnectors;)
190  virtual HOM_IterableList<std::vector<HOM_ElemPtr<HOM_NodeConnection> > > *
191  outputConnectors() = 0;
192 
193  // Access things contained in this node (node must be a network).
194  virtual std::vector<HOM_ElemPtr<HOM_Node> > children() = 0;
195  SWIGOUT(%kwargs allSubChildren;)
196  virtual std::vector<HOM_ElemPtr<HOM_Node> > allSubChildren(
197  bool top_down = true,
198  bool recurse_in_locked_nodes = true,
199  bool sync_delayed_definition = false) = 0;
200  SWIGOUT(%kwargs selectedChildren;)
201  virtual std::vector<HOM_ElemPtr<HOM_Node> > selectedChildren(
202  bool include_hidden = false,
203  bool include_hidden_support_nodes = false) = 0;
204 
205  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> > allItems() = 0;
206  SWIGOUT(%kwargs allSubItems;)
207  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> > allSubItems(
208  bool top_down = true,
209  bool recurse_in_locked_nodes = true,
210  bool sync_delayed_definition = false) = 0;
211  SWIGOUT(%kwargs selectedItems;)
212  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> > selectedItems(
213  bool include_hidden = false,
214  bool include_hidden_support_nodes = false) = 0;
215  SWIGOUT(%kwargs numItems;)
216  virtual int numItems(HOM_EnumValue *item_type = NULL,
217  bool selected_only = false,
218  bool include_hidden = false) = 0;
219 
220  // Picked child item copy/paste/delete methods.
221  SWIGOUT(%kwargs deleteItems;)
222  virtual void deleteItems(
223  const std::vector<HOM_NetworkMovableItem *>&
224  items = std::vector<HOM_NetworkMovableItem *>(),
225  bool disable_safety_checks = false) = 0;
226  virtual void copyItemsToClipboard(
227  const std::vector<HOM_NetworkMovableItem *> &items =
228  std::vector<HOM_NetworkMovableItem *>()) = 0;
229  virtual void pasteItemsFromClipboard(HOM_Vector2 *position = NULL) = 0;
230  SWIGOUT(%kwargs copyItems;)
231  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> > copyItems(
232  const std::vector<HOM_NetworkMovableItem *> &items,
233  bool channel_reference_originals=false,
234  bool relative_references=true,
235  bool connect_outputs_to_multi_inputs=false) = 0;
236 
237  SWIGOUT(%newobject creator;)
238  virtual HOM_Node *creator() = 0;
239 
240  SWIGOUT(%newobject moveToGoodPosition;)
241  SWIGOUT(%kwargs moveToGoodPosition;)
242  virtual HOM_Vector2 *moveToGoodPosition(bool relative_to_inputs = true,
243  bool move_inputs = true,
244  bool move_outputs = true,
245  bool move_unconnected = true) = 0;
246 
247  // TODO: Have an argument to specify sorting orders once bug 25998 is fixed.
248  // Have an argument equivalent to oplayout -t once bug 26018 is fixed.
249  SWIGOUT(%kwargs layoutChildren);
250  virtual void layoutChildren
251  (const std::vector<HOM_NetworkMovableItem *> &items =
252  std::vector<HOM_NetworkMovableItem *>(),
253  double horizontal_spacing=-1,
254  double vertical_spacing=-1) = 0;
255 
256  virtual bool isCurrent() = 0;
257  SWIGOUT(%kwargs setCurrent;)
258  virtual void setCurrent(bool on, bool clear_all_selected = false) = 0;
259 
260  virtual bool isHidden() = 0;
261  virtual void hide(bool on) = 0;
262 
263  virtual std::string comment() = 0;
264  virtual void setComment(const char *comment) = 0;
265  virtual void appendComment(const char *comment) = 0;
266 
267  SWIGOUT(%kwargs destroy;)
268  virtual void destroy(bool disable_safety_checks=false) = 0;
269 
270  virtual std::vector<HOM_ElemPtr<HOM_NetworkBox> > networkBoxes() = 0;
271  SWIGOUT(%newobject iterNetworkBoxes;)
272  virtual HOM_IterableList<HOM_NetworkBox> *iterNetworkBoxes() = 0;
273  SWIGOUT(%newobject createNetworkBox;)
274  virtual HOM_NetworkBox *createNetworkBox(const char *name=NULL) = 0;
275  SWIGOUT(%newobject copyNetworkBox;)
276  virtual HOM_NetworkBox *copyNetworkBox(HOM_NetworkBox &network_box_to_copy,
277  const char *new_name=NULL, bool channel_reference_original=false) = 0;
278  SWIGOUT(%newobject findNetworkBox;)
279  virtual HOM_NetworkBox *findNetworkBox(const char *name) = 0;
280  virtual std::vector<HOM_ElemPtr<HOM_NetworkBox> >
281  findNetworkBoxes(const char *pattern) = 0;
282 
283  virtual std::vector<HOM_ElemPtr<HOM_NetworkDot> > networkDots() = 0;
284  SWIGOUT(%newobject createNetworkDot;)
285  virtual HOM_NetworkDot *createNetworkDot() = 0;
286 
287  virtual bool canCreateDigitalAsset() = 0;
288 
289  // Sub-Network methods.
290  SWIGOUT(%kwargs collapseIntoSubnet;)
291  SWIGOUT(%newobject collapseIntoSubnet;)
292  virtual HOM_Node *collapseIntoSubnet(
293  const std::vector<HOM_NetworkMovableItem*> &child_items,
294  const char *subnet_name=NULL, const char *subnet_type=NULL) = 0;
295 
296  virtual std::vector<HOM_ElemPtr<HOM_NetworkMovableItem> >
297  extractAndDelete() = 0;
298 
299  virtual std::vector<HOM_ElemPtr<HOM_SubnetIndirectInput> >
300  indirectInputs() = 0;
301 
302  // get the nodes inside a subnet that feed its outputs
303  virtual std::vector<HOM_ElemPtr<HOM_Node> >
304  subnetOutputs() = 0;
305 
306  virtual bool isSubNetwork() = 0;
307 
308  // User data methods:
309  virtual void setUserData(const char *name, const std::string &value) = 0;
310  SWIGOUT(%ignore boostAnyUserData;)
311  virtual hboost::any boostAnyUserData(const char *name) = 0;
312  virtual void destroyUserData(const char *name, bool must_exist=true) = 0;
313  virtual void clearUserDataDict() = 0;
314  virtual std::map<std::string, std::string> userDataDict() = 0;
315 
316 #ifdef SWIG
317 %extend
318 {
319  InterpreterObject userData(const char *name)
320  { return HOMboostAnyToInterpreterObject(self->boostAnyUserData(name)); }
321 }
322 #endif
323 
324  // Sticky methods
325  SWIGOUT(%newobject createStickyNote;)
326  virtual HOM_StickyNote *createStickyNote(const char *name=NULL) = 0;
327  virtual std::vector<HOM_ElemPtr<HOM_StickyNote> > stickyNotes() = 0;
328  SWIGOUT(%newobject iterStickyNotes;)
329  virtual HOM_IterableList<HOM_StickyNote> *iterStickyNotes() = 0;
330  SWIGOUT(%newobject copyStickyNote;)
331  virtual HOM_StickyNote *copyStickyNote(HOM_StickyNote &sticky_note_to_copy,
332  const char *new_name=NULL) = 0;
333  SWIGOUT(%newobject findStickyNote;)
334  virtual HOM_StickyNote *findStickyNote(const char *name) = 0;
335  SWIGOUT(%newobject findStickyNotes;)
336  virtual std::vector<HOM_ElemPtr<HOM_StickyNote> > findStickyNotes(
337  const char *pattern) = 0;
338 };
339 
340 #endif
std::string ignore_case(std::string item)
Helper function to allow ignore_case to be passed to IsMember or Transform.
Definition: CLI11.h:3456
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1303
Definition: Node.h:52
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
HOM_Node()
Definition: HOM_Node.h:46
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
HOM_Node(const HOM_Node &node)
Definition: HOM_Node.h:49
bool any(const vbool4 &v)
Definition: simd.h:3468
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1302
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
~HOM_Node() override
Definition: HOM_Node.h:52
GLuint const GLchar * name
Definition: glcorearb.h:786
GLushort pattern
Definition: glad.h:2583
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
SIM_API const UT_StringHolder position
Definition: core.h:1131
type
Definition: core.h:1059
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297