Colorize OM icons?
-
On 16/05/2014 at 13:09, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
Howdy,Is it possible to colorize the object icons in the Object Manager, like the native joints in R13+?
I did a search for "colorize icon" but came up with nothing.
Adios,
Cactus Dan -
On 18/05/2014 at 01:49, xxxxxxxx wrote:
Hi Dan,
It is possible, we did this in our original release of X-Particles. The user could choose a colour from a description element and colorize an object's icon with that. It worked fine, but we dropped it in later versions - I can't remember why now!
What we did was have a monochrome image for the object icon. Then the user colour was multiplied into that to recolour the icon. The code from Message() in the ObjectData plugin looked like this:
Bool XSystem::Message(GeListNode *node, LONG type, void *data) { BaseDocument *doc; BaseContainer *nodebc; BaseObject *op = (BaseObject* )node; LONG x, y; GetCustomIconData *cid; UWORD r, g, b; Real pixr, pixg, pixb; Filename sysic; Vector colicn; nodebc = op->GetDataInstance(); doc = node->GetDocument(); switch(type) { case MSG_GETCUSTOMICON: cid = (GetCustomIconData* )data; if(cid) { colicn = nodebc->GetVector(XOVM_ICONCOLOR); // description COLOR element GetIcon(OXPSystemIcon, cid->dat); // OXPSystemIcon registered in main.cpp sysic = GeGetPluginPath() + Filename("res") + Filename("sysicon.tif"); // monochrome icon for this object // sysbm is a BaseBitmap class-level variable AutoAlloc'ed in the class definition if(sysbm && sysbm->Init(sysic) == IMAGERESULT_OK) { for(y = 0; y < 32; y++) { for(x = 0; x < 32; x++) { sysbm->GetPixel(x, y, &r;, &g;, &b;); pixr = Real(r) /255 * colicn.x; pixg = Real(g) / 255 * colicn.y; pixb = Real(b) / 255 * colicn.z; r = (pixr * 255); g = (pixg * 255); b = (pixb * 255); sysbm->SetPixel(x, y, (LONG)r, (LONG)g, (LONG)b); } } cid->dat->bmp = sysbm; cid->filled = TRUE; } } break; //.... etc.....
The crucial things are the monochrome icon to start with and that you must be able to get its bitmap. I registered the icon in main.cpp to make that easy.
Steve
-
On 19/05/2014 at 06:03, xxxxxxxx wrote:
Howdy,
Thanks.
Adios,
Cactus Dan