Changing description properties dynamically



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/07/2012 at 00:13, xxxxxxxx wrote:

    Hi everybody,

    I'm getting stuck on my task to change the DESC_MAX value of a field in my tag-plugin. The value is initialized via the description-file.

    I've tried the same way as for userdata and many other possibilities but I can't solve this problem.
    I even can't read the information for DESC_MAX out of the field because of getting only an 'int object is subscriptable' error.

    Here the read part of my code:

      
    data = tag.GetDataInstance()  
    for descId, container in data:  
              #if descId[1].id == 1003:                  doesn't work with description properties...???  
              if descId == 1003:  
                  print container[c4d.DESC_MAX]
    

    Isn't it possible to read or change the description properties?

    Cheers,
    Sven



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/07/2012 at 02:50, xxxxxxxx wrote:

    Hi Sven,

    First, GetDataInstance() returns the data container, not the description container.
    And it is not possible to access and change the description of standard parameters. Only the description of dynamic parameters (user data) can be retrieved and modified.

    Here is how to change the DESC_MAX in a user data description:

    import c4d
      
    def main() :
        for descid, container in op.GetUserDataContainer() :
            if descid[1].id==1: # User data is a float created with limit to 1000 (real unit)
                container[c4d.DESC_MAX] = 2000 # Set limit to 2000
                op.SetUserDataContainer(descid, container)
                c4d.EventAdd()
      
    if __name__=='__main__':
        main()
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/07/2012 at 03:04, xxxxxxxx wrote:

    Hi Yannick,

    oh,... yeah...  Could be helpfull for me to master reading again...

    The procedure for changing user data is no problem - or let's say it works in my scripts. ;)

    Ok, thank you very much Yannick.
    Then I'll catch values out of range in the function itself.

    Have a nice day,
    Sven


Log in to reply