Call Command

  • On 11/08/2018 at 18:22, xxxxxxxx wrote:


    I am trying to do the same thing with a button. But instead of creating a hair object I need it to run "render all materials" from the function menu. Is that possible?

    render all materials call command is - c4d.CallCommand(1225)

    Thanks :)

  • On 13/08/2018 at 05:22, xxxxxxxx wrote:

    Hello Novacon,

    yes, that is possible. See mfersaoui's code sample four posts above, it does exactly what you want.
    For this to work, the code belongs into a Python tag and the button needs to be placed on the tag, NOT the host object.
    Not sure, where you got the command ID from, maybe just a typo, the ID of "Render All Materials" is 12253.

    Here's mfersaoui's code with a few more comments for better understanding:

    import c4d
    # Additional message() function to react to button presses
    def message(id, data) :
        if id == c4d.MSG_DESCRIPTION_COMMAND:
            id2 = data['id'][0].id
            if id2 == c4d.ID_USERDATA:
                userDataId = data['id'][1].id
                if userDataId == 1: # here you need to change the ID to the one of your button
                    # here you can do almost anything in reaction to the button press
                    #print "My User Data Tag Button"
                    c4d.CallCommand(12253) # Render All Materials
    # main() function of the Python tag can still be used as normal.
    # For simplicity of this example it's left empty.
    def main() :

  • On 13/08/2018 at 07:48, xxxxxxxx wrote:

    Hi Andreas

    Thanks a lot that worked :)

    Is there anyway of getting it to work on the user data of a Null object?

  • On 23/08/2018 at 08:11, xxxxxxxx wrote:


    I'm terribly sorry, I somehow lost your follow up question.
    It's not directly possible (MSG_DESCRIPTION_COMMAND is not forwarded from objects to tags), but there's a workaround described in the Listening for Checkbox Clicks in User Data thread.

Log in to reply