GetParameter while SetDParameter



  • On 13/12/2017 at 01:46, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R19 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I have a kind of chicken and egg situation.
    I am sure there are tons of solutions to solve this, but was wondering if I am not looking at it the wrong way.

    I have a checkbox in a tag description. When the user checks the checkbox I want to update the drawing in a GeUserArea of a GeDialog.
    However, the drawing method checks the state of that checkbox to draw this or that via

      
    DoUserAreaRedraw()  
    {  
    ...  
      Bool enabled = FALSE;  
      if (tag)  
      {  
          GeData d;  
          tag->GetParameter( checkboxID , d, DESCFLAGS_GET_0);  
          enabled = d.GetBool();  
      }  
    ...  
    }  
    

    In Tag::SetDParameter I check on the checkbox:

      
    Bool Tag::SetDParameter(GeListNode* node, const DescID& id, const GeData& t_data, DESCFLAGS_SET& flags)  
    {  
      if (!node)  
          return FALSE;  
      
      const Int32& gadgetID = id[0].id;  
      switch (gadgetID)  
      {  
          case checkboxID:  
              DoUserAreaRedraw();  
      
    ...  
      }  
      
      return SUPER::SetDParameter(node, id, t_data, flags);  
    }  
    

    Problem is thus that while the SetDParameter is processed the actual parameter is not yet updated and the drawing fails to visualize the correct information, as it obtains the "old" value of the parameter.

    What would be the better approach to resolve this?
    Thanks in advance,
    Daniel



  • On 13/12/2017 at 02:48, xxxxxxxx wrote:

    Hello,

    you can catch the message MSG_DESCRIPTION_POSTSETPARAMETER which will be sent after the parameter has been set.

    See also NodeData::Message() Manual.

    best wishes,
    Sebastian



  • On 13/12/2017 at 03:45, xxxxxxxx wrote:

    But of course, that's obvious.
    Sorry to waste your time Sebastian, and thanks for refreshing my memory.


Log in to reply