Change CommandData icon



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/11/2009 at 19:51, xxxxxxxx wrote:

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

    ---------
    Howdy,

    Is it possible to change a CommandData's icon like the ones that have a green check for on and a red X for off?

    In R9.5 sdk documentation says this:
    PLUGINFLAG_COMMAND_DONT_CLONE_ICON

    Do not copy the bitmap icon. The caller has to guarantee that the icon passed stays in memory.
    However it is then possible to change it during runtime.

    ... but I can't find any examples of how to set that up.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/11/2009 at 05:49, xxxxxxxx wrote:

    Check for MSG_GETCUSTOMICON messages and change the passed icon message structure to your liking.

    Unfortunatly the documentation only mentions two messages for the CommandData::Message() method.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/11/2009 at 06:34, xxxxxxxx wrote:

    Howdy,

    The message MSG_GETCUSTOMICON is only available from R10+. Is there a way to do this in R9.5? The SDK documentation hints at it but no examples are given. :o(

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/02/2010 at 02:48, xxxxxxxx wrote:

    Probably I make some mistake, but I can not change the icon of my deformer plugin on runtime.
    I do so:

    Bool Cagedef::Message(GeListNode *node, LONG type, void *data)
    switch (type)
         {
            case MSG_GETCUSTOMICON:
         {                    
              data= &CIconData;//this is called but nothing change!?
         }

    };

    The CIconData struct is created in INIT procedure in this way:

    This var are global
    IconData MyIconData;
    GetCustomIconData CIconData;

    This inside INIT:

    MyIconData.bmp = BaseBitmap::Alloc();
    Filename PP= GeGetPluginPath()+Filename("Res")+Filename("myicon.tif");
                             if(MyIconData.bmp->Init(PP,-1,NULL)==IMAGE_OK) //this seems work!
    {
    GePrint("Icon OK");//only for test if this work
    MyIconData.x=0;
    MyIconData.y=0;
    MyIconData.w=MyIconData.bmp->GetBw();
    MyIconData.h=MyIconData.bmp->GetBh();
    CIconData.dat=&MyIconData;
    CIconData.filled=TRUE;
    }

    Where I wrong?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/02/2010 at 03:13, xxxxxxxx wrote:

    Please use the RegisterIcon() to register your icons and GetIcon() to retrieve the IconData. The GradientShader.cpp example uses RegisterIcon().

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/02/2010 at 03:20, xxxxxxxx wrote:

    Thank's Matthias, I felt that something was not right!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/02/2010 at 06:22, xxxxxxxx wrote:

    I read about RegisterIcon and I saw the GradientShader.cpp example but now I have some other questions!

    1-I need to obtain a new Plugin ID for every Icon I must register? In the SDK the "LONG lIconID" params seems need this?

    2- How can I set my new Icon, using the GetIcon(myID,& MyIconData) I can retrive the icon but how can I set it to my operator?

    Thank's
    Lorenzo



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/02/2010 at 08:36, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I read about RegisterIcon and I saw the GradientShader.cpp example but now I have some other questions!

    2- How can I set my new Icon, using the GetIcon(myID,& MyIconData) I can retrive the icon but how can I set it to my operator?

    Found, just for other poor man programmer like me:

    case MSG_GETCUSTOMICON:
                   {

    GetCustomIconData *icon =((GetCustomIconData* )data);
              GetIcon(Icon_ID,icon->dat);
              icon->filled=TRUE;

    }


Log in to reply