Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Colorize OM icons?

    SDK Help
    0
    3
    321
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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. Confused

      Adios,
      Cactus Dan

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 19/05/2014 at 06:03, xxxxxxxx wrote:

          Howdy,

          Thanks. 😉

          Adios,
          Cactus Dan

          1 Reply Last reply Reply Quote 0
          • First post
            Last post