Preference Sub-Container references
On 10/08/2017 at 00:19, xxxxxxxx wrote:
Bit of a beginners question, but i'm looking to find out where i can get more info on getting and setting global preferences - in particular accessing the sub-containers.
I am referencing this thread: GetWorldContainer to change preferences
In it Andreas kindly explains how to access the net-render sub-container:
ma = c4d.GetWorldContainerInstance() np = ma[c4d.PREFS_PRI_NET] # get the net render sub-container np[c4d.PREF_NAME] = "NewName" ma[c4d.PREFS_PRI_NET] = np # store the changed container to preferences c4d.EventAdd()
I would like to access the preferences > files > autosave sub-container. However, if someone could point me in the direction of where to find a list of all the different subcontainers, or how to access them, that would be amazing (knowledge is power and all that )
On 10/08/2017 at 03:07, xxxxxxxx wrote:
In fact, most preferences are stored directly into the world container.
The WPREF_AUTOSAVE_ IDs for the Files->Auto-Save preferences can be found in the C++ SDK docs here.
Here's some code:
prefs = c4d.GetWorldContainerInstance() prefs[c4d.WPREF_AUTOSAVE_ENABLE] = True # Enable autosave prefs[c4d.WPREF_AUTOSAVE_MIN] = 2 # Autosave each 2 minutes prefs[c4d.WPREF_AUTOSAVE_LIMIT_TO] = True # Limit number of autosave prefs[c4d.WPREF_AUTOSAVE_LIMIT_NUM] = 20 # To 20 copies # Autosave destination user/custom path prefs[c4d.WPREF_AUTOSAVE_DEST] = c4d.WPREF_AUTOSAVE_DEST_USERDIR prefs.SetFilename(c4d.WPREF_AUTOSAVE_DEST_PATH, "dir/to/dest/path") c4d.EventAdd()
Note c4d.WPREF_AUTOSAVE_DEST_PATH has to be set with SetFilename() into the container.
On 10/08/2017 at 05:09, xxxxxxxx wrote:
That's great Yannick, thanks ever so much, I always forget to cross check in the C++ SDK.
Nice one for pointing me there!