#include "StdAfx.h" //////////////////////////////////////////////////////////////////////////////// // functions prototypes //////////////////////////////////////////////////////////////////////////////// CKERROR CreateSaveSelectionSetProto(CKBehaviorPrototype **pproto); int SaveSelectionSetBB(const CKBehaviorContext& behcontext); CKERROR SaveSelectionSetBBCallBack(const CKBehaviorContext& behcontext); //////////////////////////////////////////////////////////////////////////////// // enums //////////////////////////////////////////////////////////////////////////////// enum INS { eINS_IN, }; enum OUTS { eOUTS_SUCCESS, eOUTS_FAILED, }; enum PINS { ePINS_NAME, }; enum POUTS { ePOUTS_GROUP, }; enum PSETTINGS { //ePSETTINGS_TARGETBYNAME, //use group instead of name }; //////////////////////////////////////////////////////////////////////////////// // behavior //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// CKObjectDeclaration* FillBehaviorSaveSelectionSet() { CKObjectDeclaration *od = CreateCKObjectDeclaration(NAME_SAVESELECTIONSET); od->SetDescription("Save a Selection Set."); /* rem: On : Activates the Progression Bar.
Off : Deactivates the Progression Bar.
Pause/Resume : Pause/Resume the Progression Bar.

Exit On : This output is activated after entering by 'On'.
Exit Off : This output is activated after entering by 'Off'.
Exit Off : This output is activated after entering by 'Pause/Resume'.

Size Mode : -
Orientation : -

*/ /* Note: Activate the "on" entry each time the target of the behavior is modified. */ od->SetType( CKDLL_BEHAVIORPROTOTYPE); od->SetGuid(BBGUID_SAVESELECTIONSET); od->SetAuthorGuid(VIRTOOLS_GUID); od->SetAuthorName("Virtools"); od->SetVersion(0x00010000); od->SetCreationFunction(CreateSaveSelectionSetProto); od->SetCompatibleClassId(CKCID_BEOBJECT); od->SetCategory("Selection Set"); return od; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// CKERROR CreateSaveSelectionSetProto(CKBehaviorPrototype **pproto) { CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(NAME_SAVESELECTIONSET); if(!proto) return CKERR_OUTOFMEMORY; proto->DeclareInput("Save"); proto->DeclareOutput("Success"); proto->DeclareOutput("Failed"); proto->DeclareInParameter(STR_SELECTIONSET, CKPGUID_SELECTIONSET,0); proto->DeclareOutParameter("Group",CKPGUID_GROUP,0); //proto->DeclareSetting(STR_BYNAME,CKPGUID_BOOL,FALSE); proto->SetFunction(SaveSelectionSetBB); proto->SetBehaviorCallbackFct(TargetableSelectionSetBBCallBack); proto->SetBehaviorFlags(BBFLAGS); *pproto = proto; return CK_OK; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// int SaveSelectionSetBB(const CKBehaviorContext& behcontext) { #ifdef VIRTOOLS_RUNTIME_VERSION CKBehavior* beh = behcontext.Behavior; if(beh->IsInputActive(eINS_IN)) { beh->ActivateOutput(eOUTS_FAILED); } return CKBR_OK; #else CKBehavior* beh = behcontext.Behavior; SelectionSetManager* setmgr = (SelectionSetManager*)behcontext.Context->GetManagerByGuid(SELECTIONSETMANAGER_GUID); if(beh->IsInputActive(eINS_IN)) { //BOOL byname=FALSE; CKGroup* set = 0; if (set = GetSetTarget())//(beh,setmgr,byname)) { if (setmgr->SaveSelectionSet(set,FALSE)) beh->ActivateOutput(eOUTS_SUCCESS); else beh->ActivateOutput(eOUTS_FAILED); } else beh->ActivateOutput(eOUTS_FAILED); beh->SetOutputParameterObject(ePOUTS_GROUP,set); } return CKBR_OK; #endif }