SetDParameter() or Message() _POSTSETPARAMETER
-
On 12/12/2016 at 01:34, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Windows ;
Language(s) : C++ ;---------
Hi,This is probably an obvious question or one that i should know the answer to by now but what is the difference between using NodeData::SetDParameter() and listening for MSG_DESCRIPTION_POSTSETPARAMETER inside NodeData::Message() ? They both react to C4DAtom::SetParameter() although i'm guessing POSTSETPARAMETER is called before SetDParameter is?
Thanks.
-
On 13/12/2016 at 02:01, xxxxxxxx wrote:
Hello,
SetDParameter() is a virtual function that let's you implement the behaviour of SetParameter() of your plugin class. So every time someone or something calls SetParameter() of your thingy, this call is redirected to SetDParameter(). SetParmeter() could be called when someone is editing the plugin's parameters in the Attribute Manager but also in other cases e.g. from the Take System, Xpresso, another plugin etc. See NodeData::SetDParameter() Manual.
MSG_DESCRIPTION_XYZ messages are sent from the DescriptionCustomGui element. This GUI element is used to display and edit NodeData parameters. One use case is the Attribute Manager. These messages are sent when the plugin in question is edited with the Attribute Manager. So when one edits a parameter of a plugin with the Attribute Manager this will set the (new) parameter value by calling SetParameter (which will in return be redirected to SetDParameter). And after that - as the name suggest - the message MSG_DESCRIPTION_POSTSETPARAMETER is sent. See NodeData::Message() Manual.
So SetDParameter() will be called every time someone or something changes a parameter of your plugin using SetParemeter(). This may or may not be user interaction through the Attribute Manager.
MSG_DESCRIPTION_POSTSETPARAMETER is sent after a user used the Attribute Manager to edit a parameter.
best wishes,
Sebastian -
On 13/12/2016 at 15:36, xxxxxxxx wrote:
Thanks Sebastian that's very much appreciated. So pretty much a Getter/Setter for object parameters. At the moment my plugin reads it's description/parameters as-and-when it needs to - is there any reason why i really should implement Get/SetDParameter or is it only in cases where we need to intercept changes to parameters as they happen?
-
On 14/12/2016 at 00:51, xxxxxxxx wrote:
Hello,
the implementation of SetDParameter() and GetDParameter() is typically necessary when the value of a certain parameter is not stored in the element's BaseContainer. Similar one can implement GetDParameter() to make the value of a parameter depend on another parameter etc.
See NodeData::SetDParameter() Manual and NodeData::GetDParameter() Manual.
best wishes,
Sebastian -
On 14/12/2016 at 07:52, xxxxxxxx wrote:
Thanks again that helps.