CommandData "Switch"



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

    On 16/10/2010 at 20:48, xxxxxxxx wrote:

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

    ---------
    Hey all,

    I'm trying to create a command similar to the "Use Generators" command in c4d.  I know how to have the command affect the setting in my SceneHook that I want it to, I just don't know how to make the command act like the Use Generators command (like a bool, stays highlighted when active, and regular when not).

    The GetState function in the commanddata class doesn't really give any clues how this could be done (that I saw anyway).

    thanks,
    kvb



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

    On 16/10/2010 at 20:59, xxxxxxxx wrote:

    7 minutes later...

    Got it lol.

    LONG SwitchCommand::GetState(BaseDocument *doc)
    {
    PluginSceneHook *sh = doc->FindSceneHook(ID_MYSCENEHOOK);
    if (!sh) return FALSE;
    BaseContainer *bc = sh->GetDataInstance();
    if (!bc) return FALSE;
    if(bc->GetBool(ID_SWITCH)==TRUE) 
    {
    return CMD_VALUE | CMD_ENABLED;
    }else return CMD_ENABLED;
    }
    

Log in to reply