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

    GetWorldContainer to change preferences [SOLVED]

    PYTHON Development
    0
    9
    1.0k
    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 08/06/2015 at 08:41, xxxxxxxx wrote:

      I want to change Settings in Programm-settings.

      This is what I used. But this is not working. What else do I miss?

                  ma = c4d.GetWorldContainer()
                  ma[c4d.PREF_OPENGL_ANTIALIAS]=2
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 08/06/2015 at 08:44, xxxxxxxx wrote:

        Hi Holger,

        try the same with GetWorldContainerInstance() instead. In your code you are only changing a copy of the world container.

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

          On 08/06/2015 at 08:48, xxxxxxxx wrote:

          Stange...still not working. Do I need to import any modules?

          This is my complete Script. I want to set OGL AA to 0.

          import c4d
          from c4d import gui
          #Welcome to the world of Python
            
            
          def main() :
              ma = c4d.GetWorldContainerInstance()
              ma[c4d.PREF_OPENGL_ANTIALIAS]=0
              
              
              c4d.EventAdd()
          if __name__=='__main__':
              main()
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 08/06/2015 at 08:55, xxxxxxxx wrote:

            Sorry, Holger,

            I didn't pay enough attention. You also want to use the correct constant:
            WPREF_OPENGL_ANTIALIAS
            (note the W in the beginning)

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

              On 08/06/2015 at 09:05, xxxxxxxx wrote:

              Thanks Andreas for the instant support, That is working now. 
              I am sorry for all my question. I am working on a huge Scriptcollection I want to port to python and there is a lot of questions.

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

                On 08/06/2015 at 09:07, xxxxxxxx wrote:

                No need to apologize.
                That's what we are here for.

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

                  On 25/01/2016 at 07:43, xxxxxxxx wrote:

                  Hello guys!
                  Tell me please,
                  how to use same code to change Team Render Machine Name

                  import c4d
                  from c4d import gui
                  #Welcome to the world of Python

                  def main() :
                      ma = c4d.GetWorldContainerInstance()
                      ma[c4d.PREF_NAME] = "NewName"
                      c4d.EventAdd()
                      
                  if __name__=='__main__':
                      main()

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

                    On 26/01/2016 at 03:31, xxxxxxxx wrote:

                    Hi Mike,

                    welcome to the Plugin Café forums 🙂
                    At first I'd like to ask you to please open a new topic for non-related questions. I know, sometimes it's a thin line between related and non-related and may even lie in the eye of the beholder. I'd say, if in doubt, rather open a new thread. But no big deal, still happy to have you here.

                    For many modules the preferences contain a sub-container with the preferences values.
                    So in your case it looks like so:

                      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()
                    
                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 26/01/2016 at 04:09, xxxxxxxx wrote:

                      Thank you! 👏

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