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?
Regards
Bonsak