00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PI_ResourceTemplate_H__
00021 #define __PI_ResourceTemplate_H__
00022
00023 #include "PI_API.h"
00024 #include <UT/UT_String.h>
00025 #include <UT/UT_SymbolTable.h>
00026 #include <UT/UT_StringArray.h>
00027
00028 class PRM_Template;
00029
00030
00031
00032
00033 enum PI_ViewerType
00034 {
00035 PI_VIEWER_SCENE = 0,
00036 PI_VIEWER_PARTICLE,
00037 PI_VIEWER_COMPOSITE,
00038
00039 PI_NUM_VIEWER_TYPES
00040 };
00041
00042
00043 enum PI_NetworkType
00044 {
00045 PI_NETWORK_OBJ = 0,
00046 PI_NETWORK_SOP,
00047 PI_NETWORK_POP,
00048 PI_NETWORK_DOP,
00049 PI_NETWORK_COP2,
00050 PI_NUM_NETWORK_TYPES
00051 };
00052
00053 const unsigned PI_NETMASK_OBJ = 1 << (unsigned)PI_NETWORK_OBJ;
00054 const unsigned PI_NETMASK_SOP = 1 << (unsigned)PI_NETWORK_SOP;
00055 const unsigned PI_NETMASK_POP = 1 << (unsigned)PI_NETWORK_POP;
00056 const unsigned PI_NETMASK_DOP = 1 << (unsigned)PI_NETWORK_DOP;
00057 const unsigned PI_NETMASK_COP2= 1 << (unsigned)PI_NETWORK_COP2;
00058
00059 class OP_Operator;
00060 class PI_StateTemplate;
00061 class PI_PITemplate;
00062 class PI_HandleTemplate;
00063 class PI_SelectorTemplate;
00064
00065 class PI_API PI_ResourceTemplate
00066 {
00067 public:
00068 PI_ResourceTemplate(const char *name, const char *english,
00069 void *constructor);
00070 virtual ~PI_ResourceTemplate();
00071
00072 void initialize(const char *name, const char *english,
00073 void *constructor);
00074
00075 const UT_String &name() const { return myName; }
00076 const UT_String &englishName() const { return myEnglishName; }
00077 void *constructor() const { return myConstructor; }
00078 void constructor(void *c){ myConstructor = c; }
00079
00080 private:
00081 UT_String myName;
00082 UT_String myEnglishName;
00083 void *myConstructor;
00084 };
00085
00086
00087
00088 class PI_API PI_StateTemplate : public PI_ResourceTemplate
00089 {
00090 public:
00091 PI_StateTemplate(const char *name,
00092 const char *english,
00093 const char *icon_name,
00094 void *constructor,
00095 PRM_Template *templates,
00096 PI_ViewerType viewer_type,
00097 unsigned network_types,
00098 int op_independent = 1,
00099 const char *volatile_hotkey = 0,
00100 OP_Operator *op = 0);
00101 virtual ~PI_StateTemplate();
00102
00103 void initialize(const char *name,
00104 const char *english,
00105 const char *icon_name,
00106 void *constructor,
00107 PRM_Template *templates,
00108 PI_ViewerType viewer_type,
00109 unsigned network_types,
00110 int op_independent = 1,
00111 const char *volatile_hotkey = 0,
00112 bool hidden = false);
00113
00114 PRM_Template *templates() { return myTemplates; }
00115 const PRM_Template *templates() const
00116 { return myTemplates; }
00117 PI_ViewerType viewerType() const
00118 { return myViewerType; }
00119 unsigned networkTypes() const
00120 { return myNetworkTypes; }
00121 const char *getIconName() const
00122 { return myIconName; }
00123 int opIndependent() const
00124 { return myOpIndependentFlag; }
00125 int volatileKey() const
00126 { return myVolatileKey; }
00127 int volatileKeyModifiers() const
00128 {return myVolatileKeyModifiers;}
00129 const char *getHotkeyString() const
00130 { return myHotkeyString; }
00131 OP_Operator *getOperator() const
00132 { return myOp; }
00133
00134 void setHidden(bool hide)
00135 { myHidden = hide; }
00136 bool getHidden() const
00137 { return myHidden; }
00138
00139 protected:
00140 void setVolatileKey(int key, int modifiers)
00141 {
00142 myVolatileKey = key;
00143 myVolatileKeyModifiers = modifiers;
00144 }
00145
00146 private:
00147 UT_String myIconName;
00148 UT_String myHotkeyString;
00149 PRM_Template *myTemplates;
00150 OP_Operator *myOp;
00151 PI_ViewerType myViewerType;
00152 unsigned myNetworkTypes;
00153 int myOpIndependentFlag;
00154 int myVolatileKey;
00155 int myVolatileKeyModifiers;
00156 bool myHidden;
00157 };
00158
00159
00160
00161 class PI_API PI_HandleTemplate : public PI_ResourceTemplate
00162 {
00163 public:
00164 PI_HandleTemplate(const char *name,
00165 const char *english,
00166 void *constructor,
00167 PRM_Template *templates);
00168 virtual ~PI_HandleTemplate();
00169
00170 const PRM_Template *templates() const { return myTemplates; }
00171 PRM_Template *templates() { return myTemplates; }
00172
00173 private:
00174 PRM_Template *myTemplates;
00175 };
00176
00177
00178
00179 class PI_API PI_PITemplate : public PI_ResourceTemplate
00180 {
00181 public:
00182 PI_PITemplate(const char *name,
00183 const char *english,
00184 const char *types,
00185 const char *icon_name,
00186 const char *parms[],
00187 short ethereal = 0,
00188 unsigned viewmask = 0xFFFFFFFF);
00189 virtual ~PI_PITemplate();
00190
00191 const UT_SymbolTable &parmNameTable() const
00192 { return myParmNameTable; }
00193 const UT_StringArray &parmNameList() const
00194 { return myParmNameList; }
00195 const char *iconName() const { return myIconName; }
00196 short isEthereal() const { return myEtherealFlag; }
00197 bool supportsType(const char *type) const;
00198 unsigned getViewerMask() const { return myViewerMask;}
00199
00200
00201 const char *getHelp();
00202
00203 private:
00204 UT_String myTypes;
00205 UT_String myIconName;
00206 int myHelpCached;
00207 UT_String myHelp;
00208 UT_SymbolTable myParmNameTable;
00209 UT_StringArray myParmNameList;
00210 short myEtherealFlag;
00211 unsigned myViewerMask;
00212 };
00213
00214
00215
00216 class PI_API PI_SelectorTemplate : public PI_ResourceTemplate
00217 {
00218 public:
00219 PI_SelectorTemplate(const char *name,
00220 const char *english,
00221 const char *types);
00222 virtual ~PI_SelectorTemplate();
00223
00224 bool isGeneric() const { return (myData != 0); }
00225 bool supportsType(const char *type) const;
00226 void data(void *d) { myData = d; }
00227 void *data() const { return myData; }
00228
00229 private:
00230 UT_String myTypes;
00231 void *myData;
00232 };
00233
00234 #endif