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
00062 bool forceCodeGenerationOfInputs() const;
00063 const UT_String &getOuterCode() const;
00064 const UT_String &getCode() const;
00065
00066 virtual bool wantsParametersAnimatable() const;
00067 virtual bool wantsInputEditor() const;
00068
00069 int getNumInputSets() const;
00070 const char *getInputSetName(int index) const;
00071 const char *getInputSetLabel(int index) const;
00072
00073 virtual const PRM_Template *getBaseParmTemplates();
00074
00075 void getAllowedInputTypes(unsigned idx, VOP_VopTypeArray &voptypes);
00076
00077 protected:
00078 virtual const char *getAddedDSIncludePath();
00079 virtual int handleUnknownToken(DS_Stream &ds,
00080 UT_String &token);
00081 bool addOutput(const UT_String &outtype,
00082 const UT_String &name,
00083 const UT_String &label);
00084 bool addInput(const UT_String &intype,
00085 const UT_String &name,
00086 const UT_String &label);
00087 virtual PRM_Template *loadParmTemplates(UT_IStream &is,
00088 const char *filename,
00089 UT_String &scriptName,
00090 PRM_ScriptImports *&imports);
00091
00092 private:
00093
00094
00095 void ensureParmsAreLoaded();
00096
00097 VOP_OperatorInfo myOperatorInfo;
00098 PRM_Template *myMultiInputSetBase;
00099 VOP_Language *myLanguage;
00100 bool myIsSubnet;
00101 };
00102
00103 #endif