Setting Preferences via script
-
Hey everyone,
I’m trying to roll out a few default preference settings across all company workstations, but I can’t find any solid reference or example on how to do it properly through Python.
Basically, I’d like to change things like:
- some Memory settings (Picture Viewer cache, etc.)
- a few File options (Autosave paths and intervals)
- certain Redshift preferences
- and enable the Verify Script check
My goal is to make sure every workstation starts with the same defaults, ideally via a startup script or a deployed config.
Unfortunately, I haven’t found any working example in the documentation or SDK that shows how to access and write these preferences in C4D 2025 / 2026
Does anyone have a current example or best practice for setting preferences programmatically in recent C4D versions?
Thanks a lot!
— Tobias -
After digging through some older threads and testing things, I found that this approach works — based on the discussion here:
https://developers.maxon.net/forum/topic/13555/python-how-to-get-axis-scale-from-the-preference-settings/2import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: # get preferences pref = c4d.plugins.FindPlugin(465001632) # Memory ((465001628, 1, 465001632), (888, 133, 465001632)) desc = c4d.DescID( c4d.DescLevel(465001628, 1, 465001632), c4d.DescLevel(888, 133, 465001632) ) memoryPref = pref[desc] memoryPref[c4d.PREF_MEMORY_PVHARDFOLDER] = "c:\\blubb" c4d.EventAdd() if __name__ == '__main__': main()
To discover all available IDs inside a preference node, you can list them like this:
for bc, descid, _ in pref.GetDescription(0): name = bc[c4d.DESC_NAME] print(name,descid)
So this topic is solved
-
Hey @pyr,
yes, that your own answer is correct, thank you for sharing it! But since
2026.0.0
there exist better ways to discover symbols and container values. Have a look at themxutils
change notes for 2026.0 for an overview.With g_c4d_symbol_translation_cache you can discover the symbol for a plugin ID such as
465001632
and with GetParameterTreeString you can inspect node parameters in a human readable form.Cheers,
Ferdinandedit: Maxime pointed out that you could also call SaveWorldPreferences in anticipation of Cinema 4D crashing later on and therefore not saving your changes. I quite frankly think this is overkill and that you should not write code that expects that c4d will crash. But it is of course the safer option in a worst case scenario.
-
I'd like to add to this and ask whether the IDs of the preferences change between releases, assuming that they don't change their meaning/effects.
-
Hello @CJtheTiger,
I am not quite sure how your question is meant, and generally new questions should constitute new topics.
When you are asking, if when there is an
ID_FOO: int = 12345
inV1
, if we then just silently switch out the numeric value toID_FOO: int = 54321
inV2
, then the answer is sort of yesn't.We try to keep identifiers persistent. And for things like plugin IDs this is true without ifs and buts. I.e., once
Ocube: int = 5159
has been defined, it will stay like this. But parameter values, e.g.,PRIM_CUBE_LEN: int = 1100
, can technically change. The goal is also to keep them persistent but in ABI breaking releases we sometimes have to modify descriptions. That is why we recommend that you always use symbols and not numbers.Cheers,
Ferdinand