HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SHOP_Util.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: SHOP_Util.h ( SHOP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SHOP_Util__
12 #define __SHOP_Util__
13 
14 #include "SHOP_API.h"
15 #include "SHOP_NodeTypes.h"
16 #include <SYS/SYS_Types.h>
17 
18 class UT_Options;
19 class UT_PropertyTable;
20 class UT_StringHolder;
21 class OP_Node;
22 class PRM_Parm;
23 
24 /// Contains shader utility functions.
26 {
27 public:
28  /// @{
29  /// Get/set property table for defaults.
30  /// If a parameter exists in the property table, then that default value is
31  /// used rather than the parameter's default value.
32  static const UT_PropertyTable *getPropertyDefaults();
33  static void setPropertyDefaults(const UT_PropertyTable *table);
34  /// @}
35 
36  /// Returns shader type name token for the given shader type.
37  static const char *getShaderType(SHOP_TYPE type);
38 
39  /// Returns shader label for the given shader type.
40  static const char *getShaderLabel(SHOP_TYPE type);
41 
42  /// Return the icon name for the given shader type.
43  static const char *getIconName(SHOP_TYPE type);
44 
45  /// Return the name of internal bundle filter for shader of a given type.
46  static const char *getBundleFilter(SHOP_TYPE type);
47 
48  /// Return the parameter name that specifies the shader of a given type
49  /// (i.e. "shop_materialpath")
50  static const UT_StringHolder &getShaderParmPath(SHOP_TYPE type);
51 
52  /// Return the parameter name that specifies the space for the shader.
53  static const char *getShaderSpaceParm(SHOP_TYPE type);
54 
55  /// Return the shader type given the shader type name.
56  static SHOP_TYPE getShaderType(const char *name);
57 
58  /// Return the shader type given the shader parameter name.
59  static SHOP_TYPE getTypeFromParm(const char *parmname);
60 
61  /// Return the shader type from the space parameter name.
62  static SHOP_TYPE getTypeFromSpaceParm(const char *parmname);
63 
64  /// Return true if the given integer representation of SHOP_TYPE is valid.
65  static bool isValidShaderType(int i);
66 
67  /// Convert a string like "{'foo':'bar','fum':(1,2,3)}' to a UT_Options
68  static bool convertStringToOptions(UT_Options &options,
69  const char *str);
70 
71  /// @{ Returns true if the paramter is at a default value.
72  /// If check_input is true, will also return true if parameter has
73  /// a corresponding input that is wired in.
74  static bool isParmDefaultValue(OP_Node *node, PRM_Parm *parm,
75  fpreal now, const UT_Options *options,
76  bool check_input = false);
77  static bool isParmDefaultValue(OP_Node *node, const char *parmname,
78  fpreal now, const UT_Options *options,
79  bool check_input = false);
80  /// @}
81 
82  /// Returns true if the parmeter of the node has a RiType tag.
83  static bool hasParmRiType(OP_Node *node, const char *parmname);
84 
85  /// Returns ture if the parm has a corresponding input on the node
86  /// and that input is wired in.
87  static bool hasConnectedInput(OP_Node *node, PRM_Parm *parm);
88 
89  /// Returns true if the parameter corresponds to a co-shader parameter.
90  static bool isCoShaderParm(const PRM_Parm *parm );
91 
92  /// Returns true if the parameter corresponds to a coshader array parameter.
93  static bool isCoShaderArray( const PRM_Parm *parm );
94 };
95 
96 #endif
97 
Contains shader utility functions.
Definition: SHOP_Util.h:25
png_uint_32 i
Definition: png.h:2877
#define SHOP_API
Definition: SHOP_API.h:10
SHOP_TYPE
GLuint const GLchar * name
Definition: glcorearb.h:785
double fpreal
Definition: SYS_Types.h:270
A map of string to various well defined value types.
Definition: UT_Options.h:42
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107