CustomData and GUI Messaging



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/08/2004 at 15:30, xxxxxxxx wrote:

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

    ---------
    I need to do something very similar to the BUTTOM custom gui. I need to retrieve from the parent of the parameter some bitmaps that the parent is responsible for making ( like the bitmap returned from Message for BUTTON ). How do I initiate the Message to the parent?

    Best Regards,
    darf



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/08/2004 at 00:32, xxxxxxxx wrote:

    The bitmap button custom GUI (I assume that's what you mean) does it like this:
    1. When you set the data for the bitmap button with a BitmapButtonStruct, a pointer to the object is included.
    2. Then this object pointer is used to send a standard base list message, MSG_DESCRIPTION_GETBITMAP.
    It wouldn't be possible to do this without step 1 since a custom GUI isn't restricted to the attributes manager; it can just as well be used in a standalone dialog when there's no parent object.
    Here's a short review of the relevant code snippets:

        
        
        class iBitmapButtonCustomGui : public iBaseCustomGui  
        {  
          ...  
          pObj;  
          ...  
        };  
          
        Bool iBitmapButtonCustomGui::SetData(const TriState<GeData> &tristate)  
        {  
          const BitmapButtonStruct *ll =   
            static_cast<const BitmapButtonStruct*>(   
              tristate.GetValue().GetCustomDataType(CUSTOMDATATYPE_BITMAPBUTTON));  
          if (ll)  
          {  
            pObj=ll->op;  
            ...  
          }  
          ...  
          InitValues();  
          return TRUE;  
        }  
          
        Bool iBitmapButtonCustomGui::InitValues(void)  
        {  
          if (pObj)  
          {  
            ...  
            pObj->Message(MSG_DESCRIPTION_GETBITMAP,&rts);  
            ...  
          }  
          return TRUE;  
        }  
          
        Bool iBitmapButtonCustomGui::Command(LONG id,const BaseContainer &msg)  
        {  
          switch (id)  
          {  
          case 1000:  
            {  
              BaseContainer m(msg);  
              m.SetLong(BFM_ACTION_ID,GetId());  
              SendParentMessage(m);  
              break;  
            }  
          ...  
          }  
          ...  
          return iCustomGui::Command(id,msg);  
        }  
          
        Bool HostObjectData::GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, LONG &flags)   
        {  
          switch(id[0].id)   
          {   
          ...  
          case BITMAP_BUTTON_ID:   
            {  
              LONG dirty = 0;  
              BitmapButtonStruct bbs = BitmapButtonStruct(static_cast<PluginObject*>(node), id, dirty);   
              t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON,bbs);   
              flags |= DESCFLAGS_PARAM_GET;   
              break;   
            }  
          }  
          return ObjectData::GetDParameter(node, id, t_data, flags);   
        }
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2004 at 07:16, xxxxxxxx wrote:

    Thank you!

    Regards,
    darf



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2004 at 15:10, xxxxxxxx wrote:

    In the HostObjectData::GetDParameter you allocate a new custom data. Should we be freeing the one that was previously there or does C4D do that internally?

    Regards,
    darf



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/08/2004 at 23:16, xxxxxxxx wrote:

    No, that is automatic. (In fact, since there's no non-automatic allocation, i.e. raw new/delete, in the above function, just temporaries and operator=, it's all just C++ memory management.)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/09/2004 at 12:02, xxxxxxxx wrote:

    f**king Brilliant.

    Happy.
    darf


Log in to reply