Time Limit for MSG_DESCRIPTION_CHECKUPDATE



  • '''
    Hello PluginCafe! :)

    I need to apply SetDirty() function only after finishing the manipulation process of the desired parameter.

    Something like this is implemented in the material preview.
    The update takes place only after ~0.5 seconds after finishing the manipulation.
    alt text

    So, I tried to check updates via MSG_DESCRIPTION_CHECKUPDATE and calculate the time by utilizing timeit module

    '''

            start = timeit.default_timer() #Start Timer
    
            if type == c4d.MSG_DESCRIPTION_CHECKUPDATE: 
    
                if data["descid"][0].id == TEST_SLIDER: #Check if TEST_SLIDERis updated
                    
                    end = timeit.default_timer() #End Timer
                        if end - start > 1: #Do something if time took more than 1 sec
                            self.bmp.SetDirty()
                            node.SetDirty(c4d.DIRTYFLAGS_DATA)
    
    

    But unfortunately, I can't find the solution in the documentation.

    What am I doing wrong and how to do this properly?


  • Global Moderator

    Hello,

    you could react to the message MSG_DESCRIPTION_USERINTERACTION_END which is sent after the user stopped interacting with the parameter in the Attribute Manager.

    You find a list of related messages in the NodeData::Message() Manual.

    best wishes,
    Sebastian



  • Is this feature available for Python?



  • Nice 💙 it works with python but how to check only one parameter instead of everything?

    something like this

            if type == c4d.MSG_DESCRIPTION_USERINTERACTION_END:
                if data["descid"][0].id == TEST_SLIDER: 
                    print "Finished"
    
    

  • Global Moderator

    Hello,

    the message MSG_DESCRIPTION_USERINTERACTION_END has no data. You could store the old value of the parameter in question and check if that value has changed.

    best wishes,
    Sebastian