I need help with this Python code



  • What I want to do with this code is when i turn on the User Data (Boolean) of the Python Tag, it hits the "Record Animated":
    import c4d

    def main():
        pass  #put in your code here
        
        onoff = op[c4d.ID_USERDATA, 1]
        print ("userdataXD: ", onoff)
        if onoff == 1:
            c4d.CallCommand(202665) # Record Animated
    

    For some reason the call command for Record Animated does not work (but in theory it should; I am new at this so this might sound newbie to most of you guys)
    Thank you



  • Hi, this is not possible since CallCommand is the thing called when you click on an icon to do an operation so its wrap undo creation and so on, which are step not allowed in a thread and since the executing of tags are threaded, this is not possible. For more information about threading in Cinema 4D please read Threading Information.

    And to be honest I don't really see any workaround for you, which doesn't require some plugins or some kind of complicated hack.

    Since it's a follow up from Record Keyframe of Object's property when it changes (Python; is it possible?) I will wait until you answer to the previous one because maybe this will already fix your issue.

    Cheers,
    Maxime.



  • Without more information, from your side, I've set up your topic as solved but feel free to re-open it.

    Cheers,
    Maxime.


Log in to reply