Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

MSG_DESCRIPTION_GETBITMAP is not triggered

 Post Reply Post Reply
Author
Message
peterakos View Drop Down
Member
Member


Joined: 2015 Jul 13
Online Status: Offline
Posts: 304
Post Options Post Options   Quote peterakos Quote  Post ReplyReply Direct Link To This Post Topic: MSG_DESCRIPTION_GETBITMAP is not triggered
    Posted: 2017 Sep 01 at 3:08am

User Information:

Cinema 4D Version:   R18 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hello.

I need to change the image of a BitmapButton in a NodeData description.

Here is how I handle the bitmap button in the description:
const DescID* single_id = description->GetSingleDescID();
DescID custom_button = DescLevel(TEST_BUTTON_ID, CUSTOMDATATYPE_BITMAPBUTTON, 0);
if (!single_id || custom_button.IsPartOf(*single_id, NULL)) {
BaseContainer cont = GetCustomDataTypeDefault(CUSTOMDATATYPE_BITMAPBUTTON);
cont.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BITMAPBUTTON);
cont.SetBool(BITMAPBUTTON_BUTTON, true);
cont.SetInt32(BITMAPBUTTON_BORDER, BORDER_BLACK);
description->SetParameter(custom_button, cont, BUTTON_GROUP );
}

And here is in Message:
case MSG_DESCRIPTION_GETBITMAP: {
DescriptionGetBitmap* desc_bitmap = static_cast<DescriptionGetBitmap*>(data); 
LONG param_id = desc_bitmap->id[0].id;
if (param_id == TEST_BUTTON_ID) {
BaseBitmap* bitmap = BaseBitmap::Alloc(); 
bitmap->Init(filename);
desc_bitmap->bmp = bitmap; //desc will free it
}
}

The problem is that message never enters in MSG_DESCRIPTION_GETBITMAP.
If I add cont.SetInt32(BITMAPBUTTON_ICONID1, RESOURCEIMAGE_ARROWDOWN); in description, the image is shown correctly. I need toa dd my own image.
What else do I have to do ?

Thank you for your time.

Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1540
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Sep 04 at 10:31am
Hi,

this basically comes down to the "dirty" member of BitmapButtonStruct.
You'll need to implement GetDParameter() and it could look like so:
Bool GetDParameter(GeListNode* node, const DescID& id, GeData& t_data, DESCFLAGS_GET& flags)
{
switch (id[0].id)
{
case TEST_BITMAP_BUTTON:
{
BitmapButtonStruct bbs(static_cast<BaseList2D*>(node), id, m_dirty);
t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);
flags |= DESCFLAGS_GET_PARAM_GET;
break;
}
}
return SUPER::GetDParameter(node, id, t_data, flags);
}

The important part is the m_dirty passed to the BitmapButtonStruct. In this example a member variable. For a constantly updating BitmapButton, you could increment it right here inside of GetDParameter(), but that's probably not what you want. You rather want to change the dirty count, when something changed that causes the need for a new image, in which case you want to do something like this:
// Force update of BitmapButton
++m_dirty;
BitmapButtonStruct bbs(static_cast<BaseList2D*>(node), id, m_dirty);
node->SetParameter(id, GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs), DESCFLAGS_SET_0);

Cheers,
Andreas
SDK Support Engineer
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.109 seconds.