SetWorldPluginData [SOLVED]



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


  • 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



  • 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



  • 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



  • 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



  • 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



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

    Hi,

    I'll assume this topic is now solved.

    Joey Gaspe
    SDK Support Engineer


Log in to reply