HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DAE_OPUtil.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: DAE_OPUtils.h (COLLADA Library, C++)
7  *
8  * COMMENTS: OP utility library.
9  *
10  */
11 
12 #ifndef __DAE_OPUtil_h__
13 #define __DAE_OPUtil_h__
14 
15 #include <SYS/SYS_Types.h>
16 #include <UT/UT_String.h>
17 #include <CH/CH_ExprLanguage.h>
18 #include <OP/OP_Layout.h>
19 #include "DAE_API.h"
20 
21 class CH_Channel;
23 class OP_Network;
24 class OP_Node;
25 
26 /// Static class.
27 /// The OP utility library. This is a wrapper for low-level
28 /// functionality dealing with objects from the Houdini network.
30 {
31 public:
32 
33  /// Passes back a suggested OP label for the given name and id.
34  static void getOPLabel(const UT_String &name,
35  const UT_String &id,
36  UT_String &label);
37 
38  /// Uses the path to find a node in the Houdini network.
39  /// Returns a pointer to the OP network if the node is a subnet.
40  /// Returns NULL otherwise.
41  static OP_Network *findOPNetwork(const char *path);
42 
43  /// Creates an OP node of the given type, under the given
44  /// parent network. If successful, returns a pointer to the new OP_Node,
45  /// otherwise, it returns NULL.
46  static OP_Node *createOPNode(OP_Network *parent,
47  const char *label,
48  const char *type,
49  bool runInit=1);
50 
51  /// Wires the first operator into the second operator.
52  /// The connection is made to the input corresponding to 'inputIndex'.
53  static void wireOPNodes(OP_Node *outputNode,
54  OP_Node *inputNode,
55  int inputIndex);
56 
57  /// Wires the indirect input node into the operator.
58  /// The connection is made to the input corresponding to 'inputIndex'.
59  static void wireOPNodes(
60  OP_SubnetIndirectInput *outputNode,
61  OP_Node *inputNode,
62  int inputIndex);
63 
64  /// Organizes the node layout in the given network.
65  static void organizeOPLayout(OP_Network *network, OP_LayoutDirection layout_dir = OP_LAYOUT_TOP_TO_BOT);
66 
67  /// Passes back the OP parameter's value (1 integer).
68  static void getOPParmValue(OP_Node *node,
69  const char *parmName,
70  int &ivalue,
71  int index=0);
72 
73  /// Passes back the OP parameter's value (1 float).
74  static void getOPParmValue(OP_Node *node,
75  const char *parmName,
76  fpreal &fvalue,
77  int index=0);
78 
79  /// Sets the OP parameter's value (1 integer).
80  static void setOPParm(OP_Node *node,
81  const char *parmName,
82  int ivalue,
83  int index=0);
84 
85  /// Sets the OP parameter's value (1 float).
86  static void setOPParm(OP_Node *node,
87  const char *parmName,
88  fpreal fvalue,
89  int index=0);
90 
91  /// Sets the OP parameter's value (1 string).
92  static void setOPParm(OP_Node *node,
93  const char *parmName,
94  const char * strvalue,
95  CH_StringMeaning meaning,
96  int index=0);
97 
98  /// Sets the OP parameter's value (3 floats).
99  static void setOPParm(OP_Node *node,
100  const char *parmName,
101  fpreal fvalue1,
102  fpreal fvalue2,
103  fpreal fvalue3);
104  /// Sets the OP parameter's value (3 strings).
105  //
106  static void setOPParm(OP_Node *node,
107  const char *parmName,
108  const char *svalue1,
109  const char *svalue2,
110  const char *svalue3,
111  CH_StringMeaning meaning);
112 
113  /// Adds a spare float parameter to the given node.
114  static void addOPSpareFloatParm
115  (OP_Node *node,
116  const char *token,
117  const char *label,
118  fpreal defaultValue,
119  fpreal minValue,
120  fpreal maxValue,
121  bool cook_dependent = false);
122 
123  /// Adds a spare string parameter to the given node.
124  static void addOPSpareStringParm
125  (OP_Node *node,
126  const char *token,
127  const char *label,
128  const char *defaultValue,
129  bool cook_dependent = false);
130 
131  /// Adds a spare 3-float parameter to the given node.
132  static void addOPSpare3FloatParm
133  (OP_Node *node,
134  const char *token,
135  const char *label,
136  fpreal defaultValue1,
137  fpreal defaultValue2,
138  fpreal defaultValue3,
139  bool cook_dependent = false);
140 
141  /// Adds a property to the given node.
142  static void addOPProperty
143  (OP_Node *node,
144  const char *propClass,
145  const char *propName);
146 
147  /// Sets a keyframe on the given channel using the
148  /// passed-in attributes.
149  static void keyOPChannel(CH_Channel *ch,
150  fpreal time,
151  fpreal fvalue,
152  bool hasInSlope=false,
153  bool hasOutSlope=false,
154  bool hasInterp=false,
155  fpreal inSlope=0.0,
156  fpreal outSlope=0.0,
157  const char *interp="");
158 
159  /// Returns the channel index that corresponds to the
160  /// given symbolic name. The mapping of names to indices
161  /// is specified in "Chapter 4: The COMMON Profile - Common Glossary"
162  /// of the COLLADA specification document.
163  static int getCHIndexByName(const char *name);
164 
165  /// Returns the CH key expression that corresponds to the given
166  /// symbol name. The possible names are specified in
167  /// "Chapter 3: Schema Reference - <sampler>"
168  /// of the COLLADA specificaion document.
169  static const char *getCHKeyExprByName(const char *name);
170 
171 protected:
172 
173  /// Constructor.
174  DAE_OPUtil();
175 
176  /// Destructor.
177  virtual ~DAE_OPUtil();
178 };
179 
180 
181 #endif
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
CH_StringMeaning
GT_API const UT_StringHolder time
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
GLuint const GLchar * name
Definition: glcorearb.h:786
#define DAE_API
Definition: DAE_API.h:10
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
OP_LayoutDirection
Definition: OP_Layout.h:28
type
Definition: core.h:1059