Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi I have a python startup plugin that sets texture paths in Prefs>File Assets! with SetGlobalTexturePaths(...) for all workstations and render slaves. Is there a similar method for setting custom paths for node material Asset Databases (below the File Assets field) ?
Any help appreciated.
-b
Hello,
these paths are accessed with a preference plugin. You can access that plugin:
plugin = c4d.plugins.FindPlugin(1040566) paths = plugin[c4d.PREF_DATABASE_PATHS] # print paths print(paths) # add a path paths = paths + "\n" + "X:\someting" plugin[c4d.PREF_DATABASE_PATHS] = paths c4d.EventAdd()
best wishes, Sebastian
Thanks! Ill try that.
Regards Bonsak
So im trying to get this to work inside our startup plugin. I can set new database paths but i cant read the existing ones. So im constantly overwriting the paths field.
import c4d import os, sys def PluginMessage(id, data): if id == c4d.C4DPL_PROGRAM_STARTED: try: # Get plugin object plugin = c4d.plugins.FindPlugin(1040566) # Print plugin object print('Plugin {}').format(plugin) # Get existing paths dbPaths = plugin[c4d.PREF_DATABASE_PATHS] # Print existing paths print('Existing DB paths {}').format(dbPaths) # Set new paths dbPaths = dbPaths + "\n" + "S:/_3D_Central/Maxon/Racecar-Assets-Redshift" plugin[c4d.PREF_DATABASE_PATHS] = dbPaths # Print new paths print('New DB paths {}').format(dbPaths) except KeyError: sys.exit(1)
print('Existing DB paths {}').format(dbPaths) doesnt print anyting even though there are entries in the Databases field. Am i doing something wrong?
this particular preferences plugin only loads its data when needed. To trigger that, you can call GetDescription() which will internally load the data.
GetDescription()
plugin.GetDescription(c4d.DESCFLAGS_DESC_0) # Get existing paths dbPaths = plugin[c4d.PREF_DATABASE_PATHS]
Thanks! Works like a charm!