#include "StdAfx.h" //////////////////////////////////////////////////////////////////////////////// // functions prototypes //////////////////////////////////////////////////////////////////////////////// CKERROR CreateUnloadSelectionSetProto(CKBehaviorPrototype **pproto); int UnloadSelectionSetBB(const CKBehaviorContext& behcontext); CKERROR UnloadSelectionSetBBCallBack(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* FillBehaviorUnloadSelectionSet() { CKObjectDeclaration *od = CreateCKObjectDeclaration(NAME_UNLOADSELECTIONSET); od->SetDescription("Unload 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_UNLOADSELECTIONSET); od->SetAuthorGuid(VIRTOOLS_GUID); od->SetAuthorName("Virtools"); od->SetVersion(0x00010000); od->SetCreationFunction(CreateUnloadSelectionSetProto); od->SetCompatibleClassId(CKCID_BEOBJECT); od->SetCategory("Selection Set"); return od; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// CKERROR CreateUnloadSelectionSetProto(CKBehaviorPrototype **pproto) { CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(NAME_UNLOADSELECTIONSET); if(!proto) return CKERR_OUTOFMEMORY; proto->DeclareInput("Unload"); 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(UnloadSelectionSetBB); proto->SetBehaviorCallbackFct(TargetableSelectionSetBBCallBack); proto->SetBehaviorFlags(BBFLAGS); *pproto = proto; return CK_OK; } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// int UnloadSelectionSetBB(const CKBehaviorContext& behcontext) { CKBehavior* beh = behcontext.Behavior; SelectionSetManager* setmgr = (SelectionSetManager*)behcontext.Context->GetManagerByGuid(SELECTIONSETMANAGER_GUID); if(beh->IsInputActive(eINS_IN)) { //BOOL byname=FALSE; CKGroup* set = GetSetTarget();//(beh,setmgr,byname); //if (byname) beh->SetOutputParameterObject(ePOUTS_GROUP,set); if (set) { SelectionSetArray list(1); list.PushBack(set); if (setmgr->UnloadSets(list)) beh->ActivateOutput(eOUTS_SUCCESS); else beh->ActivateOutput(eOUTS_FAILED); } else beh->ActivateOutput(eOUTS_FAILED); } return CKBR_OK; }