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