#include "StdAfx.h"
////////////////////////////////////////////////////////////////////////////////
// functions prototypes
////////////////////////////////////////////////////////////////////////////////
CKERROR CreateGetSelectionSetsProto(CKBehaviorPrototype **pproto);
int GetSelectionSetsBB(const CKBehaviorContext& behcontext);
CKERROR GetSelectionSetsBBCallBack(const CKBehaviorContext& behcontext);
////////////////////////////////////////////////////////////////////////////////
// enums
////////////////////////////////////////////////////////////////////////////////
enum INS
{
eINS_IN,
};
enum OUTS
{
eOUTS_OUT,
};
enum PINS
{
ePINS_SORTEDBYPRIORITY,
};
enum POUTS
{
ePOUTS_GROUPS,
};
////////////////////////////////////////////////////////////////////////////////
// behavior
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
CKObjectDeclaration* FillBehaviorGetSelectionSets()
{
CKObjectDeclaration *od = CreateCKObjectDeclaration(NAME_GETSELECTIONSETS);
od->SetDescription("Get all Selection Sets.");
/* 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_GETSELECTIONSETS);
od->SetAuthorGuid(VIRTOOLS_GUID);
od->SetAuthorName("Virtools");
od->SetVersion(0x00010000);
od->SetCreationFunction(CreateGetSelectionSetsProto);
od->SetCompatibleClassId(CKCID_BEOBJECT);
od->SetCategory("Selection Set");
return od;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
CKERROR CreateGetSelectionSetsProto(CKBehaviorPrototype **pproto)
{
CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(NAME_GETSELECTIONSETS);
if(!proto) return CKERR_OUTOFMEMORY;
proto->DeclareInput("In");
proto->DeclareOutput("Out");
proto->DeclareInParameter("Sorted by Priority",CKPGUID_BOOL,FALSE);
proto->DeclareOutParameter("Sets",CKPGUID_OBJECTARRAY,0);
proto->SetFunction(GetSelectionSetsBB);
proto->SetBehaviorCallbackFct(0);
proto->SetBehaviorFlags(BBFLAGS);
*pproto = proto;
return CK_OK;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int GetSelectionSetsBB(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
SelectionSetManager* setmgr = (SelectionSetManager*)behcontext.Context->GetManagerByGuid(SELECTIONSETMANAGER_GUID);
if(beh->IsInputActive(eINS_IN))
{
XObjectArray* list;
beh->GetOutputParameterValue(ePOUTS_GROUPS,&list);
if (list)
{
BOOL byPriority=FALSE;
beh->GetInputParameterValue(ePINS_SORTEDBYPRIORITY,&byPriority);
list->Clear();
setmgr->GetSelectionSets(*list,byPriority);
}
beh->ActivateOutput(eOUTS_OUT);
}
return CKBR_OK;
}