DESC_HIDE and DESC_EDITABLE



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

    On 17/07/2012 at 23:24, xxxxxxxx wrote:

    Hi everybody,

    I'm asking me which elements from lib_description.h are implemented in python at the moment.
    In this forum there's a lot stuff dealing with hide/disable datafields, and it's a little confusing me.

    After looking for a method to disable some fields of my tag-plugin I found an example that shows how to hide single userdata-fields. And it works great.

    import c4d  
    from c4d import documents  
      
    def main() :  
      doc = documents.GetActiveDocument()  
      obj = doc.SearchObject("Null")  
        
      #v1 = obj[c4d.ID_USERDATA,1]  
      #v2 = obj[c4d.ID_USERDATA,2]  
        
      allUserdatas = obj.GetUserDataContainer()  
        
      for descId, container in allUserdatas:  
          id = descId[1].id  
            
          if id == 2:  
              container[15] = False  
              obj.SetUserDataContainer(descId, container)  
    

    The id 15 = DESC_HIDE and it works as expected. But when I try to use DESC_EDITABLE (to grey the field out/disable it) by using the id 26 nothing happens.

    I guess not all id's are implemented yet?
    And does anybody know a method how to access not only the userdata?

    I've tried the same with GetDataInstance() but as expected it doesn't work.

      
    import c4d  
    from c4d import documents  
      
    def main() :  
      doc = documents.GetActiveDocument()  
      obj = doc.SearchObject("Scheibe")  
        
      allData = obj.GetDataInstance()  
        
      for descId, container in allData:  
          id = descId[1].id   #doesn't work, cause int is unsubscriptable  
            
          if descId == 1161:  
              container[15] = True    #doesn't work, cause float does not support item assignment  
    

    Does anybody has an idea?

    Cheers,
    Sven



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

    On 18/07/2012 at 01:52, xxxxxxxx wrote:

    Hi Sven,

    It's currently only possible to access the description of an object's user data.

    DESC_EDITABLE is used to disable "Edit Entry" in the popupmenu (DESC_REMOVEABLE for "Remove Entry"). This is only useful with object parameters.

    EDIT: Are you trying to edit the description of your own TagData plugin?



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

    On 18/07/2012 at 03:36, xxxxxxxx wrote:

    Hi Yannik,

    that's right. It's like the 'alignToSpline'-Tag where the PRIM_AXIS is only a accessible when tangential is set to true.

    So it's even not possible by using GetDEnabling?



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

    On 18/07/2012 at 05:48, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    So it's even not possible by using GetDEnabling?

    Yes it's possible overriding GetDEnabling(). You return True when the requested id enabling is PRIM_AXIS.



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

    On 18/07/2012 at 05:49, xxxxxxxx wrote:

    You can grey-out elements with GetDEnabling(). That's IMHO the better version for "not-so-complex-guis". It's less distracting than elements that suddenly disappear.



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

    On 18/07/2012 at 05:55, xxxxxxxx wrote:

    Hi Niklas,

    you're right. For the user it is very confusing when single elements suddenly appear/disappear.

    Then I'll try this "GetDEnabling()-Thing". ;)
    Seems a little bit weird after all I've read about it in this forum.

    Thank you Niklas.



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

    On 18/07/2012 at 06:23, xxxxxxxx wrote:

    All great.
    Works like it done never anything else. ;)
    Thank you both.

    Now I've only to deal with the 'argument 5'-error thrown form the super-call.
    It's really an interesting error - when it would not be so disgusting. ;)

    return super(AlignOnMultiSpline, self).GetDEnabling(self, node, id, t_data, flags, itemdesc)
    

    throws "TypeError: function takes at most 5 arguments (6 given)".

    return super(AlignOnMultiSpline, self).GetDEnabling(node, id, t_data, flags, itemdesc)  
    

    throws "TypeError: argument 5".

    Nice. ;)



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

    On 18/07/2012 at 10:02, xxxxxxxx wrote:

    The latter call is correct. But it seems to be a bug in the SDK. See here.

    -Nik



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

    On 18/07/2012 at 22:34, xxxxxxxx wrote:

    Ok, I can see it.
    Thx for your great help. You saved my day.

    Sven

    Edit: Fxxx, I've forgot the

    op.InsertUnder(op)
    

    statement. ;)


Log in to reply