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
    • Recent
    • Tags
    • Users
    • Login

    SetWorldPluginData [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 597 Views
    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 Offline
      Helper
      last edited by

      On 09/01/2015 at 02:13, xxxxxxxx wrote:

      Hey

      I try to set Preferences from a python script 
      without any error but also without suscess

      data = plugins.GetWorldPluginData(1034395)
              if not data:
                  data = c4d.BaseContainer()
              versionstring  = "jim 123"
              data.SetString(1009,versionstring)
              plugins.SetWorldPluginData(1034395,data)
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 09/01/2015 at 08:00, xxxxxxxx wrote:

        Hi Conner,

        I had to add a bit to your script to get it to work.  I honestly don't know what problem you're having if you're not getting errors, as the following works.  Mostly notably, if you run it once, you get 'jim 123' just at the end since it's empty to start, and then if you change 'jim 123' to something else, you'll get 'jim 123' after start, but then whatever you change it to after end.  That proves setting and getting world plugin data functions as expected.  The added "if" early on ensures that the script runs the first time, when there's no data stored, so perhaps you're getting a silent failure?

          
        import c4d  
          
        from c4d import plugins  
          
        def main() :  
            
          data = plugins.GetWorldPluginData(1034395)  
            
          print "start"  
            
          if data:  
              print data.GetString(1009)  
            
          if not data:  
              data = c4d.BaseContainer()  
          versionstring  = "jim 123"  
            
          data.SetString(1009,versionstring)  
          plugins.SetWorldPluginData(1034395,data)  
            
          print "end"  
            
          print versionstring  
            
          return  
        

        I hope that helps.

        Joey Gaspe
        SDK Support Engineer

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

          On 09/01/2015 at 09:18, xxxxxxxx wrote:

          I'm falling behind on all the recent updates. So please correct me if this is wrong.
          But AFAIK. We still cannot create preferences plugins with Python. Even in R16.

          We can store the data in the WorldContainer.
          But I don't think it's possible to display it in the preferences with Python yet. And it has to done with C++

          -ScottA

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

            On 12/01/2015 at 12:45, xxxxxxxx wrote:

            Hi ScottA,

            I'm not sure what you mean.  How does it relate to conner's question and my answer?  If you judge it a separate and even tangent issue, please post it in a separate topic.  If it's generally related, please post some example code that exposes the issue.

            Thanks,

            Joey Gaspe
            SDK Support Engineer

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

              On 12/01/2015 at 13:27, xxxxxxxx wrote:

              Sorry for the confusion.
              I might have misunderstood his question.

              Since he was using custom variable values like "jim". I thought he was asking how to create his own custom prefs.
              AFAIK we can't do that with Python. We can only change the ones that are already there by getting their plugin IDs.

              -ScottA

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

                On 20/01/2015 at 08:49, xxxxxxxx wrote:

                Hi conner,

                I was wondering if the info in my post helped solve your problem?

                Thanks,

                Joey Gaspe
                SDK Support Engineer

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

                  On 23/01/2015 at 07:44, xxxxxxxx wrote:

                  Hi,

                  I'll assume this topic is now solved.

                  Joey Gaspe
                  SDK Support Engineer

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