00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __VOP_ScriptOperator__
00020 #define __VOP_ScriptOperator__
00021
00022 #include "VOP_API.h"
00023 #include <UT/UT_String.h>
00024 #include <UT/UT_RefArray.h>
00025 #include <PI/PI_ScriptOperator.h>
00026 #include "VOP_OperatorInfo.h"
00027
00028 #define DEFAULT_INPUTSET_NAME "default"
00029 #define DEFAULT_INPUTSET_LABEL "Default Inputs"
00030
00031 class VOP_Language;
00032
00033 class VOP_API VOP_ScriptOperator : public PI_ScriptOperator
00034 {
00035 public:
00036 VOP_ScriptOperator(const char *path,
00037 const char *name,
00038 const char *label,
00039 int minInputs, int maxInputs,
00040 const char *vopnetMask,
00041 OP_Constructor construct,
00042 PRM_Template *multiInputSetTemplates);
00043 virtual ~VOP_ScriptOperator();
00044
00045 static OP_ScriptOperator *createScriptOperator(const OP_OTLDefinition &);
00046
00047 virtual OP_SpecificData *getOpSpecificData()
00048 { return &myOperatorInfo; }
00049 virtual const OP_SpecificData *getOpSpecificData() const
00050 { return &myOperatorInfo; }
00051
00052 virtual int updateParmTemplates();
00053 virtual unsigned maxOutputs();
00054 const UT_String &getOutputName(int idx);
00055 const UT_String &getOutputLabel(int idx);
00056 VOP_Type getOutputType(int idx, int inputset);
00057
00058 const UT_String &getInputName(int idx);
00059 const UT_String &getInputLabel(int idx);
00060 VOP_Type getInputType(int idx, int inputset);
00061 bool getIsInputVisible(int idx);
00062
00063 bool forceCodeGenerationOfInputs(
00064 VOP_ContextType type,
00065 bool essential) const;
00066
00067 const UT_String &getOuterCode() const;
00068 const UT_String &getCode() const;
00069
00070 virtual bool wantsParametersAnimatable() const;
00071 virtual bool wantsInputEditor() const;
00072
00073 int getNumInputSets() const;
00074 const char *getInputSetName(int index) const;
00075 const char *getInputSetLabel(int index) const;
00076
00077 virtual const PRM_Template *getBaseParmTemplates();
00078
00079 void getAllowedInputTypes(unsigned idx, VOP_VopTypeArray &voptypes);
00080
00081 protected:
00082 virtual const char *getAddedDSIncludePath();
00083 virtual int handleUnknownToken(DS_Stream &ds,
00084 UT_String &token);
00085 bool addOutput(const UT_String &outtype,
00086 const UT_String &name,
00087 const UT_String &label);
00088 bool addInput(const UT_String &intype,
00089 const UT_String &name,
00090 const UT_String &label);
00091 virtual PRM_Template *loadParmTemplates(UT_IStream &is,
00092 const char *filename,
00093 UT_String &scriptName,
00094 PRM_ScriptImports *&imports);
00095
00096 private:
00097
00098
00099 void ensureParmsAreLoaded();
00100
00101 VOP_OperatorInfo myOperatorInfo;
00102 PRM_Template *myMultiInputSetBase;
00103 VOP_Language *myLanguage;
00104 bool myIsSubnet;
00105 };
00106
00107 #endif