Update button

  • Can someone help me? changes the value of my cycle button, but does not execute it:


  • Seems like it executes very well, but only delayed because you are changing a combobox/dropdown instead of the slider value itself. Try modifying the sliders instead of the combobox/dropdown for less delays

    EDIT: I forgot that those sliders might be also just Numerical IDs so it may be inaccurate as well in terms of it being able to handle the data being fed on, and may change depending on the constraint build-up

    I guess you can't do anything than to deal with the delay. Try making the time slider running while you switch that button back and forth if it updates everytime something changes on the scene. Usually it's just a 1-frame delay, or whenever something is updated. In alternative, try to use c4d.EventAdd() after each if-else statement

  • Hi @pyxelrigger thanks for reaching us, the main issue is to properly update you need to send the message MSG_DESCRIPTION_COMMAND and this is what the UI, it set the parameter then call this message.

    But adding this call in the execute method of the python tag is not enough.
    This message is processed by the constraint tag and add an Undo, and as said multiple time, this is not possible to add an undo in a threaded environment(see Python Tags - Shouldn't really they can change the scene? so this fail.

    So the workaround is to not call the message during the scene execution of the scene but when the value is set in the user Data, so you react to a GUI interaction (main thread) so you are free to do what you want.

    import c4d
    #Welcome to the world of Python
    def message(msgId, msgData):
        # React to the change within the UI, since it came from the UI, this is executed in the Main Thread, so you can add Undo or Add Event
            # Check if its an User Data ID
            if msgData['descid'].IsPartOf(c4d.DESCID_DYNAMICSUB):
                # Checks if its the User Data ID 1 that changed
                if msgData['descid'][-1].id == 1:
                    constraintTag = op.GetObject().GetTag(1019364)
                    # This will update the stuff and create an Undo
            return True
    def main():
        option = op[c4d.ID_USERDATA,1]
        constraintTag = op.GetObject().GetTag(1019364)
        # Defines the new value (We could do it as well in the message method, but just to show you that Execute is called before)


  • Thanks! seems to work well!

    the problem is that apparently it only runs on the tag, if I set the option as a UserData of my object, it doesn't work