Changing Tag logo

On 29/10/2015 at 13:44, xxxxxxxx wrote:

User Information:
Cinema 4D Version:    
Platform:      
Language(s) :

---------
Hi everyones,

There is a way to update or change during my tag execution the logo displayed in object manager?

Or maybe can I slide the current logo top to bottom or left to right ? In this way i'll have juste one res .tif image file to load and just slide during  execution ?

Thanks in advance for any help on this.

On 30/10/2015 at 13:16, xxxxxxxx wrote:

Hi,

you need to listen to MSG_GETCUSTOMICON in your tag's Message() function. The structure provided is GetCustomIconData.
With this you can provide new icons or draw overlays.

On 31/10/2015 at 02:17, xxxxxxxx wrote:

Great !! I looking about it and I'll give you a feel back.

Thanks for all this informations 😉

On 02/11/2015 at 03:53, xxxxxxxx wrote:

Hello Andreas. Thank a lot for your informations. But i can not make it work.
I tried by multiples way but it seems not in my capability yet. Did you have a example in SDK ? Maybe a link with more information about this ?

last, in any other way maybe a code snippet. I know every ones belong here are very busy...

I can not make my bitmap slide. I tried with this...

  
  if (type == MSG_GETCUSTOMICON){  
      GetCustomIconData().dat->x = 32;  
  }  

But as you probably know this throw me EXCEPTION ERROR because I guess I don't catch the right object. I Should instantiate something but i can't find it in SDK doc.

And I can not change my logo neither with this...

  
  if (type == MSG_GETCUSTOMICON){  
      GetCustomIconData().dat->bmp = AutoBitmap("whatever.tif");  
  }  

Same problem, i guess i should instance or catch something and after apply my GetCustomIconData() with additional problem : I not sure on the way to pass it a new data bitmap.

Thanks on any help on this. Everything else on my plugin seems to work. Soon I'll will asking for a complete review of my code if some are interested (I'm the one most interested!!)

On 02/11/2015 at 04:38, xxxxxxxx wrote:

Hi,

one problem with your code is, that you are creating a new GetCustomIconData structure of your own.
Instead you should use the one passed with the message (data parameter, which get's cast to the datatype delivered by the message type).

Here's a small Message() function as an example. Note that _iconBase and _iconOverlayed are two BaseBitmap pointers, that are initialized with two different icons during my startup code.

Bool MyPlugin::Message(GeListNode* node, Int32 type, void* data)
{
  switch (type)
  {
  case MSG_GETCUSTOMICON:
  {
    GetCustomIconData* const gcid = static_cast<GetCustomIconData*>(data); // data pointer interpreted depending on message type
    if (!gcid || !gcid->dat || !_iconBase || !_iconOverlayed)
      break;
  
    BaseBitmap* const bmp = gcid->dat->bmp;
    if (bmp)
    {
      // There's already an icon setup, copy your icon into the existing BaseBitmap
      GeData d;
  
      node->GetParameter(TAG_ICON_OVERLAY, d, DESCFLAGS_GET_0); // TAG_ICON_OVERLAY is a bool parameter in my tag description
      if (d.GetBool())
        _iconOverlayed->ScaleIt(bmp, 256, true, false);
      else
        _iconBase->ScaleIt(bmp, 256, true, false);
    }
    else
    {
      // No icon, yet, provide a new BaseBitmap
      gcid->dat->bmp = _iconBase;
    }
    gcid->filled = true; // tell message sender, that you provided a new icon
    break;
  }
  }
  return SUPER::Message(node, type, data);
}

I hope, this helps.

On 02/11/2015 at 04:50, xxxxxxxx wrote:

Wahooo ! I'll give you feel back when I have understood this.
Very interesting. Thanks