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
119 virtual void saveToDialogScript(std::ostream &os)
const = 0;
147 unsigned min_sources,
148 unsigned max_sources = 9999,
151 const char **inputlabels = 0,
153 const char *tab_submenu_path = 0);
159 unsigned min_sources,
160 unsigned max_sources = 9999,
163 const char **inputlabels = 0,
165 const char *tab_submenu_path = 0);
171 const char *child_table_name,
172 unsigned min_sources,
173 unsigned max_sources = 9999,
176 const char **inputlabels = 0,
178 const char *tab_submenu_path = 0);
184 const char *child_table_name,
185 unsigned min_sources,
186 unsigned max_sources = 9999,
189 const char **inputlabels = 0,
191 const char *tab_submenu_path = 0);
196 int getNumActiveNodes()
const;
197 OP_Node *getActiveNode(
int i)
const;
198 void nodeDestroyed(
OP_Node *node);
209 {
return myOTLDefinition.getName(); }
216 { myOTLDefinition.getTableAndName(name); }
218 { myOTLDefinition.getTableAndName(name); }
221 {
return myOTLDefinition.getLabel(); }
222 virtual UT_Color getDefaultColor()
const;
228 virtual bool getOpHelpURL(
UT_String &url);
229 virtual bool getOpTabSubMenuPath(
UT_String &tab_submenu_path);
230 void setOpTabSubMenuPath(
const char *tab_submenu_path);
235 void getDiveTarget(
UT_String &divetarget);
236 void getDescriptiveParmName(
UT_String &descrparm);
237 void getDefaultState(
UT_String &statename);
238 void getFunctionName(
UT_String &function_name);
239 void getSecondaryFunctionsNames(
252 void getHelpFileDirAndName(
UT_String & script_dir,
255 void getDefinitionSource(
UT_String &defsource)
const;
258 { ourLastHelpOp = 0; }
259 OP_Node *getDefiningNetwork()
const;
265 {
return myOTLDefinition.getIndexPath(); }
267 {
return myOTLDefinition.getIndexFile(); }
269 {
return myOTLDefinition.getIsSubnet(); }
275 {
return myVexContextType; }
277 {
return myRslContextType; }
279 {
return myOTLDefinition.getModTime(); }
281 {
return myOTLDefinition.getIsDummyDefinition(); }
285 {
return myOTLDefinition.getIsPython(); }
287 { myOTLDefinition.setIsPython(is_python); }
291 {
return myOTLDefinition.getExtraInfo(); }
296 {
return myOTLDefinition; }
300 { myOTLLibrary = library; }
302 {
return myOTLLibrary; }
306 virtual bool hasSectionData(
const UT_StringRef &name)
const;
308 bool hasContentsSection();
312 {
return getOTLIndexFilePtr(check_timestamp).get(); }
322 virtual void clearOTLIndexFile();
328 FS_IndexFile *createOTLIndexFile(
bool reservedsectionsonly,
333 void getDefinitionSectionName(
UT_String §name)
const;
347 const char *opdef_or_oplib,
348 const char *section_name)
const;
350 const char *opdef_or_oplib,
356 void listContainedOperators(
UT_StringSet &contents_list);
360 const char *getIconName()
const;
361 void setIconName(
const char *name);
362 void setDefaultIconName();
365 {
return myOTLDefinition.getMinInputs(); }
367 {
return myOTLDefinition.getMaxInputs(); }
379 void setLegacyInputsMap(
const char *map);
380 void getLegacyInputsMap(
UT_String &map)
const;
388 return isManagementOp()
390 : myOTLDefinition.getMaxOutputs();
395 virtual bool hasLoadedParmTemplates()
const;
396 virtual int updateParmTemplates();
399 virtual void forceUpdateParmTemplates();
425 {
return myBaseOverrideLayout; }
428 {
return myObsoleteTemplates; }
430 { myObsoleteTemplates = tmpl; }
436 bool getOverrideLayoutParmTemplateFile(
458 bool isCustomDSO()
const;
484 return myCreatingNode;
488 return myChangingParmTemplates;
492 return myLoadingContentsSectionCount > 0;
496 myLoadingContentsSectionCount++;
500 myLoadingContentsSectionCount--;
508 return getNumActiveNodes() > 0 || myRefreshingLib;
512 OP_COMPARE_GEN_ENGLISH = 0,
513 OP_COMPARE_GEN_NAME = 1,
514 OP_COMPARE_ENGLISH = 2,
520 virtual int compareOperator(
const OP_Operator *other,
529 {
return myInputNames; }
532 {
return myInputLabels; }
533 bool getInputIsReference(
int idx)
const;
535 {
return myInputReferences; }
536 virtual bool allowsInputNameEditing()
const;
541 {
return myOutputLabels; }
544 unsigned getPermissionMask()
const;
552 virtual bool wantsParametersAnimatable()
const;
555 virtual bool wantsInputEditor()
const;
558 virtual bool wantsParmOrderEditor()
const;
561 virtual bool wantsOutputNameEditor()
const;
564 virtual bool wantsParentInputs()
const;
568 {
return myInputDataEditorConfig; }
571 { myInputDataEditorConfig = config; }
572 void setInputDataEditorConfig(
577 virtual const char *getOperatorShortHelpString();
582 virtual void getOperatorSpecificInfoText(
int verbose,
594 virtual void fillInfoTreeOperatorSpecific(
UT_InfoTree &tree,
598 static int loadFromOpType(
const char *fname,
const char *savedir);
599 static int uninstallOpType(
const char *
path,
600 const char *tablename,
const char *opname,
601 const char *indexpath,
const char *indexfile);
603 static void removeHelpCardOverrides(
UT_FileUtil *fu,
604 const char *
path,
const char *tablename,
605 const char *opname,
int flags);
607 const char *
path,
const char *tablename,
608 const char *opname,
int flags);
610 const char *
path,
const char *tablename,
611 const char *opname,
int flags);
613 const char *
path,
const char *tablename,
614 const char *opname,
int flags);
616 static void getDefaultIconName(
const char *tablename,
623 const char *getTableName()
const;
639 void setDefinition(
const char *def);
641 void setEnglish(
const char *english);
645 void informOfTabMenuFlagChange();
649 virtual void setName(
const char *name);
660 void setMinInputs(
int inputs);
661 void setMaxInputs(
int inputs);
662 void setIsGenerator(
bool isgen);
666 void updatePresetInfo();
686 bool full_path =
false,
688 bool *node_deleted_by_script =
nullptr);
694 {
return myPythonModuleDicts; }
696 {
return myHasLoadedPythonModuleSection; }
697 void loadPythonModuleSection(
bool force=
false);
700 {
return myViewerStateModuleDicts; }
702 {
return myHasLoadedViewerStateModuleSection; }
703 void loadViewerStateModuleSection(
bool force=
false);
706 void clearEventScriptPathCache();
709 void getCachedEventScriptPaths(
712 bool only_nonempty)
const;
718 {
return myIsThreadSafe; }
723 { myIsThreadSafe = is_safe; }
725 static const char *getCurrentPythonModuleKey();
726 static const OP_Operator *mapSecurityKeyToOperator(
const char *key);
727 static void registerPythonModuleKeyClient(
void *client);
728 static bool verifyPythonModuleKeyClient(
750 void notifyUpdateTemplatesSinksOfUpdate();
752 void notifyUpdateTemplatesSinksOfDelete();
755 void notifyActiveNodesOfTemplatesUpdate();
764 { myDescriptiveParmName = parm; }
766 void dirtyParmTemplatesLoaded();
768 virtual bool loadParmTemplatesSubclass();
771 bool loadAndCreateLayoutParmTemplates(
778 int base_controls_switcher_index,
779 int base_controls_insert_index,
780 int base_controls_switcher_page_num,
782 bool hide_default_parms);
822 void getContentSectionTypeNames(
UT_IStream &is,
826 static void handleDefiningNetworkChange(
OP_Node *caller,
838 bool &node_deleted_by_script,
840 void runHscriptEventScript(
842 const char *script_path,
845 const char *extra_args);
846 void runPythonEventScript(
848 const char *script_path,
850 const char *kwargs_dict,
852 const char *script_source);
854 void formatErrorSource(
861 OP_EventScriptPathCache *getEventScriptPathCache();
865 void loadOverrideLayoutParmTemplates();
867 void ensureParmTemplatesLoaded();
879 OP_EventScriptPathCache *myEventScriptPathCache;
881 bool myChangingParmTemplates;
882 bool myRefreshingLib;
883 bool myDestroyingSelf;
884 int myLoadingContentsSectionCount;
889 bool myHasLoadedPythonModuleSection;
892 bool myHasLoadedViewerStateModuleSection;
905 friend class SHOP_ScriptOperator;
909 static int ourLastHelpLevel;
911 static bool ourHelpIsHtml;
919 { removeAllTemplatesSinks(); }
921 virtual void templatesUpdated(
OP_Operator *op) = 0;
923 { removeUpdateTemplatesSink(op); }
929 op->addUpdateTemplatesSink(
this);
930 myOperators.append(op, 1);
934 return myOperators.find(op) >= 0;
939 op->removeUpdateTemplatesSink(
this);
940 myOperators.findAndRemove(op);
944 for(
int i = myOperators.entries(); i --> 0; )
945 removeUpdateTemplatesSink(myOperators(i));
unsigned maxInputs() const
virtual ~OP_SpecificData()
unsigned minInputs() const
PRM_ScriptImports * myLayoutParmImports
int getVersion(int version)
GT_API const UT_StringHolder filename
virtual ~OP_UpdateTemplatesSink()
bool getScriptIsSubnet() const
UT_StringArray myInputLabels
const OP_OTLDefinition & getOTLDefinition() const
GLuint const GLchar * name
unsigned unorderedInputs() 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
GLboolean GLboolean GLboolean GLboolean a
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
#define OP_FLAG_NETWORK
Flags passed to the contructor:
const UT_StringHolder & getExtraInfo() const
unsigned isOutputOp() const
VEX_ContextType getVexContextType() const
int getVariableCount() const
OP_OTLDefinition myOTLDefinition
virtual void getRefreshPICommands(OP_Node *, std::ostream &)
#define OP_FLAG_GENERATOR
void removeAllTemplatesSinks()
void removeUpdateTemplatesSink(OP_Operator *op)
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
virtual bool getHDKHelp(UT_String &) 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)
unsigned isManagementOp() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
bool getIsPrimarySubnetType() const
GLint GLenum GLsizei GLint GLsizei const void * data
bool isCreatingNode() const
void setInputDataEditorConfigEx(const OP_InputDataEditorConfigEx &config)
UT_DeepString myTabSubmenuPath
unsigned isNetwork() const
PRM_Template * myLayoutParmTemplates
bool hasLoadedPythonModuleSection() const
bool isChangingParmTemplates() const
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
PY_EvaluationContext * getViewerStateModuleDicts()
void setScriptIsPython(bool is_python)
UT_StringArray myOutputLabels
bool isThreadSafe() const
const UT_StringArray & getInputLabels() const
Accessing operator inputs name, label, and reference flag.
RSL_ContextType getRslContextType() const
void setDescriptiveParmName(const UT_StringHolder &parm)
GLuint GLuint GLsizei GLenum type
void setObsoleteTemplates(PRM_Template *tmpl)
PRM_Template * getBaseOverrideLayoutParmTemplates()
void beginLoadingContentsSectionForNode()
OP_Node *(* OP_Constructor)(OP_Network *, const char *, OP_Operator *)
GT_API const UT_StringHolder version
PRM_Template * myObsoleteTemplates
GLsizei const GLchar *const * path
GLdouble GLdouble GLdouble b
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
virtual unsigned maxOutputs()
bool hasTemplatesSink(OP_Operator *op)
#define OP_FLAG_UNORDERED
unsigned isScriptedOp() const
PRM_Template * myParmTemplates
void endLoadingContentsSectionForNode()
VEX_ContextType myVexContextType
OP_OTLLibrary * getOTLLibrary()
CH_LocalVariable * getVariables() const
unsigned isGenerator() 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()
GLsizei const GLfloat * value
void addUpdateTemplatesSink(OP_Operator *op)
bool getScriptIsPython() const
const UT_StringHolder & getEnglish() const
OP_InputDataEditorConfigEx myInputDataEditorConfig
RSL_ContextType myRslContextType
bool hasNodeLoadingContentsSection() const
void setOTLLibrary(OP_OTLLibrary *library)
bool hasEditableInputData() const
GLenum const void * paths