Change icon of commanddata

On 08/03/2013 at 02:23, xxxxxxxx wrote:

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

---------
Hello,

I like to exchange the icon of a commanddata plugin. For objects it's working fine with the MSG_GETCUSTOMICON message and set it in GetCustomIconData. But not for a commanddata.
I recieve this message also, but it's not updated the icon.

How does it works for commanddata plugins?

regards
Marky

On 08/03/2013 at 02:30, xxxxxxxx wrote:

Well, very hacky one, but you could blit on the bitmap returned by GetIcon();.

-Niklas

On 08/03/2013 at 02:51, xxxxxxxx wrote:

oh, sorry, I don't understand. In the commanddata I don't have a GetIcon() function.
Do you have a short exmaple?

On 08/03/2013 at 03:23, xxxxxxxx wrote:

There's a GetIcon function in the SDK, lib_customicon or sth like that. Not at home atm.
-Niklas

On 08/03/2013 at 04:31, xxxxxxxx wrote:

Something like this, not tested, but should give you the gist of it:

#include <lib_iconcollection.h>
  
IconData* ico = GetIcon(PLUGIN_ID);
if (ico && ico->bmp) {
    BaseBitmap* bmp = ico->bmp;
    for (LONG i=ico->x; i < ico->x + ico->w; i++) {
        for (LONG j=ico->y; j < ico->y + ico->h; i++) {
            Real lower = static_cast<Real>((i - ico->x) * (j - ico->y));
            Real upper = static_cast<Real>(ico->w * ico->h);
            LONG x = (lower / upper) * 255;
            bmp->SetPixel(i, j, x, x, x);
        }
    }
}

On 08/03/2013 at 22:23, xxxxxxxx wrote:

super, thanks a lot