12 #ifndef __OP_OTLManager__
13 #define __OP_OTLManager__
39 #define OP_TYPEBARMODE_FULLMENU "fullmenu"
40 #define OP_TYPEBARMODE_AUTOMENU "automenu"
41 #define OP_TYPEBARMODE_DISPLAYONLY "displayonly"
42 #define OP_TYPEBARMODE_NONE "none"
47 #define OP_IS_OTL_COMPILED "nodeconntype"
53 #define OP_IS_OTL_BLACKBOXED "nodeparmtype"
65 virtual bool onOTLLoadBegin(
const char* otl_name,
78 bool getSaveToHipFile()
const;
79 void setSaveToHipFile(
bool savetohip);
80 bool getSaveUnlockedToHipFile()
const;
81 void setSaveUnlockedToHipFile(
bool saveunlockedtohip);
82 bool getWarnOutOfDateOps()
const;
83 void setWarnOutOfDateOps(
bool warn);
84 bool getWarnDummyOpsOnLoad()
const;
85 void setWarnDummyOpsOnLoad(
bool warn);
86 bool getPreferLatestDate()
const;
87 void setPreferLatestDate(
bool preferlatest);
88 bool getPreferInternal()
const;
89 void setPreferInternal(
bool preferinternal);
90 bool getPreferIndexFile()
const;
91 void setPreferIndexFile(
bool preferindexfile);
92 bool getCreateBackups()
const;
93 void setCreateBackups(
bool createbackups);
94 bool getSafeguardOpDefs()
const;
95 void setSafeguardOpDefs(
bool safeguardopdefs);
96 bool getLeaveDefaultsUnchanged()
const;
97 void setLeaveDefaultsUnchanged(
bool leavedefaultsunchanged);
98 bool getUseOplibrariesFiles()
const;
99 void setUseOplibrariesFiles(
bool useoplibrariesfiles);
109 bool runOTLCallbacks(
const char* otl_name,
118 void clearFailedOTLList();
124 const char *metasrc,
int &libpos);
128 bool saveInternalMetaFile(std::ostream &os,
129 const char *prefix = 0)
const;
137 void setLibraryPreference(
const char *tablename,
139 const char *libfile);
144 void setLibraryPreferencesIfRequired(
int index);
147 const char *getLibraryPreference(
const char *tablename,
148 const char *opname)
const;
150 void clearLibraryPreferences(
bool refreshlibs);
153 void saveLibraryPreferences(std::ostream &os,
154 bool includeinternal =
true,
155 bool protectstrings =
false)
const;
159 bool withpath =
true)
const;
160 void getMetaSourceName(
const char *metasrc,
162 bool withpath =
true)
const;
163 bool setMetaSourceName(
const char *metasrc,
164 const char *metasrcname);
169 bool getIsPerformingAtomicAddRemove()
const;
174 bool getIsPerformingRefreshAll()
const;
177 bool getIsCreatingNewHDA()
const;
181 void installLibrary(
char const* lib_filepath,
char const* oplib_filepath=
nullptr);
183 int findLibrary(
const char *libfile,
184 const char *metasrc = 0)
const;
185 int findNextLibrary(
const char *libfile,
187 bool refreshLibrary(
int index,
bool force =
true);
188 bool removeLibrary(
const char *libfile,
190 bool changeoplibraries);
191 bool removeMetaSource(
const char *metasrc);
192 void refreshAll(
bool reloadOpLibraries);
200 bool changeoplibraries,
201 bool installinternaliffail,
205 int getNumLibraries()
const;
206 int getPreferredLibrary(
const char *tablename,
212 int getLatestLibrary(
const char *tablename,
219 int getNextLibrary(
const char *tablename,
228 bool dummydefinition =
false);
229 bool addToLibrary(
const char *libfile,
232 bool dummydefinition =
false,
233 bool create_op_type=
false,
234 bool create_backup=
true);
238 bool mergeLibraries(
const char *primary,
239 const char *secondary,
247 bool addToInternalLibrary(
UT_IStream &is, time_t modtime);
252 bool removeFromLibrary(
const char *libfile,
257 bool touchDefinition(
const char *libfile,
258 const char *tablename,
265 static void modifyDefinitionToInternalPaths(
280 bool compilechannels,
281 bool compilenodenames,
283 bool blackbox =
false);
295 bool blackbox =
false);
304 void setComment(
FS_IndexFile *deffile,
const char *comment);
309 void listLibraries(std::ostream &os)
const;
310 void listLibrariesWithDefinition(
const char *tablename,
312 std::ostream &os)
const;
313 void listOperators(
const char *libfile,
314 std::ostream &os)
const;
315 void listOperator(
const char *libfile,
316 const char *tablename,
319 std::ostream &os)
const;
323 void getLibrariesWithDefinition(
324 const char *tablename,
340 bool getAllMatchingOperators(
const char *opmask,
351 bool checkValidNodeName(
const char *
name,
356 const char *installpath,
357 const char *extradsinfo,
358 const char *installmetasrc,
361 bool create_backup=
true);
365 bool createOptype(
const char *tablename,
368 const char *installpath,
369 int min_input,
int max_input,
371 const char *extradsinfo,
372 const char *installmetasrc,
373 const char *extrainfo,
376 bool create_backup=
true);
378 static bool getHelpTemplateFile(
UT_String &helptemplatefile);
379 static void createDefaultOptypeName(
OP_Node *fromnode,
382 static void createOptypeLabelFromName(
UT_String name,
384 static void createOptypeNameFromLabel(
UT_String label,
386 static void fullyQualifyLibFileName(
const char *libfilebase,
388 const char *basedir = 0);
389 void fullyQualifyMetaSrcName(
const char *libfilebase,
391 void getSimplifiedPath(
UT_String &destpath,
393 const char *srcmeta)
const;
395 bool canSavePreferences()
const;
405 void pushFallbackLibraryContext();
406 void popFallbackLibraryContext();
407 void saveFallbackLibraryPaths(std::ostream &os,
409 bool loadFallbackLibraryPaths(
UT_IStream &is);
410 bool loadFallbackLibrary(
const char *tablename,
423 bool loadDummyDefinitions(
UT_IStream &is, time_t modtime);
424 void saveDummyDefinitions(std::ostream &os,
428 static void saveDefaultDialogScript(std::ostream &os,
431 const char *extradsinfo);
433 static void saveDefaultCreationScript(std::ostream &os,
440 static void writeOutDefinitionContents(
451 void refreshLicenses();
457 const UT_String &getInternalTempFile()
const;
470 {mySaveOpTypeCallback = cb;}
473 bool convertLibraryToFile(
const char *libfilebase,
474 const char *metasrcbase);
475 bool convertLibraryToDir(
const char *libfilebase,
476 const char *metasrcbase);
479 struct OTLFallbackData
489 friend class RefreshScope;
492 void notifySinksOfAssetCreated(
495 void notifySinksOfAssetDeleted(
498 void notifySinksOfAssetSaved(
501 void notifySinksOfBeforeAssetCreated(
504 void notifySinksOfBeforeAssetDeleted(
507 void notifySinksOfBeforeAssetSaved(
511 void notifySinksOfLibraryUninstalled(
513 void notifySinksOfDefinitionsAdded(
int libindex,
515 void notifySinksOfDefinitionsRemoved(
int libindex,
518 void notifySinksOfSourceNamesChanged();
521 void notifySinksOfConfigurationChanged();
522 void notifySinksOfLicensesChanged();
523 void writeSimplifiedPath(std::ostream &os,
526 const char *prefix = 0)
const;
529 void setMetaSourceNameData(
int pos,
const char *metasrc,
530 const char *metasrcname);
535 bool saveMetaFile(
const char *metafile,
537 const char *addlib)
const;
541 int addToMetaSource(
const char *libfile,
543 bool changeoplibraries);
551 bool removeLibrary(
int index,
bool external=
false);
553 void loadPreferences();
554 void savePreferences();
556 void moveInternalToNewTempFile();
561 bool removeFromExternalLibrary(
const char *libfile,
569 bool backupAndWriteNewLibrary(
const char *libfilebase,
576 bool touchExternalDefinition(
const char *libfile,
577 const char *tablename,
580 bool touchInternalDefinition(
const char *tablename,
584 void addFromOpLibrariesFile(
const char *file,
589 void setLibraryPreference(
const char *tablename,
595 void addFallbackLibraryPath(
const char *tablename,
597 const char *libfile);
599 const char *opsymbol,
600 const char *tablename,
611 static void deleteLibraries(
void *
data);
629 int myPerformingRefreshAll;
630 bool myIsPerformingAtomicAddRemove;
631 bool mySaveToHipFile;
632 bool mySaveUnlockedToHipFile;
633 bool myWarnOutOfDateOps;
634 bool myWarnDummyOpsOnLoad;
635 bool myPreferLatestDateDefinition;
636 bool myPreferInternalDefinition;
637 bool myPreferIndexFileDefinition;
638 bool myCreateBackups;
639 bool mySafeguardOpDefs;
640 bool myLeaveDefaultsUnchanged;
641 bool myUseOplibrariesFiles;
642 bool myIsCreatingNewHDA;
653 { removeAllManagerSinks(); }
714 { removeManagerSink(manager); }
719 if( !manager )
return;
723 if (myManagers.find(manager) != -1)
727 myManagers.append(manager, 1);
731 if( !manager )
return;
733 myManagers.findAndRemove(manager);
737 for(
int i = myManagers.entries(); i --> 0; )
738 removeManagerSink(myManagers(i));
void removeManagerSink(OP_OTLManagerSink *sink)
int getVersion(int version)
GLuint GLsizei const GLchar * label
void addManagerSink(OP_OTLManager *manager)
virtual void libraryInstalled(const OP_OTLLibrary *library)
virtual void libraryRemoved(OP_OTLLibrary *)
virtual ~OP_OTLLoadCallback()
virtual void definitionsRemoved(int, UT_IntArray &, OP_OTLLibrary *&)
**But if you need a result
virtual void licensesChanged()
void removeManagerSink(OP_OTLManager *manager)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
void removeAllManagerSinks()
virtual void libraryAdded(OP_OTLLibrary *)
void managerDeleted(OP_OTLManager *manager)
virtual ~OP_OTLManagerSink()
void setSaveOpTypeCallback(OP_SaveOpTypeCallback cb)
Only called by FUSE_AssetsMenu to clean dirty flags of assets.
GLint GLint GLsizei GLint GLenum format
OPENVDB_API void setVersion(std::ios_base &, const VersionId &libraryVersion, uint32_t fileVersion)
Associate specific file format and library version numbers with the given stream. ...
virtual void assetSaved(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
Called when an asset definition is saved.
GLuint const GLchar * name
GLenum GLenum GLsizei void * table
void addManagerSink(OP_OTLManagerSink *sink)
Functions for handling our interests.
virtual void configurationChanged()
GT_API const UT_StringHolder version
virtual void beforeAssetDeleted(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
Called right before an asset definition is removed from a library.
SIM_API const UT_StringHolder force
virtual void assetDeleted(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
void(* OP_SaveOpTypeCallback)(OP_Node *)
virtual void libraryUninstalled(const OP_OTLLibrary *library)
virtual void sourceNamesChanged()
virtual void assetCreated(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
virtual void definitionsAdded(int, UT_IntArray &)
virtual void beforeAssetCreated(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
Called right before an asset definition is created.
virtual void beforeAssetSaved(const OP_OTLLibrary &library, const OP_OTLDefinition &def)
Called right before an asset definition is saved.