Tag plugin/Message() only reacts to buttons?

On 21/04/2013 at 07:34, xxxxxxxx wrote:

I'm currently trying to convert an old v8.5 coffee tag plugin to work with r14 using python. However, I'm a bit flummoxed by some peculiarities...

Especially: How do I react on changes in the tag data in the attributes manager? I created the interface as a descriptions .res file, and this part is working perfectly (and much simpler than coffee), however I would need the plugin to react when the user inputs/changes a value there. Judging from the documentation (and comparing it to coffee), overloading Message() should work:

def Message(self, node, type, data) :
        if type == c4d.MSG_DESCRIPTION_COMMAND:
            if data['id'][0].id==c4d.RESET_TO_ORIGIN:
                print "  Clicked RESET_TO_ORIGIN"
            elif data['id'][0].id==c4d.UV_SET:
                print "  Clicked UV_SET"
            elif data['id'][0].id==c4d.UV_AUTO_UPDATE:
                print "  Clicked UV_AUTO_UPDATE"
        return True

However, I can only get a reaction from the first two - these are buttons in the .res file. The last item is a checkbox, and when I click on it, no message shows up. Same goes for real fields, links, and so on.

I tried both MSG_DESCRIPTION_VALIDATE and MSG_DESCRIPTION_POSTSETPARAMETER, and while those react to the entries in elements other than buttons, however I can't get information on which element sent the message, since the data parameter returns None.

Is there a way to get the id of the calling description element other than buttons, or is this not possible in python?


On 21/04/2013 at 09:06, xxxxxxxx wrote:

to my knowledge only buttons (plain, bitmap, long comboxbox customgui) do send 
messages, all other values are being stored in the BaseContainer attached to the 
GeListNode attached to your plugin instance. if you want to react on the toggle of 
the boolean state of a checkbox you would have to store the last state of that 
checkbox as member of your plugin class and compare that value with the current 
value in one of the methods.

def Message(self, node, type, data) :
    if node[someID] != self.LastState:
        self.LastState = node[someID]
        print 'State Changed ', node[someID]
    return True

which will effectively simulate some kind of button behaviour, which does not make 
much sense for me. you might have to explain what you are after. and to be the 
complete tech gibberish nazi : you do overwrite the methods provided by the plugin 
base classes, not overlaod them.

overloading refers to distinguishing between two implementations of a method with 
the same name, but a different set of parameters (count, type). for example foo(a)
and foo(a,b). due to the typeless approach there is no true overloading in python.

On 21/04/2013 at 10:08, xxxxxxxx wrote:

Thanks, thats what I thought. In the old coffee version of the tag I handled certain calculations only when the respective values were changed to speed up the plugin, the bool element was only an example. Well, at least processors got faster since then :-)

And thanks for the pointers on overloading/overwriting - somehow I keep mixing them up, maybe this time it'll stick...