I have a Null with userdata and a button in it.
I also have an Xpresso tag and a Python Node that I want it to listen a message from that button. The button ID is 10.
In my research I wasn't able to find any examples for what I need, so I tried this code that I found.
I know this is for Python Generator obj, but I want something similar, and to learn how to detect a button from my userdata and then run an action.
Thanks a lot
import c4d def message(mid, data): if mid is c4d.MSG_DESCRIPTION_COMMAND: if not isinstance(data, dict) or "id" not in data: raise RuntimeError("Malformed message data.") senderDescId = data["id"] if senderDescId.id == c4d.ID_USERDATA and senderDescId.id == 10: print ("User data button has been pressed.") # then run an action in main() function def main(): # waiting for the right message before running anything...