On 01/09/2017 at 03:08, xxxxxxxx wrote:
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.