Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Setting Preferences via script

    Cinema 4D SDK
    python 2025 2026
    3
    5
    69
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pyr
      last edited by

      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

      P 1 Reply Last reply Reply Quote 0
      • P
        pyr @pyr
        last edited by

        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/2

        import 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 🙂

        ferdinandF 1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand @pyr
          last edited by ferdinand

          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 the mxutils 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,
          Ferdinand

          edit: 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.

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 0
          • CJtheTigerC
            CJtheTiger
            last edited by

            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.

            ferdinandF 1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand @CJtheTiger
              last edited by

              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 in V1, if we then just silently switch out the numeric value to ID_FOO: int = 54321 in V2, 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

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 1
              • First post
                Last post