Button in a TagData dialog. Possible?



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

    On 22/07/2012 at 03:01, xxxxxxxx wrote:

    I know that I can place a button in a dialog for a TagData plugin.
    But I can only override the Draw, Execute and AddToExecution methods.
    Shouldn't I have a Command method to check for GUI elements?
    How can I check if a button is pressed in the tag dialog?



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

    On 22/07/2012 at 04:12, xxxxxxxx wrote:

    You need to override the Message() function and look for messages of type 'MSG_DESCRIPTION_COMMAND'. You then get the DescriptionCommand structure and look for the ID of the button that was clicked in that.



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

    On 22/07/2012 at 04:50, xxxxxxxx wrote:

    Ok, I got it working, kind of...
    When I print data, I get:

    {'id': (1007, 8, 1028854)}

    This means that it is a dict object, right?
    So, when I do:

    print data['id']

    I get (1007, 8, 1028854)

    The 1007 is the ID of the button. The 8, I assume that it is the type of GUI element, or something. The 1028854 is the ID of my tag.
    So, how do I get the individual elements. It seems like a vector but I can't get the ID of the button with data'id'
    So, how do we access those elements?



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

    On 22/07/2012 at 06:13, xxxxxxxx wrote:

    data['id'].id 😉

    -Nik



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

    On 22/07/2012 at 07:53, xxxxxxxx wrote:

    When I try something like:

    bt=data['id'].id

    it returns the error:

    AttributeError: 'c4d.DescID' object has no attribute 'id'

    :-(



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

    On 22/07/2012 at 08:11, xxxxxxxx wrote:

    There's an example in the Python docs:

      
    def Message(self, node, type, data) :   
        if type==c4d.MSG_DESCRIPTION_COMMAND:   
            if data['id'][0].id==THE_BUTTON_ID:   
                print "Pushed button with command ID", THE_BUTTON_ID   
        return True   
    


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

    On 22/07/2012 at 09:02, xxxxxxxx wrote:

    Once again, thank you :-)
    These things are so poorly documented :-(



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

    On 22/07/2012 at 14:25, xxxxxxxx wrote:

    Uups, I'm sorry. Missed the [0] part. :(

    -Niklas


Log in to reply