Navigation

    • Register
    • Login
    • Search
    1. Home
    2. specnazspe
    S

    specnazspe

    @specnazspe

    0
    Reputation
    1
    Posts
    3
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    specnazspe Follow

    Best posts made by specnazspe

    This user does not have any upvoted posts yet.

    Latest posts made by specnazspe

    Script path instead of call command in Python

    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)
    
    posted in Cinema 4D SDK •