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);
186 const char *metasrcbase,
187 bool changeoplibraries,
188 bool installinternaliffail,
194 int findLibrary(
const char *libfile,
195 const char *metasrc = 0)
const;
196 int findNextLibrary(
const char *libfile,
198 bool refreshLibrary(
int index,
bool force =
true);
199 bool removeLibrary(
const char *libfile,
201 bool changeoplibraries);
209 bool changeoplibraries);
211 bool removeMetaSource(
const char *metasrc);
214 void refreshAll(
bool reloadOpLibraries);
222 bool changeoplibraries,
223 bool installinternaliffail,
227 int getNumLibraries()
const;
228 int getPreferredLibrary(
const char *tablename,
234 int getLatestLibrary(
const char *tablename,
241 int getNextLibrary(
const char *tablename,
250 bool dummydefinition =
false);
251 bool addToLibrary(
const char *libfile,
254 bool dummydefinition =
false,
255 bool create_op_type=
false,
256 bool create_backup=
true);
260 bool mergeLibraries(
const char *primary,
261 const char *secondary,
269 bool addToInternalLibrary(
UT_IStream &is, time_t modtime);
274 bool removeFromLibrary(
const char *libfile,
279 bool touchDefinition(
const char *libfile,
280 const char *tablename,
287 static void modifyDefinitionToInternalPaths(
302 bool compilechannels,
303 bool compilenodenames,
305 bool blackbox =
false);
317 bool blackbox =
false);
326 void setComment(
FS_IndexFile *deffile,
const char *comment);
331 void listLibraries(std::ostream &os)
const;
332 void listLibrariesWithDefinition(
const char *tablename,
334 std::ostream &os)
const;
335 void listOperators(
const char *libfile,
336 std::ostream &os)
const;
337 void listOperator(
const char *libfile,
338 const char *tablename,
341 std::ostream &os)
const;
345 void getLibrariesWithDefinition(
346 const char *tablename,
362 bool getAllMatchingOperators(
const char *opmask,
373 bool checkValidNodeName(
const char *
name,
378 const char *installpath,
379 const char *extradsinfo,
380 const char *installmetasrc,
383 bool create_backup=
true);
387 bool createOptype(
const char *tablename,
390 const char *installpath,
391 int min_input,
int max_input,
393 const char *extradsinfo,
394 const char *installmetasrc,
395 const char *extrainfo,
398 bool create_backup=
true);
400 static bool getHelpTemplateFile(
UT_String &helptemplatefile);
401 static void createDefaultOptypeName(
OP_Node *fromnode,
404 static void createOptypeLabelFromName(
UT_String name,
406 static void createOptypeNameFromLabel(
UT_String label,
408 static void fullyQualifyLibFileName(
const char *libfilebase,
410 const char *basedir = 0);
411 void fullyQualifyMetaSrcName(
const char *libfilebase,
413 void getSimplifiedPath(
UT_String &destpath,
415 const char *srcmeta)
const;
417 bool canSavePreferences()
const;
427 void pushFallbackLibraryContext();
428 void popFallbackLibraryContext();
429 void saveFallbackLibraryPaths(std::ostream &os,
431 bool loadFallbackLibraryPaths(
UT_IStream &is);
432 bool loadFallbackLibrary(
const char *tablename,
445 bool loadDummyDefinitions(
UT_IStream &is, time_t modtime);
446 void saveDummyDefinitions(std::ostream &os,
450 static void saveDefaultDialogScript(std::ostream &os,
453 const char *extradsinfo);
455 static void saveDefaultCreationScript(std::ostream &os,
462 static void writeOutDefinitionContents(
473 void refreshLicenses();
479 const UT_String &getInternalTempFile()
const;
492 {mySaveOpTypeCallback = cb;}
495 bool convertLibraryToFile(
const char *libfilebase,
496 const char *metasrcbase);
497 bool convertLibraryToDir(
const char *libfilebase,
498 const char *metasrcbase);
501 struct OTLFallbackData
511 friend class RefreshScope;
514 void notifySinksOfAssetCreated(
517 void notifySinksOfAssetDeleted(
520 void notifySinksOfAssetSaved(
523 void notifySinksOfBeforeAssetCreated(
526 void notifySinksOfBeforeAssetDeleted(
529 void notifySinksOfBeforeAssetSaved(
533 void notifySinksOfLibraryUninstalled(
535 void notifySinksOfDefinitionsAdded(
int libindex,
537 void notifySinksOfDefinitionsRemoved(
int libindex,
540 void notifySinksOfSourceNamesChanged();
543 void notifySinksOfConfigurationChanged();
544 void notifySinksOfLicensesChanged();
545 void writeSimplifiedPath(std::ostream &os,
548 const char *prefix = 0)
const;
551 void setMetaSourceNameData(
int pos,
const char *metasrc,
552 const char *metasrcname);
557 bool saveMetaFile(
const char *metafile,
559 const char *addlib)
const;
563 int addToMetaSource(
const char *libfile,
565 bool changeoplibraries);
573 bool removeLibrary(
int index,
bool external=
false);
575 void loadPreferences();
576 void savePreferences();
578 void moveInternalToNewTempFile();
583 bool removeFromExternalLibrary(
const char *libfile,
591 bool backupAndWriteNewLibrary(
const char *libfilebase,
598 bool touchExternalDefinition(
const char *libfile,
599 const char *tablename,
602 bool touchInternalDefinition(
const char *tablename,
606 void addFromOpLibrariesFile(
const char *file,
611 void setLibraryPreference(
const char *tablename,
617 void addFallbackLibraryPath(
const char *tablename,
619 const char *libfile);
621 const char *opsymbol,
622 const char *tablename,
633 static void deleteLibraries(
void *
data);
651 int myPerformingRefreshAll;
652 bool myIsPerformingAtomicAddRemove;
653 bool mySaveToHipFile;
654 bool mySaveUnlockedToHipFile;
655 bool myWarnOutOfDateOps;
656 bool myWarnDummyOpsOnLoad;
657 bool myPreferLatestDateDefinition;
658 bool myPreferInternalDefinition;
659 bool myPreferIndexFileDefinition;
660 bool myCreateBackups;
661 bool mySafeguardOpDefs;
662 bool myLeaveDefaultsUnchanged;
663 bool myUseOplibrariesFiles;
664 bool myIsCreatingNewHDA;
675 { removeAllManagerSinks(); }
736 { removeManagerSink(manager); }
741 if( !manager )
return;
745 if (myManagers.find(manager) != -1)
749 myManagers.append(manager, 1);
753 if( !manager )
return;
755 myManagers.findAndRemove(manager);
759 for(
int i = myManagers.entries(); i --> 0; )
760 removeManagerSink(myManagers(i));
void removeManagerSink(OP_OTLManagerSink *sink)
int getVersion(int version)
GLsizei GLenum const void * indices
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.