Tool icon variants



  • On 03/08/2018 at 14:23, xxxxxxxx wrote:

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

    ---------
    Hi,

    The recommended icon size for DescriptionToolData is 32x32, but it looks very low res in the toolbar.
    If I double the size, it will look great on the toolbar, but gigantic besides the mouse pointer.
    Is there a way to register a high-res icon for the toolbar and a low-res icon for the pointer?



  • On 07/08/2018 at 01:02, xxxxxxxx wrote:

    Hi,

    well, yes, in theory you can register two different icons, I'll get back to this at the end, but it's actually way simpler.

    The key is to set the BASEBITMAP_DATA_GUIPIXELRATIO correct (for a 64 by 64 icon it's 2.0) for the bitmap, then everything will work automatically with just one icon. Therefore you have several options:

    // when using [AutoBitmap](https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_auto_bitmap.html), set it directly
    BaseBitmap* bmp = AutoBitmap("myicon_64x64.tif", 2.0);
    // Or when allocating a bitmap manually
    BaseBitmap* bmp = BaseBitmap::Alloc();
    if (bmp->Init(GeGetPluginResourcePath() + "myicon_64x64.tif") != IMAGERESULT_OK)
    	return false;
    bmp->SetData(BASEBITMAP_DATA_GUIPIXELRATIO, 2.0);
    

    But if you want to, you can also register as many icons of various sizes as you like, via RegisterIcon() (with ICONFLAG_2X).
    Then you'd need to set the RESULT_CURSOR in the BaseContainer in GetCursorInfo() to the registered icon ID. Remember to use unique IDs to register icons.



  • On 10/08/2018 at 08:00, xxxxxxxx wrote:

    Perfect, thanks!


Log in to reply