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

    Preference Sub-Container references

    PYTHON Development
    0
    3
    486
    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.
    • H
      Helper
      last edited by

      On 10/08/2017 at 00:19, xxxxxxxx wrote:

      Hey Guys,

      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 😉)

      Cheers,

      Cerac

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 10/08/2017 at 03:07, xxxxxxxx wrote:

        Hi,

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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!

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