Hi there, I have a question about a few lines of Python code in Cinema 4D. I have a functional script that executes my saved script via a button. However, sometimes the saved script changes the Command ID, causing the button to fail.
Is there a way to specify the Command ID in my script or can someone rewrite it to execute based on the file path instead?
Thank you for any possible solutions.
from typing import Optional
import c4d
#Python Tags Object placed User Data Button
def message(msg_type, data):
if msg_type == c4d.MSG_NOTIFY_EVENT:
event_data = data['event_data']
if event_data['msg_id'] == c4d.MSG_DESCRIPTION_COMMAND:
desc_id = event_data['msg_data']['id']
if desc_id[1].id == 16:
c4d.CallCommand(600000014)
def Button():
c4d.CallCommand(600000014)
def main():
obj = op.GetObject()
bc = c4d.BaseContainer()
obj.AddEventNotification(op, c4d.NOTIFY_EVENT_MESSAGE, 0, bc)