16 #ifndef __OP_Operator_h__
17 #define __OP_Operator_h__
49 #define ENGLISH_NAME "englishname"
50 #define VOPNET_TAB_MENU_FLAG_NAME "tabmenuflag"
78 class OP_EventScriptPathCache;
81 #define OP_FLAG_NETWORK 0x01
82 #define OP_FLAG_GENERATOR 0x02
83 #define OP_FLAG_UNORDERED 0x04
84 #define OP_FLAG_SCRIPTDEF 0x08
85 #define OP_FLAG_MANAGER 0x10
86 #define OP_FLAG_PRIMARYSUBNET 0x20
87 #define OP_FLAG_OUTPUT 0x40
88 #define OP_FLAG_EDITABLE_INPUT_DATA 0x80
91 #define OP_MAX_INPUT_LABELS 4
94 #define OP_MULTI_INPUT_MAX 9999
98 #define OP_MAX_INDIRECT_INPUTS 500
101 #define OP_MULTI_OUTPUT_MAX 9999
107 typedef std::function<OP_Ptr(OP_Network *, const char *, OP_Operator *)>
OP_Constructor;
122 virtual void saveToDialogScript(std::ostream &os)
const = 0;
150 unsigned min_sources,
151 unsigned max_sources = 9999,
154 const char **inputlabels = 0,
156 const char *tab_submenu_path = 0);
162 unsigned min_sources,
163 unsigned max_sources = 9999,
166 const char **inputlabels = 0,
168 const char *tab_submenu_path = 0);
174 const char *child_table_name,
175 unsigned min_sources,
176 unsigned max_sources = 9999,
179 const char **inputlabels = 0,
181 const char *tab_submenu_path = 0);
187 const char *child_table_name,
188 unsigned min_sources,
189 unsigned max_sources = 9999,
192 const char **inputlabels = 0,
194 const char *tab_submenu_path = 0);
199 int getNumActiveNodes()
const;
200 OP_Node *getActiveNode(
int i)
const;
201 void nodeDestroyed(
OP_Node *node);
218 void getOriginalTableAndName(
UT_String &name)
const;
221 {
return myOTLDefinition.getName(); }
228 { myOTLDefinition.getTableAndName(name); }
230 { myOTLDefinition.getTableAndName(name); }
233 {
return myOTLDefinition.getLabel(); }
234 virtual UT_Color getDefaultColor()
const;
240 virtual bool getOpHelpURL(
UT_String &url);
241 virtual bool getOpTabSubMenuPath(
UT_String &tab_submenu_path);
242 void setOpTabSubMenuPath(
const char *tab_submenu_path);
247 bool hasPotentialEditableSubNodes();
250 void getDiveTarget(
UT_String &divetarget);
251 void getDescriptiveParmName(
UT_String &descrparm);
252 void getDefaultState(
UT_String &statename);
253 void getFunctionName(
UT_String &function_name);
254 void getSecondaryFunctionsNames(
267 void getHelpFileDirAndName(
UT_String & script_dir,
270 void getDefinitionSource(
UT_String &defsource)
const;
273 { ourLastHelpOp = 0; }
274 OP_Node *getDefiningNetwork()
const;
280 {
return myOTLDefinition.getIndexPath(); }
282 {
return myOTLDefinition.getIndexFile(); }
284 {
return myOTLDefinition.getIsSubnet(); }
290 {
return myVexContextType; }
292 {
return myRslContextType; }
294 {
return myOTLDefinition.getModTime(); }
296 {
return myOTLDefinition.getIsDummyDefinition(); }
300 {
return myOTLDefinition.getIsPython(); }
302 { myOTLDefinition.setIsPython(is_python); }
306 {
return myOTLDefinition.getExtraInfo(); }
308 {
return myOTLDefinition.getExtraInfoBuffer(); }
313 {
return myOTLDefinition; }
317 { myOTLLibrary = library; }
319 {
return myOTLLibrary; }
323 virtual bool hasSectionData(
const UT_StringRef &name)
const;
325 bool hasContentsSection();
329 {
return getOTLIndexFilePtr(check_timestamp).get(); }
342 virtual void clearOTLIndexFile();
348 FS_IndexFile *createOTLIndexFile(
bool reservedsectionsonly,
353 void getDefinitionSectionName(
UT_String §name)
const;
367 const char *opdef_or_oplib,
368 const char *section_name)
const;
370 const char *opdef_or_oplib,
376 void listContainedOperators(
UT_StringSet &contents_list);
380 const char *getIconName()
const;
381 void setIconName(
const char *name);
382 void setDefaultIconName();
385 {
return myOTLDefinition.getMinInputs(); }
387 {
return myOTLDefinition.getMaxInputs(); }
395 { myOTLDefinition.setNumOrderedInputs(inputs); }
397 {
return myOTLDefinition.getNumOrderedInputs(); }
410 void setLegacyInputsMap(
const char *map);
411 void getLegacyInputsMap(
UT_String &map)
const;
419 return isManagementOp()
421 : myOTLDefinition.getMaxOutputs();
426 virtual bool hasLoadedParmTemplates()
const;
427 virtual int updateParmTemplates();
430 virtual void forceUpdateParmTemplates();
456 {
return myBaseOverrideLayout; }
459 {
return myObsoleteTemplates; }
461 { myObsoleteTemplates = tmpl; }
467 bool getOverrideLayoutParmTemplateFile(
489 bool isCustomDSO()
const;
515 return myCreatingNode;
519 return myChangingParmTemplates;
523 return myLoadingContentsSectionCount > 0;
527 myLoadingContentsSectionCount++;
531 myLoadingContentsSectionCount--;
539 return getNumActiveNodes() > 0 || myRefreshingLib;
543 OP_COMPARE_GEN_ENGLISH = 0,
544 OP_COMPARE_GEN_NAME = 1,
545 OP_COMPARE_ENGLISH = 2,
551 virtual int compareOperator(
const OP_Operator *other,
560 {
return myInputNames; }
563 {
return myInputLabels; }
564 bool getInputIsReference(
int idx)
const;
566 {
return myInputReferences; }
567 virtual bool allowsInputNameEditing()
const;
572 {
return myOutputLabels; }
575 unsigned getPermissionMask()
const;
583 virtual bool wantsParametersAnimatable()
const;
586 virtual bool wantsInputEditor()
const;
589 virtual bool wantsParmOrderEditor()
const;
592 virtual bool wantsOutputNameEditor()
const;
595 virtual bool wantsParentInputs()
const;
599 {
return myInputDataEditorConfig; }
602 { myInputDataEditorConfig = config; }
603 void setInputDataEditorConfig(
608 virtual const char *getOperatorShortHelpString();
613 virtual void getOperatorSpecificInfoText(
int verbose,
625 virtual void fillInfoTreeOperatorSpecific(
UT_InfoTree &tree,
629 static int loadFromOpType(
const char *fname,
const char *savedir);
630 static int uninstallOpType(
const char *
path,
631 const char *tablename,
const char *opname,
632 const char *indexpath,
const char *indexfile);
634 static void removeHelpCardOverrides(
UT_FileUtil *fu,
635 const char *
path,
const char *tablename,
636 const char *opname,
int flags);
638 const char *
path,
const char *tablename,
639 const char *opname,
int flags);
641 const char *
path,
const char *tablename,
642 const char *opname,
int flags);
644 const char *
path,
const char *tablename,
645 const char *opname,
int flags);
647 static void getDefaultIconName(
const char *tablename,
654 const char *getTableName()
const;
670 void setDefinition(
const char *def);
672 void setEnglish(
const char *english);
676 void informOfTabMenuFlagChange();
680 virtual void setName(
const char *name);
691 void setMinInputs(
int inputs);
692 void setMaxInputs(
int inputs);
693 void setIsGenerator(
bool isgen);
697 void updatePresetInfo();
717 bool full_path =
false,
719 bool *node_deleted_by_script =
nullptr);
725 {
return myPythonModuleDicts; }
727 {
return myHasLoadedPythonModuleSection; }
728 void loadPythonModuleSection(
bool force=
false);
731 {
return myViewerStateModuleDicts; }
733 {
return myHasLoadedViewerStateModuleSection; }
734 void loadViewerStateModuleSection(
bool force=
false);
737 {
return myViewerHandleModuleDicts; }
739 {
return myHasLoadedViewerHandleModuleSection; }
740 void loadViewerHandleModuleSection(
bool force=
false);
743 void clearEventScriptPathCache();
746 void getCachedEventScriptPaths(
749 bool only_nonempty)
const;
755 {
return myIsThreadSafe; }
760 { myIsThreadSafe = is_safe; }
762 static const char *getCurrentPythonModuleKey();
763 static const OP_Operator *mapSecurityKeyToOperator(
const char *key);
764 static void registerPythonModuleKeyClient(
void *client);
765 static bool verifyPythonModuleKeyClient(
787 void notifyUpdateTemplatesSinksOfUpdate();
789 void notifyUpdateTemplatesSinksOfDelete();
792 void notifyActiveNodesOfTemplatesUpdate();
801 { myDescriptiveParmName = parm; }
803 void dirtyParmTemplatesLoaded();
805 virtual bool loadParmTemplatesSubclass();
808 bool loadAndCreateLayoutParmTemplates(
815 int base_controls_switcher_index,
816 int base_controls_insert_index,
817 int base_controls_switcher_page_num,
819 bool hide_default_parms);
860 void getContentSectionTypeNames(
UT_IStream &is,
864 static void handleDefiningNetworkChange(
OP_Node *caller,
876 bool &node_deleted_by_script,
878 void runHscriptEventScript(
880 const char *script_path,
883 const char *extra_args);
884 void runPythonEventScript(
886 const char *script_path,
888 const char *kwargs_dict,
890 const char *script_source);
892 void formatErrorSource(
899 OP_EventScriptPathCache *getEventScriptPathCache();
903 void loadOverrideLayoutParmTemplates();
905 void ensureParmTemplatesLoaded();
917 OP_EventScriptPathCache *myEventScriptPathCache;
919 bool myChangingParmTemplates;
920 bool myRefreshingLib;
921 bool myDestroyingSelf;
922 int myLoadingContentsSectionCount;
927 bool myHasLoadedPythonModuleSection;
930 bool myHasLoadedViewerStateModuleSection;
933 bool myHasLoadedViewerHandleModuleSection;
946 void updateCachedOpSectionData();
950 friend class SHOP_ScriptOperator;
954 static int ourLastHelpLevel;
956 static bool ourHelpIsHtml;
964 { removeAllTemplatesSinks(); }
966 virtual void templatesUpdated(
OP_Operator *op) = 0;
968 { removeUpdateTemplatesSink(op); }
974 op->addUpdateTemplatesSink(
this);
975 myOperators.append(op, 1);
979 return myOperators.find(op) >= 0;
984 op->removeUpdateTemplatesSink(
this);
985 myOperators.findAndRemove(op);
989 for(
int i = myOperators.entries(); i --> 0; )
990 removeUpdateTemplatesSink(myOperators(i));
unsigned maxInputs() const
virtual ~OP_SpecificData()
unsigned minInputs() const
PRM_ScriptImports * myLayoutParmImports
int getVersion(int version)
std::function< OP_Ptr(OP_Network *, const char *, OP_Operator *)> OP_Constructor
GT_API const UT_StringHolder filename
virtual ~OP_UpdateTemplatesSink()
bool getScriptIsSubnet() const
UT_StringArray myInputLabels
const OP_OTLDefinition & getOTLDefinition() const
void setIsThreadSafe(bool is_safe)
void getTableAndName(UT_String &name) const
bool shouldPreserve() const
static void clearOperatorHelpCache()
CH_LocalVariable * myVariables
bool getScriptIsRsl() const
PRM_Template * myBaseOverrideLayout
GLsizei const GLchar *const * path
#define OP_FLAG_NETWORK
Flags passed to the contructor:
const UT_StringHolder & getExtraInfo() const
VEX_ContextType getVexContextType() const
int getVariableCount() const
OP_OTLDefinition myOTLDefinition
virtual void getRefreshPICommands(OP_Node *, std::ostream &)
bool isManagementOp() const
#define OP_FLAG_GENERATOR
GLboolean GLboolean GLboolean GLboolean a
void removeAllTemplatesSinks()
void removeUpdateTemplatesSink(OP_Operator *op)
void setNumOrderedInputs(int inputs)
PY_EvaluationContext * getViewerHandleModuleDicts()
UT_StringArray myInputNames
UT_StringHolder myChildTableName
#define OP_FLAG_PRIMARYSUBNET
const UT_StringArray & getOutputLabels() const
bool hasLoadedViewerStateModuleSection() const
UT_Array< bool > myInputReferences
const UT_StringHolder & getName() const
virtual void updateExtraInfoBuffer(OP_ExtraInfoBuffer &b) const
bool myHasContentsSection
bool isScriptedOp() const
virtual bool getHDKHelp(UT_String &) const
const OP_ExtraInfoBuffer & getExtraInfoBuffer() const
const UT_StringHolder & getIndexFile() const
FS_IndexFile * getOTLIndexFile(bool check_timestamp=true)
#define OP_FLAG_SCRIPTDEF
virtual const OP_SpecificData * getOpSpecificData() const
static int operatorNameCompare(const OP_Operator *a, const OP_Operator *b)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
bool getIsPrimarySubnetType() const
bool isCreatingNode() const
bool hasLoadedViewerHandleModuleSection() const
int numOrderedInputs() const
void setInputDataEditorConfigEx(const OP_InputDataEditorConfigEx &config)
UT_DeepString myTabSubmenuPath
PRM_Template * myLayoutParmTemplates
bool hasLoadedPythonModuleSection() const
bool isChangingParmTemplates() const
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
UT_StringHolder myOverriddenOperatorName
PY_EvaluationContext * getViewerStateModuleDicts()
void setScriptIsPython(bool is_python)
UT_StringArray myOutputLabels
time_t getModTime() const
GLuint const GLchar * name
bool isThreadSafe() const
const UT_StringArray & getInputLabels() const
Accessing operator inputs name, label, and reference flag.
RSL_ContextType getRslContextType() const
GLboolean GLboolean GLboolean b
void setDescriptiveParmName(const UT_StringHolder &parm)
void setObsoleteTemplates(PRM_Template *tmpl)
PRM_Template * getBaseOverrideLayoutParmTemplates()
void beginLoadingContentsSectionForNode()
GT_API const UT_StringHolder version
PRM_Template * myObsoleteTemplates
A map of string to various well defined value types.
void getTableAndName(UT_WorkBuffer &name) const
const UT_StringArray & getInputNames() const
Accessing operator inputs name, label, and reference flag.
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
UT_ValArray< OP_Operator * > OP_OperatorList
SIM_API const UT_StringHolder force
virtual unsigned maxOutputs()
bool hasTemplatesSink(OP_Operator *op)
#define OP_FLAG_UNORDERED
PRM_Template * myParmTemplates
void endLoadingContentsSectionForNode()
VEX_ContextType myVexContextType
OP_OTLLibrary * getOTLLibrary()
CH_LocalVariable * getVariables() const
virtual OP_SpecificData * getOpSpecificData()
const UT_StringHolder & getIndexPath() const
bool getScriptIsVex() const
RSL_ContextType
RenderMan shader context types.
#define OP_FLAG_EDITABLE_INPUT_DATA
bool myParmTemplatesLoaded
UT_SharedPtr< PRM_ScriptPage > myOverrideLayoutParmScriptPage
bool getIsDummyDefinition() const
virtual void operatorDeleted(OP_Operator *op)
const UT_Array< bool > & getInputAreReferences() const
Accessing operator inputs name, label, and reference flag.
PRM_ScriptImports * myImports
virtual PRM_Template * getObsoleteTemplates()
const OP_InputDataEditorConfigEx & getInputDataEditorConfigEx() const
PY_EvaluationContext * getPythonModuleDicts()
virtual const PRM_Template * getBaseParmTemplates()
void addUpdateTemplatesSink(OP_Operator *op)
bool getScriptIsPython() const
const UT_StringHolder & getEnglish() const
OP_InputDataEditorConfigEx myInputDataEditorConfig
RSL_ContextType myRslContextType
bool hasNodeLoadingContentsSection() const
bool unorderedInputs() const
void setOTLLibrary(OP_OTLLibrary *library)
bool hasEditableInputData() const