deargui-vpl/ref/virtools/Samples/Behaviors/SelectionSetManager/GetSelectionSetsBB.cpp

118 lines
3.6 KiB
C++

#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:
<SPAN CLASS=in>On : </SPAN>Activates the Progression Bar.<BR>
<SPAN CLASS=in>Off : </SPAN>Deactivates the Progression Bar.<BR>
<SPAN CLASS=in>Pause/Resume : </SPAN>Pause/Resume the Progression Bar.<BR>
<BR>
<SPAN CLASS=out>Exit On : </SPAN>This output is activated after entering by 'On'.<BR>
<SPAN CLASS=out>Exit Off : </SPAN>This output is activated after entering by 'Off'.<BR>
<SPAN CLASS=out>Exit Off : </SPAN>This output is activated after entering by 'Pause/Resume'.<BR>
<BR>
<SPAN CLASS=setting>Size Mode : </SPAN> - <BR>
<SPAN CLASS=setting>Orientation : </SPAN> - <BR>
<BR>
*/
/* 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;
}