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

    Change icon of commanddata

    SDK Help
    0
    6
    490
    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 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

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

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

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

        -Niklas

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

          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?

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

            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

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

              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);
                      }
                  }
              }
              
              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

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

                super, thanks a lot

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