HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_SubnetOutput.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_SubnetOutput_h__
11 #define __VOP_SubnetOutput_h__
12 
13 #include "VOP_API.h"
14 #include <UT/UT_StringArray.h>
15 #include "VOP_Node.h"
16 
18 {
19 public:
20  static OP_Node *myConstructor(OP_Network *net,
21  const char *name,
22  OP_Operator *entry);
23  static PRM_Template myTemplateList[];
24 
25  void getCode(UT_String &codestr,
26  const VOP_CodeGenContext &context
27  ) override;
28 
29  const char *inputLabel(unsigned idx) const override;
30 
31  unsigned getNumVisibleInputs() const override;
32 
34  const VOP_CodeGenContext &context,
35  bool check_shader_context
36  ) const override;
37 
38  // For suboutput VOPs, moving an input means we should also rewire the
39  // outputs from our containing subnet. We also watch for setInput calls
40  // to rearrange our parent's outputs when inputs are connected or
41  // disconnected from us.
42  void moveInput(int srcidx, int dstidx,
43  bool forcesubnet = false) override;
44  // Do not call this method yourself. It performs the core work
45  // necessary to move inputs on this subnet output node, but does not
46  // fully account for the synchonizing it with the rest of the
47  // nodes.
48  void moveInputInternal(int srcidx, int dstidx,
49  bool forcesubnet);
50  OP_ERROR setInput(unsigned idx, OP_Node *op,
51  unsigned outputIdx = 0) override;
53  unsigned idx,
54  const char *label,
55  int keeppos,
56  unsigned outputIdx = 0) override;
57 
59  const OP_ConnectorId &input_name,
60  OP_Node *op,
61  const OP_ConnectorId *output_name = NULL
62  ) override;
64  const OP_ConnectorId &input_name,
65  const char *label,
66  int,
67  const OP_ConnectorId *output_name = NULL
68  ) override;
69 
70  // Returns a pointer used by OPUI_OutputNameEditor to get and set data.
72  { return this; }
73 
74  // Provide access to the output name and label parameter functions so
75  // the OPUI_OutputNameEditor can deal with them appropriately.
76  int getNumInputsFromParent() const override;
77  void NAMEFROMPARM(
78  UT_String &str, int idx) const override;
79  void LABELFROMPARM(
80  UT_String &str, int idx) const override;
81  void setNAMEFROMPARM(
82  UT_String &str, int idx) override;
83  void setLABELFROMPARM(
84  UT_String &str, int idx) override;
85 
86  void beginWiring();
87  void endWiring();
88  void clearCachedInputNames();
89 
90 protected:
91  VOP_SubnetOutput(OP_Network *parent, const char *name, OP_Operator *entry);
92  ~VOP_SubnetOutput() override;
93 
94  void preOpChanged(
95  OP_EventType reason, void *data) override;
96 
98  UT_String &in, int idx) const override;
100  const UT_String &in) const override;
102  VOP_TypeInfo &type_info, int idx) override;
104  unsigned idx,
105  VOP_VopTypeInfoArray &voptypes) override;
106 
107 private:
108  void adjustParentForInputChange(int idx, bool inputnull);
109  void getInternalInputName(UT_String &in, int idx) const;
110  void findSafeBase(UT_String &in) const;
111  int mapToParentInputIndex(int index) const;
112  void swapNames(int srcidx, int dstidx);
113  void adjustOutputParmsForInputChange(int idx,
114  bool inputnull);
115 
116  UT_StringArray myInputNames;
117  int myWiringDepth;
118 };
119 
120 #endif
virtual int getInputFromNameSubclass(const UT_String &in) const
void moveInput(int srcidx, int dstidx, bool forcesubnet=false) override
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
OP_ERROR setNamedInputReference(const OP_ConnectorId &input_name, const char *label, int, const OP_ConnectorId *output_name=nullptr) override
virtual bool forceCodeGenerationOfInputs(const VOP_CodeGenContext &context, bool check_shader_context) const
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
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 setLABELFROMPARM(UT_String &str, int idx)=0
GLuint const GLchar * name
Definition: glcorearb.h:786
VOP_OutputNameEditorSource * getOutputNameEditorSource() override
Returns a pointer used by OPUI_OutputNameEditor to get and set data.
virtual void getCode(UT_String &codestr, const VOP_CodeGenContext &context)
Get the code fragment to be included in the shader code.
virtual void setNAMEFROMPARM(UT_String &str, int idx)=0
GLuint index
Definition: glcorearb.h:786
OP_EventType
Definition: OP_Value.h:22
virtual void getInputNameSubclass(UT_String &in, int idx) const
virtual void getAllowedInputTypeInfosSubclass(unsigned idx, VOP_VopTypeInfoArray &infos)
Definition: format.h:895
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