Changing object icon [SOLVED]

On 14/12/2014 at 11:11, xxxxxxxx wrote:

I have a few object and tag plugins. Is it possible to change the icon through python?

similar to how the annotation tag has the option "Color Icon".

Thanks,
Joe

On 15/12/2014 at 03:39, xxxxxxxx wrote:

Hello,

to change the icon of an object dynamically you have to react to the MSG_GETCUSTOMICON message in Message(). The data is a dictionary:

  
     if type == c4d.MSG_GETCUSTOMICON:  
           
          data['bmp'] = c4d.bitmaps.InitResourceBitmap(c4d.IDM_SELECTALL)  
          data['w'] = data['bmp'].GetBw()  
          data['h'] = data['bmp'].GetBh()  
          data['filled'] = True  

best wishes,
Sebastian

On 16/12/2014 at 21:00, xxxxxxxx wrote:

Ahh okay. I see the data. Now i tried:

data['bmp'] = myCustomBitmap

It doesn't update it. But if I do a test and write:

c4d.bitmaps.ShowBitmap(data['bmp'])

it shows what i drawn. How can I update the objects icon after i assign it?

On 17/12/2014 at 04:39, xxxxxxxx wrote:

Hello,

don't forget to set 'filled' to true. Also make sure your bitmap "exists" after you assign it and is not destroyed by the garbage collection.

Best wishes,
Sebastian

On 27/12/2014 at 06:42, xxxxxxxx wrote:

Hello Joe,

was your question answered?

best wishes,
Sebastian

On 30/12/2014 at 18:29, xxxxxxxx wrote:

It was answered.

One more thing. Where would the ideal location for the bitmap be so it isn't 'garbage collected'? Would the icon location best be suited in the init?

Basically, I have an image icon with Alpha. I want to draw a color layer behind it and have it only show on the alpha of the main icon. I've seen some multi-layer bitmap in the API. Is that the way to go?

On 31/12/2014 at 08:46, xxxxxxxx wrote:

Hello,

if the icon is different for each object or tag you could store the bitmap as a member variable of your plugin class.

Best wishes,
Sebastian