Force update interface of the plugin



  • I have an asychronous call that needs to update the panel interface of my plugin for this I make something like:
    ((BaseObject*)this->Get())->GetDataInstance()->SetString(OBJECT_INFO, MaxonString("New value of the text string"));

    Unfortunatly until I select again the same object I don't see this change in the interface.

    Any tip on this?

    Thank you in advance.



  • You have to "tell" the object that its data has been updated.
    See here: https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_c4_d_atom.html#a89b4a7026485f0a69fd6595623a491f6

    Just pass "MSG_CHANGE", that should do the trick.


  • Global Moderator

    Hi Victor, after each change in order to trigger c4d update you have to add an event (in order to say hey I've done something, please C4D refresh)
    It's done through EventAdd.
    Moreover even if in python we directly set the basecontainer. In C++ it's recommended to use SetParemeter as describe In this manual

    Regarding advice from @mp5gosu, MSG_CHANGE is only needed when the structure of the object change (you change the count of point for example) since SetParemeter will automatically increase the dirty count of an object is not needed in your case.

    Finally, there is a small macro in R20 "_s" to create a Maxon::String which allows you to write
    "New value of the text"_s instead of MaxonString("New value of the text string")

    If you have questions, please let me know.
    Cheers,
    Maxime!



  • @m_adam said in Force update interface of the plugin:

    Regarding advice from @mp5gosu, MSG_CHANGE is only needed when the structure of the object change (you change the count of point for example) since SetParemeter will automatically increase the dirty count of an object is not needed in your case.

    Sorry, I actually meant EventAdd().