MSG_UPDATE is sent after pressing button in Material Data



  • Hello.

    When I press a button in MaterialData, the message MSG_DESCRIPTION_COMMAND is sent.
    After that I always receive a MSG_UPDATE as well.
    Is there anything I should do to avoid that ?

    After handling the button callback, I return TRUE.

    Thank you.


  • Global Moderator

    Hi @peterakos, MSG_DESCRIPTION_COMMAND is used to trigger the action of pressing the button.
    But in most of the case, if there is a button, it's to do something, so actually modify something which will then probably trigger a MSG_UPDATE.

    Moreover you can test it with a Python Generator and UserData button attached. If you click on the button only MSG_DESCRIPTION_COMMAND is triggered.

    import c4d
    
    def message(id, data):
        if id == c4d.MSG_DESCRIPTION_COMMAND:
            print "Button Clicked"
        elif id == c4d.MSG_UPDATE:
            print "MSG_UPDATE"
            
        return True
    
    def main():
        return c4d.BaseObject(c4d.Ocube)
    

    May I ask you what are you trying to achieve?
    Cheers,
    Maxime.



  • Hello.

    Thank you very much for your clarification on this.
    I have a button in MaterialData that saves the material in a specific format in the disk.
    I doesn't change anything in the material but the MSG_UPDATE is sent anyway.
    So, since I don't want to run the MSG_UPDATE handler, I have to set a flag to true in order to skip it.

    Thank you.