HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_VopNode.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_VopNode_h__
10 #define __HOM_VopNode_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_Node.h"
16 
17 // Swig ignores #include by default so we use %include instead.
18 #ifdef SWIG
19 %include <UT/UT_Experimental.h>
20 #else
21 #include <UT/UT_Experimental.h>
22 #endif
23 
24 SWIGOUT(%rename(VopNode) HOM_VopNode;)
25 
26 class HOM_API HOM_VopNode : virtual public HOM_Node
27 {
28 public:
30  : HOM_NetworkMovableItem(HOM_networkItemType::Node)
31  { HOM_CONSTRUCT_OBJECT(this) }
32  HOM_VopNode(const HOM_VopNode &vop_node)
33  : HOM_Node(vop_node),
34  HOM_NetworkMovableItem(vop_node)
35  { HOM_CONSTRUCT_OBJECT(this) }
36  ~HOM_VopNode() override
37  { HOM_DESTRUCT_OBJECT(this) }
38 
39  // Let swig know we're overriding __repr__ for this class so it doesn't
40  // provide its own __repr__.
41  SWIGOUT(virtual std::string __repr__() = 0;)
42 
43  virtual HOM_VopNode* insertParmGenerator(
44  const char* input_name, HOM_EnumValue &parm_gen_type,
45  bool reference_input_defaults) = 0;
46  virtual std::map<std::string, HOM_ElemPtr<HOM_Node> >
47  insertParmGeneratorsForAllInputs(
48  HOM_EnumValue &parm_gen_type,
49  bool reference_input_defaults) = 0;
50 
51  virtual HOM_VopNode* parmDefinerNode() = 0;
52 
53  // Deletes a chain of nodes wired into a particular input if and only if
54  // they are wired only into the specified input on this node. Returns true
55  // if nodes were deleted, false otherwise.
56  virtual bool deleteIndependentInputNodes(int input_index) = 0;
57 
58  virtual bool dependsOnlyOn(HOM_VopNode * other_node, int max_connections,
59  bool recurse) = 0;
60 
61  virtual void setIsInputVisible(const char* input_name, bool is_visible) = 0;
62  virtual bool isInputVisible(const char* input_name) = 0;
63 
64  virtual std::vector<std::string> inputDataTypes() = 0;
65  virtual std::vector<std::string> outputDataTypes() = 0;
66  virtual std::vector<std::string> inputParmTypes() = 0;
67  virtual bool isInputCompatible(int idx, HOM_VopNode &other, int other_idx,
68  bool allow_conversions = false) = 0;
69 
70  virtual std::string code() = 0;
71 
72  virtual std::string outerCode() = 0;
73 
74  // Flags.
75  virtual bool isBypassed() = 0;
76  virtual void bypass(bool on) = 0;
77  virtual bool isDebugFlagSet() = 0;
78  virtual void setDebugFlag(bool on) = 0;
79  virtual bool isDetailLowFlagSet() = 0;
80  virtual void setDetailLowFlag(bool on) = 0;
81  virtual bool isDetailMediumFlagSet() = 0;
82  virtual void setDetailMediumFlag(bool on) = 0;
83  virtual bool isDetailHighFlagSet() = 0;
84  virtual void setDetailHighFlag(bool on) = 0;
85  virtual bool isCompressFlagSet() = 0;
86  virtual void setCompressFlag(bool on) = 0;
87  virtual bool isMaterialFlagSet() = 0;
88  virtual void setMaterialFlag(bool on) = 0;
89 
90  // Parameter groups for the network editor UI.
91  virtual void setInputGroupExpanded(const char *group, bool expanded) = 0;
92  virtual bool isInputGroupExpanded(const char *group) = 0;
93  virtual std::vector<int> inputsInGroup(const char *group) = 0;
94  virtual std::vector<std::string> inputGroupNames() = 0;
95  virtual std::vector<int> inputIndexOrder() = 0;
96 
97  // Get the render mask.
98  virtual std::string renderMask() = 0;
99 
100  // Get the shader string for the render_type. Also, for the multi_type by
101  // default interpret it as a surface (invalid shader type would be better).
102  virtual std::string shaderString(const char *render_type=NULL,
103  HOM_EnumValue &interpret_type = HOM_shaderType::Surface,
104  bool as_encapsulated = false) = 0;
105 
106  // Returns the code for the given shader. If the VOP node is a subnet
107  // returns the encapsulated shader code, otherwise returns the shader code
108  // from the VOP network, or the SHOP.
109  virtual std::string shaderCode(
110  HOM_EnumValue &shader_type = HOM_shaderType::Surface)= 0;
111 
112  SWIGOUT(%kwargs shaderName;)
113  virtual std::string shaderName(
114  bool as_otl_path=true, const char *shader_type_name=nullptr) = 0;
115  virtual std::string shaderNameForSignature(
116  const char *signature = nullptr) = 0;
117 
118  virtual HOM_EnumValue& shaderType() = 0;
119 
120  virtual std::string shaderLanguageName() = 0;
121 
122  virtual std::string currentSignatureName() = 0;
123 
124  // When a vop is used as a shader node, some parameters may
125  // be overriden by a layered shader (coshader), or a parameter may
126  // specify an oppath for an explicit coshader.
127  // These methods return info about such coshaders.
128  virtual std::vector<HOM_ElemPtr<HOM_Node> > coshaderNodes(
129  const char *parm_name) = 0;
130  virtual std::vector<std::string> coshaderNodesOutputNames(
131  const char *parm_name) = 0;
132 
133  // Given the subnet output name, returns the subnet child and its input
134  // name that corresponds to that subnet output.
135  virtual std::pair<HOM_ElemPtr<HOM_Node>, std::string>
136  subnetTerminalChild( const char *subnet_output_name) = 0;
137 
138  // Return a list of extra bindings from this specific node, in
139  // particular Snippet VOPs triggering bindings via @ references.
140  virtual std::vector<std::string> extraBindings() = 0;
141 
142  // Return a list of shader node parameters that need to be authored on
143  // the USD shader primitive.
144  virtual std::vector<std::string> usdShaderParms() = 0;
145 
146  // Return a list of shader node parameters that are used to configure
147  // the USD universal/standard preview shader primitive attributes.
148  // They a parameters tagged with the "ogl_*" spare data.
149  virtual std::vector<std::string> usdPreviewShaderParms() = 0;
150 };
151 
152 #endif
153 
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1238
OIIO_API bool rename(string_view from, string_view to, std::string &err)
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:353
virtual HOM_EnumValue * shaderType()=0
HOM_VopNode(const HOM_VopNode &vop_node)
Definition: HOM_VopNode.h:32
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1237
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
GLboolean GLuint group
Definition: glew.h:2750
~HOM_VopNode() override
Definition: HOM_VopNode.h:36