134 lines
3.9 KiB
C++
134 lines
3.9 KiB
C++
#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:
|
|
<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_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;
|
|
}
|
|
|