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(unsigned 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;
68  OP_ERROR setInput(unsigned idx, OP_Node *op,
69  unsigned outputIdx = 0) override;
70  OP_ERROR setInputReference(unsigned idx, const char *label,
71  int keeppos, unsigned outputIdx = 0) override;
72  OP_ERROR setNamedInput(const OP_ConnectorId& input_id,
73  OP_Node *op,
74  const OP_ConnectorId* output_name = nullptr
75  ) override;
77  const char *label, int keeppos,
78  const OP_ConnectorId* output_name = nullptr
79  ) override;
80  /// @}
81 
82  /// @{ In case the collect VOP is assigned as a material.
83  VOP_Node *findShader(VOP_Type shader_type, fpreal now) override;
84  void findAllShaders( VOP_NodeList &shader_nodes,
85  VOP_ShaderTypeList &shader_types,
86  UT_StringArray &output_names) override;
87  bool isUSDNodeGraph() const override;
90  const UT_StringRef &name, fpreal now,
91  OP_Node *&op, PRM_Parm *&parm,
92  bool create_missing_multiparms,
93  PRM_ParmList *obsolete = 0) override;
95  const UT_StringRef &chname,
96  fpreal now, OP_Node *&op, PRM_Parm *&parm,
97  int &vector_index,
98  PRM_ParmList *obsolete = 0) override;
99  /// @}
100 
101  // Returns a pointer used by OPUI_OutputNameEditor to get and set data.
103 
104  // Provide access to the output name and label parameter functions so
105  // the OPUI_OutputNameEditor can deal with them appropriately.
106  int getNumInputsFromParent() const override;
107  void NAMEFROMPARM(UT_String &str, int idx) const override;
108  void LABELFROMPARM(UT_String &str, int idx) const override;
109  void setNAMEFROMPARM(UT_String &str, int idx) override;
110  void setLABELFROMPARM(UT_String &str, int idx) override;
111 
112  // Virtuals for managing the input multiparm
113  void preOpChanged(OP_EventType reason, void *) override;
114  void postOpChanged(OP_EventType reason,
115  void *data) override;
116 
117  // Utility members.
118  int NUMINPUTS() const;
119  void INPUTNAME(UT_String &name, int idx) const;
120  void setINPUTNAME(const char *name, int idx,
121  bool make_unique = true);
122  bool hasINPUTNAME(const char *name, int skip_idx);
123  void INPUTLABEL(UT_String &label, int idx) const;
124  void setINPUTLABEL(const char *label, int idx);
125 
126 private:
127  void notifyParentOfInputChange();
128  void adjustForInputChange(int idx,
129  bool is_new, bool is_deleted);
130  void adjustForInputMove(int srcidx, int dstidx );
131  void moveInputNameParm(int srcidx, int dstidx);
132  void removeInputNameParm(int idx);
133 };
134 
135 #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
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)
GLuint const GLchar * name
Definition: glew.h:1814
OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=nullptr) override
virtual unsigned getNumVisibleInputs() const
virtual const char * inputLabel(unsigned idx) const
OP_ERROR setInput(unsigned idx, OP_Node *op, unsigned outputIdx=0) override
UT_ErrorSeverity
Definition: UT_Error.h:25
OP_ERROR setInputReference(unsigned idx, const char *label, int keeppos, unsigned outputIdx=0) override
Connects an input to particular node by name in the network.
virtual void getInputTypeInfoSubclass(VOP_TypeInfo &type_info, int idx)
virtual int getNumInputsFromParent() const =0
GLsizei GLenum GLenum * types
Definition: glew.h:3954
virtual void NAMEFROMPARM(UT_String &str, int idx) const =0
#define VOP_API
Definition: VOP_API.h:10
GLuint in
Definition: glew.h:11510
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
virtual void preOpChanged(OP_EventType, void *)
Definition: VOP_Node.h:1426
GLuint const GLuint * names
Definition: glew.h:2690
virtual void loadFinished()
virtual void setLABELFROMPARM(UT_String &str, int idx)=0
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
GLuint GLsizei GLsizei GLchar * label
Definition: glew.h:8986
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:949
virtual void setNAMEFROMPARM(UT_String &str, int idx)=0
fpreal64 fpreal
Definition: SYS_Types.h:277
OP_EventType
Definition: OP_Value.h:22
VOP_Type
Definition: VOP_Types.h:24
virtual void getInputNameSubclass(UT_String &in, int idx) const
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
virtual bool isUSDNodeGraph() const
virtual VOP_Node * findShader(VOP_Type shader_type, fpreal now)
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:1428