HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_Collect.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  * NAME: VOP Library (C++)
7  *
8  */
9 
10 #ifndef __VOP_Collect_h__
11 #define __VOP_Collect_h__
12 
13 #include "VOP_API.h"
14 #include "VOP_Node.h"
15 
16 class UT_StringRef;
17 
19 {
20 protected:
21  VOP_Collect(OP_Network *parent, const char *name, OP_Operator *entry);
22  ~VOP_Collect() override;
23 
24 public:
25  static OP_Operator *createOperator();
26  static OP_Node *myConstructor(OP_Network *net,
27  const char *name,
28  OP_Operator *entry);
29  static PRM_Template myTemplateList[];
30 
31  /// Get nodes that effectively are fed into the collect node. These
32  /// include regular (eg, output) nodes, but also regular nodes indirectly
33  /// connected through a chain of nulls and switches.
34  void getCollectedNodes(VOP_NodeList &outputs);
35 
36  /// Get the types of shaders wired into this collect node.
37  void getCollectedShaderTypes(VOP_ShaderTypeList &types) const;
38 
39  /// Get input names specified in the multi-parm. May contain empties.
40  void getCollectedInputNames(UT_StringArray &names) const;
41 
42  /// Collect VOP is virtually equivalent to a vo material.
43  VOP_Type getShaderType() const override;
44 
45  unsigned getNumVisibleInputs() const override;
46 
47 protected:
48  /// Inherited from VOP_Node.
49  void initMaterialFlag() override;
50  void loadFinished() override;
51 
52  /// @{ Virtuals for VOP node inputs.
53  const char *inputLabel(OP_InputIdx idx) const override;
55  UT_String &in, int idx) const override;
57  const UT_String &in) const override;
59  VOP_TypeInfo &type_info, int idx) override;
61  unsigned idx,
62  VOP_VopTypeArray &voptypes) override;
63  /// @}
64 
65  /// @{ Intercepting input manipulation to notify the parent.
66  void moveInput(int srcidx, int dstidx,
67  bool forcesubnet = false) override;
69  OP_OutputIdx outputIdx = 0) override;
71  int keeppos,
72  OP_OutputIdx outputIdx = 0) override;
73  OP_ERROR setNamedInput(const OP_ConnectorId& input_id,
74  OP_Node *op,
75  const OP_ConnectorId* output_name = nullptr
76  ) override;
78  const char *label, int keeppos,
79  const OP_ConnectorId* output_name = nullptr
80  ) override;
81  /// @}
82 
83  /// @{ In case the collect VOP is assigned as a material.
84  VOP_Node *findShader(VOP_Type shader_type, fpreal now) override;
85  void findAllShaders( VOP_NodeList &shader_nodes,
86  VOP_ShaderTypeList &shader_types,
87  UT_StringArray &output_names) override;
88  bool isUSDNodeGraph() const override;
91  const UT_StringRef &name, fpreal now,
92  OP_Node *&op, PRM_Parm *&parm,
93  bool create_missing_multiparms,
94  PRM_ParmList *obsolete = 0) override;
96  const UT_StringRef &chname,
97  fpreal now, OP_Node *&op, PRM_Parm *&parm,
98  int &vector_index,
99  PRM_ParmList *obsolete = 0) override;
100  /// @}
101 
102  // Returns a pointer used by OPUI_OutputNameEditor to get and set data.
104 
105  // Provide access to the output name and label parameter functions so
106  // the OPUI_OutputNameEditor can deal with them appropriately.
107  int getNumInputsFromParent() const override;
108  void NAMEFROMPARM(UT_String &str, int idx) const override;
109  void LABELFROMPARM(UT_String &str, int idx) const override;
110  void setNAMEFROMPARM(UT_String &str, int idx) override;
111  void setLABELFROMPARM(UT_String &str, int idx) override;
112 
113  // Virtuals for managing the input multiparm
114  void preOpChanged(OP_EventType reason, void *) override;
115  void postOpChanged(OP_EventType reason,
116  void *data) override;
117 
118  // Utility members.
119  int NUMINPUTS() const;
120  void INPUTNAME(UT_String &name, int idx) const;
121  void setINPUTNAME(const char *name, int idx,
122  bool make_unique = true);
123  bool hasINPUTNAME(const char *name, int skip_idx);
124  void INPUTLABEL(UT_String &label, int idx) const;
125  void setINPUTLABEL(const char *label, int idx);
126 
127 private:
128  void notifyParentOfInputChange();
129  void adjustForInputChange(int idx,
130  bool is_new, bool is_deleted);
131  void adjustForInputMove(int srcidx, int dstidx );
132  void moveInputNameParm(int srcidx, int dstidx);
133  void removeInputNameParm(int idx);
134 };
135 
136 #endif
virtual int getInputFromNameSubclass(const UT_String &in) const
virtual VOP_Type getShaderType() const
Returns the name, type, and render mask of the VOP shader.
virtual void initMaterialFlag()
void moveInput(int srcidx, int dstidx, bool forcesubnet=false) override
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
virtual VOP_Node * getProcedural(VOP_Type type)
Material VOP may be able to return a procedural node.
virtual void getAllowedInputTypesSubclass(unsigned idx, VOP_VopTypeArray &voptypes)
OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=nullptr) override
OP_ERROR setInputReference(OP_InputIdx idx, const char *label, int keeppos, OP_OutputIdx outputIdx=0) override
Connects an input to particular node by name in the network.
virtual unsigned getNumVisibleInputs() const
int OP_InputIdx
Definition: OP_DataTypes.h:184
OP_ERROR setInput(OP_InputIdx idx, OP_Node *op, OP_OutputIdx outputIdx=0) override
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
virtual int getNumInputsFromParent() const =0
constexpr auto in(type t, int set) -> bool
Definition: core.h:611
virtual const char * inputLabel(OP_InputIdx idx) const
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
virtual void NAMEFROMPARM(UT_String &str, int idx) const =0
#define VOP_API
Definition: VOP_API.h:10
virtual void preOpChanged(OP_EventType, void *)
Definition: VOP_Node.h:1453
virtual void loadFinished()
virtual void setLABELFROMPARM(UT_String &str, int idx)=0
GLuint const GLchar * name
Definition: glcorearb.h:786
bool getParameterOrProperty(const UT_StringRef &name, fpreal now, OP_Node *&op, PRM_Parm *&parm, bool create_missing_multiparms, PRM_ParmList *obsolete=0) override
virtual VOP_OutputNameEditorSource * getOutputNameEditorSource()
Returns a pointer used by OPUI_OutputNameEditor to get and set data.
Definition: VOP_Node.h:945
virtual void setNAMEFROMPARM(UT_String &str, int idx)=0
fpreal64 fpreal
Definition: SYS_Types.h:278
OP_EventType
Definition: OP_Value.h:22
VOP_Type
Enumeration of the built-in (basic) VOP data types.
Definition: VOP_Types.h:25
virtual void getInputNameSubclass(UT_String &in, int idx) const
int OP_OutputIdx
Definition: OP_DataTypes.h:185
virtual void findAllShaders(VOP_NodeList &shader_nodes, VOP_ShaderTypeList &shader_types, UT_StringArray &output_names)
bool getParameterOrPropertyByChannel(const UT_StringRef &chname, fpreal now, OP_Node *&op, PRM_Parm *&parm, int &vector_index, PRM_ParmList *obsolete=0) override
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2542
virtual bool isUSDNodeGraph() const
virtual VOP_Node * findShader(VOP_Type shader_type, fpreal now)
Definition: format.h:1821
OP_ERROR setNamedInput(const OP_ConnectorId &input_name, OP_Node *op, const OP_ConnectorId *output_name=nullptr) override
New input functions that use names instead of indices.
virtual void LABELFROMPARM(UT_String &str, int idx) const =0
virtual void postOpChanged(OP_EventType, void *)
Definition: VOP_Node.h:1455