BitmapButton in DescriptionTool [SOLVED]



  • On 05/09/2014 at 00:26, xxxxxxxx wrote:

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

    ---------
    Hello,

    I do not know how to use BitmapButton in DescriptionTool
    I was able to display the BitmapButton Examine the forum.

    https://plugincafe.maxon.net/topic/8106/10552_bitmapbutton

    However, the breakpoint occurs when you click the button.
    Also, I do not know how to get the information of the button.

    Please tell me someone.



  • On 05/09/2014 at 01:20, xxxxxxxx wrote:

    You should be looking to intercept the message that is sent on clicking the button inside your Message() override function something like this i think ( haven`t tried it yet with BitmapButton but this is how it SHOULD work) :

    Bool MyPlugin::Message(GeListNode* node, LONG type, void* data)
    {
      
    	if (type==MSG_DESCRIPTION_COMMAND)
    	{
    		DescriptionCommand *dc = (DescriptionCommand* ) data;
      
    		GePrint("msg = "+LongToString(dc->id[0].id));  //Prints the ID of the description object that sent the command.
      
    		if (dc->id[0].id==MY_BITMAP_BUTTON)
    		{
    			// Do some stuff
    		}
    	}
      
    	return TRUE;
    }
    


  • On 05/09/2014 at 01:22, xxxxxxxx wrote:

    Hi anoano,

    if I understand you right, you may need to implement (override) the SetDParameter(). Something like this:

      
    Bool YOUR_PLUGIN::SetDParameter(GeListNode *node,const DescID &id;,const GeData &t;_data,DESCFLAGS_SET &flags;)   
    {   
        if(!node){return FALSE;}   
      
        int Command = id[0].id;   
           
        if(Command == YOUR_BITMAPBUTTON_ID)   
        {   
         // do something here...   
        }   
      
        return SUPER::SetDParameter(node,id,t_data,flags);   
    }   
    

    Hope that helps!

    WP.



  • On 05/09/2014 at 01:23, xxxxxxxx wrote:

    Ah you beat me too it Eclectrik!

    WP.



  • On 05/09/2014 at 01:34, xxxxxxxx wrote:

    I think you may be right though as i say i haven`t tried it with BitmapButton yet ;)



  • On 05/09/2014 at 02:13, xxxxxxxx wrote:

    Thanks for the advice.
    However, I do not work because I do not fully understand.
    Please advice a little more.

    Bool GetDDescription(BaseDocument* doc, BaseContainer& data, Description* description, DESCFLAGS_DESC& flags)
    {
         DescID did = DescLevel( MDATA_ID, DTYPE_NONE, 0);
         BaseContainer settings;
         settings.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BITMAPBUTTON);
         settings.SetString(DESC_NAME, "My Button");
         settings.SetBool(BITMAPBUTTON_BUTTON, true);
         settings.SetInt32(DESC_GUIOPEN, true);
         settings.SetBool(BITMAPBUTTON_BUTTON, true);
         settings.SetBool(BITMAPBUTTON_TOGGLE, true);
         settings.SetInt32(BITMAPBUTTON_ICONID1, ICON_ID1);
         settings.SetInt32(BITMAPBUTTON_ICONID2, ICON_ID2);
         if (!description->SetParameter(did,settings,DescLevel(MDATA_G))) return false;

    flags |= DESCFLAGS_DESC_LOADED|DESCFLAGS_DESC_RECURSIONLOCK;

    return ToolData::GetDDescription(doc, data, description, flags);
    }

    Bool Message(BaseDocument* doc, BaseContainer& data, Int32 type, void* t_data)
    {
         switch(type)
         {
              case MSG_DESCRIPTION_COMMAND:
              {
                   DescriptionCommand *dc = (DescriptionCommand* ) t_data;
                   switch(dc->id[0].id)
                   {
                   case ICON_ID1:
                         // do something here...
                        break;
                   }
              }
              break;
            }
    }

    Bool SetDParameter(BaseDocument* doc, BaseContainer& data, const DescID& id, const GeData& t_data, DESCFLAGS_SET& flags)
    {
        int Command = id[0].id;
        if(Command == ICON_ID1)
        {
              
         // do something here...

    }
    return SUPER::SetDParameter(doc, data, id, t_data, flags);
    }



  • On 06/09/2014 at 06:55, xxxxxxxx wrote:

    You might need to add the following override into your plugin aswell:

      
    Bool YOUR_PLUGIN::GetDParameter(BaseDocument* doc, BaseContainer& data, const DescID& id, GeData& t_data, DESCFLAGS_GET& flags)   
    {   
        switch(id[0].id)   
        {   
            case MDATA_ID:   
         {   
             flags |= DESCFLAGS_GET_PARAM_GET;   
                break;   
         }   
        }   
      
        return SUPER::GetDParameter(doc, data, id, t_data, flags);   
    }   
    

    I'm not sure if it's changed in R15 though as I haven't had a chance to get into that yet.

    WP.



  • On 06/09/2014 at 09:17, xxxxxxxx wrote:

    I think I know why the button is not working.
    But I can't test it because for the life of me I cannot get any dynamic gizmos to show up in a DescriptionToolData plugin.

    I can use them in every other kind of plugin. But for some very strange reason they refuse to show up in a DescriptionToolData  type of plugin. And I cannot figure out why.
    No errors. They just don't show up. As if the groupid parameter in the SetParamter() function is wrong.

    Can someone please post their .res file?
    I'm stumped why this is not working. When I can use it just fine in all of the other plugin types.

    -ScottA

    Ugh. Never mind.
    If I create a group inside of the GetDDescription() method and put my gizmos in that group. Then the gizmos get added as expected.
    I don't know why they don't work with groups created in the .res file for me. *Shrug*



  • On 07/09/2014 at 20:49, xxxxxxxx wrote:

    BitmapButton is now to move thanks to the advice of everyone.
    I want did not move for ID to be set was different.

    Thank you everyone.


Log in to reply