本文整理汇总了C++中CKBehavior::ActivateOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ CKBehavior::ActivateOutput方法的具体用法?C++ CKBehavior::ActivateOutput怎么用?C++ CKBehavior::ActivateOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKBehavior
的用法示例。
在下文中一共展示了CKBehavior::ActivateOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PClothDestroy
//************************************
// Method: PClothDestroy
// FullName: PClothDestroy
// Access: public
// Returns: int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PClothDestroy(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
PhysicManager *pm = GetPMan();
pFactory *pf = pFactory::Instance();
using namespace vtTools::BehaviorTools;
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
//////////////////////////////////////////////////////////////////////////
//the object :
CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
if( !target ) return CKBR_OWNERERROR;
//////////////////////////////////////////////////////////////////////////
pCloth *cloth = GetPMan()->getCloth(target->GetID());
if (!cloth)
{
beh->ActivateOutput(0);
return CKBR_PARAMETERERROR;
}
pWorld *world = cloth->getWorld();
world->destroyCloth(target->GetID());
beh->ActivateOutput(0);
}
return 0;
}
示例2: AddNodalLink
int AddNodalLink(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
CKAttributeManager* attman = ctx->GetAttributeManager();
beh->ActivateInput(0,FALSE);
beh->ActivateOutput(0);
CKGroup* group = (CKGroup*)beh->GetInputParameterObject(0);
CKParameterOut* param = group->GetAttributeParameter(attman->GetAttributeTypeByName(Network3dName));
if(!param) throw "Given Group isn't a Network";
N3DGraph* graph;
param->GetValue(&graph);
CK3dEntity* s = (CK3dEntity*)beh->GetInputParameterObject(1);
CK3dEntity* e = (CK3dEntity*)beh->GetInputParameterObject(2);
float b;
beh->GetInputParameterValue(3,&b);
graph->InsertEdge(s,e,b);
beh->ActivateOutput(0);
return CKBR_OK;
}
示例3: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Paramters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int CGBLBuildCommand::BehaviourFunction(const CKBehaviorContext& behaviorContext)
{
CKBehavior* behavior = behaviorContext.Behavior;
CKContext* context = behaviorContext.Context;
if( behavior->IsInputActive(EGBLBuildCommandBehInputs::BuildCommand) )
{
DeactivateInputs(behaviorContext);
DeactivateOutputs(behaviorContext);
return DoBuildCommand (behaviorContext);
}
if( behavior->IsInputActive(EGBLBuildCommandBehInputs::CancelOperation))
{
DeactivateInputs(behaviorContext);
DeactivateOutputs(behaviorContext);
ClearParameterOutputs (behaviorContext);
int stateValue = EGBLBuildCommandState::Initial;
behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);
int initialParameterPosition = 0;
behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);
char *emptyString = "";
behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);
behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Cancelled);
}
if( behavior->IsInputActive(EGBLBuildCommandBehInputs::ReadNextParameterValue))
{
DeactivateInputs(behaviorContext);
DeactivateOutputs(behaviorContext);
int stateValue = 0;
behavior->GetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);
if (! ( (stateValue == EGBLBuildCommandState::AwaitingParametersForUntargeted) || (stateValue == EGBLBuildCommandState::AwaitingParametersForNetwork) || (stateValue == EGBLBuildCommandState::GetTargets) ) )
{
int stateValue = EGBLBuildCommandState::Initial;
behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);
int initialParameterPosition = 0;
behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);
char *emptyString = "";
behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);
CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE,GBLFC_ERROR_BUILDCOMMAND_INVALID_STATE_DESC);
behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
}
return DoReadNextParameterValue (behaviorContext);
}
return CKBR_OK;
}
示例4: BehaviourFunction
/*
*******************************************************************
* Function: int BehaviourFunction( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Paramters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int CGBLLAESetLoadState::BehaviourFunction( const CKBehaviorContext& behaviorContext )
{
CKBehavior* beh = behaviorContext.Behavior;
CKContext* ctx = behaviorContext.Context;
CGBLLAEManager *laeManager = (CGBLLAEManager *)ctx->GetManagerByGuid(GBLLAEManagerGUID);
if (laeManager)
{
int state = 0;
beh->GetInputParameterValue(0, &state);
laeManager->SetLoadState(state);
beh->ActivateInput(0, FALSE);
beh->ActivateOutput(0);
}
else
{
beh->ActivateInput(0, FALSE);
CKParameterOut *parameterOutError = beh->GetOutputParameter(0);
TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLLAE_ERROR_CANTSETLAEIDENTITY,GBLLAE_ERROR_CANTSETLAEIDENTITY_DESC);
beh->ActivateOutput(1);
}
return CKBR_OK;
}
示例5: JDestroy
//************************************
// Method: JDestroy
// FullName: JDestroy
// Access: public
// Returns: int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int JDestroy(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
PhysicManager *pm = GetPMan();
pFactory *pf = pFactory::Instance();
using namespace vtTools::BehaviorTools;
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
//////////////////////////////////////////////////////////////////////////
//the object A:
int jointType = GetInputParameterValue<int>(beh,1);
CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
CK3dEntity *targetB = (CK3dEntity *) beh->GetInputParameterObject(0);
if (!pFactory::Instance()->jointCheckPreRequisites(target,targetB,jointType))
{
return CK_OK;
}
// the world :
pWorld *worldA=GetPMan()->getWorldByBody(target);
pWorld *worldB=GetPMan()->getWorldByBody(targetB);
if (!worldA)
{
worldA = worldB;
}
if (!worldA)
{
beh->ActivateOutput(0);
return 0;
}
// the physic object A :
pRigidBody*bodyA= worldA->getBody(target);
pRigidBody*bodyB= worldA->getBody(targetB);
if(bodyA || bodyB)
{
pJoint *joint = worldA->getJoint(target,targetB,(JType)jointType);
if (joint)
{
worldA->deleteJoint(joint);
}
}
beh->ActivateOutput(0);
}
return 0;
}
示例6: RegisterAttributeType
//************************************
// Method: RegisterAttributeType
// FullName: RegisterAttributeType
// Access: public
// Returns: int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int RegisterAttributeType(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
PhysicManager *pm = GetPMan();
CKAttributeManager* attman = ctx->GetAttributeManager();
CKParameterManager *pMan = ctx->GetParameterManager();
using namespace vtTools::BehaviorTools;
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
CKSTRING name = GetInputParameterValue<CKSTRING>(beh,bbI_Name);
CKSTRING category = GetInputParameterValue<CKSTRING>(beh,bbI_Category);
CKSTRING defValue = GetInputParameterValue<CKSTRING>(beh,bbI_DefValue);
int pType = GetInputParameterValue<int>(beh,bbI_PType);
CK_CLASSID classId = GetInputParameterValue<CK_CLASSID>(beh,bbI_Class);
int attFlags = 0 ;
int user = GetInputParameterValue<int>(beh,bbI_User);
int save = GetInputParameterValue<int>(beh,bbI_Save);
if(user)
attFlags|=CK_ATTRIBUT_USER;
if(save)
attFlags|=CK_ATTRIBUT_TOSAVE;
attFlags|=CK_ATTRIBUT_CAN_DELETE;
CKAttributeType aIType = attman->GetAttributeTypeByName(name);
if (aIType!=-1)
{
beh->ActivateOutput(1);
}
int att = attman->RegisterNewAttributeType(name,pMan->ParameterTypeToGuid(pType),classId,(CK_ATTRIBUT_FLAGS)attFlags);
if (strlen(category))
{
attman->AddCategory(category);
attman->SetAttributeCategory(att,category);
}
if (strlen(defValue))
{
attman->SetAttributeDefaultValue(att,defValue);
}
}
pm->populateAttributeFunctions();
pm->_RegisterAttributeCallbacks();
beh->ActivateOutput(0);
return 0;
}
示例7: TextureSinus
int TextureSinus(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
// we get the amount value
float xamp=0.1f;
beh->GetInputParameterValue(0, &xamp);
// we get the amount value
float yamp=0.1f;
beh->GetInputParameterValue(1, &yamp);
float l= 1.0f;
beh->GetInputParameterValue(2, &l);
// we get the saved uv's
VxUV* savedUV = (VxUV*) beh->GetLocalParameterReadDataPtr(0);
// we get the interpolated mesh
CKMesh *mesh = (CKMesh*) beh->GetInputParameterObject(4);
int channel = -1;
beh->GetInputParameterValue(3, &channel);
int channelcount = mesh->GetChannelCount();
if (channel < -1 || channel >= channelcount) {
beh->ActivateInput(0, FALSE);
beh->ActivateOutput(0);
return CKBR_PARAMETERERROR;
}
CKDWORD Stride;
VxUV *uvarray = (VxUV*) mesh->GetModifierUVs(&Stride,channel);
int pointsNumber = mesh->GetModifierUVCount(channel);
float time;
beh->GetLocalParameterValue(1, &time);
float t;
for( int i=0 ; i<pointsNumber ; i++, uvarray =(VxUV *)((BYTE *)uvarray + Stride)) {
t = ((float)i/pointsNumber-0.5f)*4.0f+time*l;
uvarray->u = savedUV[i].u + ( 0.5f - savedUV[i].u ) * xamp * cosf(t);
uvarray->v = savedUV[i].v + ( 0.5f - savedUV[i].v ) * yamp * sinf(t);
}
mesh->ModifierUVMove(channel);
float pi = 3.1415926535f;
time += behcontext.DeltaTime * 0.001f;
if(l*time > 2*pi)
time -= (2*pi / l);
beh->SetLocalParameterValue(1, &time);
beh->ActivateInput(0, FALSE);
beh->ActivateOutput(0);
return CKBR_OK;
}
示例8: MidiEvent
int MidiEvent(const CKBehaviorContext& behcontext)
{
CKBehavior *beh = behcontext.Behavior;
if( beh->IsInputActive(1) ){ // OFF
beh->ActivateInput(1, FALSE);
return CKBR_OK;
}
CKBOOL combiWasOK = FALSE;
if( beh->IsInputActive(0) ){ // ON
beh->ActivateInput(0, FALSE);
beh->SetLocalParameterValue(0, &combiWasOK);
} else {
beh->GetLocalParameterValue(0, &combiWasOK);
}
MidiManager *mm = (MidiManager *) behcontext.Context->GetManagerByGuid( MIDI_MANAGER_GUID );
// Channel
int channel=0;
beh->GetInputParameterValue(0, &channel);
int note, count = beh->GetInputParameterCount();
//--- test if all input notes are activated or not
for( int a=1 ; a<count ; a++ ){
beh->GetInputParameterValue(a, ¬e);
if( !mm->IsNoteActive(note, channel) ) break;
}
if( a==count ){ // All notes are pressed
if( !combiWasOK ){
beh->ActivateOutput(0);
combiWasOK = TRUE;
beh->SetLocalParameterValue(0, &combiWasOK);
return CKBR_ACTIVATENEXTFRAME;
}
} else { // Not all notes are pressed
if( combiWasOK ){
beh->ActivateOutput(1);
combiWasOK = FALSE;
beh->SetLocalParameterValue(0, &combiWasOK);
return CKBR_ACTIVATENEXTFRAME;
}
}
return CKBR_ACTIVATENEXTFRAME;
}
示例9: GetCIS
/*
*******************************************************************
* Function: int GetCIS( const CKBehaviorContext& behaviorContext )
*
* Description : The execution function is the function that will be called
* during the process loop of the behavior engine, if the behavior
* is defined as using an execution function. This function is not
* called if the behavior is defined as a graph. This function is the
* heart of the behavior: it should compute the essence of the behavior,
* in an incremental way. The minimum amount of computing should be
* done at each call, to leave time for the other behaviors to run.
* The function receives the delay in milliseconds that has elapsed
* since the last behavioral process, and should rely on this value to
* manage the amount of effect it has on its computation, if the effect
* of this computation relies on time.
*
* Parameters :
* behaviourContext r Behavior context reference, which gives access to
* frequently used global objects ( context, level, manager, etc... )
*
* Returns : int, If it is done, it should return CKBR_OK. If it returns
* CKBR_ACTIVATENEXTFRAME, the behavior will again be called
* during the next process loop.
*
*******************************************************************
*/
int GetCIS(const CKBehaviorContext& behcontext)
{
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Retrieving min data :
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
CGBLCIConfigurationController* cman=static_cast<CGBLCIConfigurationController*>(ctx->GetManagerByGuid(CONFIGURATION_MAN_GUID));
IGBLCIAccessInterface *accessInterface = cman->GetCISAccessInterface();
CGBLSMStorageManager *storageManager = static_cast<CGBLSMStorageManager *>(ctx->GetManagerByGuid(GBLSMStorageManagerGUID));
IGBLSMConfigurationAccess* smCIS = storageManager->GetConfigurationInterface();
CKParameterOut *parameterOutError = beh->GetOutputParameter(BEH_OUT_INDEX_ERROR);
int idCIS = GBLCommon::BehaviorTools::GetInputParameterValue<int>(beh,BEH_IN_INDEX_CIS);
CGBLCOError returnValue = accessInterface->GetCIS(idCIS);
// check results and output error
if (returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
{
TGBLError::SetTGBLError(parameterOutError,returnValue.GetType(),returnValue.GetCode(),(CKSTRING)returnValue.GetDescription());
beh->ActivateOutput(BEH_PIN_OUT_INDEX_SUCCESS, true);
}
else
{
CGBLCOError::EGBLCOErrorType tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK;
switch((CGBLCOError::EGBLCOErrorType)returnValue)
{
case 0:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_OK;
break;
case 1:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_FATAL;
break;
case 2:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
case 3:
tType = CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL;
break;
}
TGBLError::SetTGBLError(parameterOutError,tType,returnValue.GetCode(),(CKSTRING)returnValue.GetDescription());
beh->ActivateOutput(BEH_PIN_OUT_INDEX_ERROR, true);
}
return CKBR_OK;
}
示例10: DirToArray
int DirToArray(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
XString filename((CKSTRING) beh->GetInputParameterReadDataPtr(0));
XString Mask((CKSTRING) beh->GetInputParameterReadDataPtr(1));
int rec;
beh->GetInputParameterValue(2,&rec);
if( beh->IsInputActive(0) ){
beh->ActivateInput(0,FALSE);
flist.erase(flist.begin(),flist.end());
CKDirectoryParser MyParser(filename.Str(),Mask.Str(),rec);
char* str = NULL;
while(str = MyParser.GetNextFile())
flist.push_back(XString(str));
counter = 0;
beh->ActivateInput(1,TRUE);
}
if( beh->IsInputActive(1) ){
beh->ActivateInput(1,FALSE);
if ( counter < flist.size() ){
XString entry = flist.at(counter);
CKParameterOut * pout = beh->GetOutputParameter(0);
pout->SetStringValue(entry.Str() );
counter++;
beh->SetOutputParameterValue(1,&counter);
beh->ActivateOutput(1);
}else{
beh->SetOutputParameterValue(1,&counter);
counter = 0 ;
beh->ActivateOutput(0);
}
}
return 0;
}
示例11: PClothDetachFromShape
//************************************
// Method: PClothDetachFromShape
// FullName: PClothDetachFromShape
// Access: public
// Returns: int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PClothDetachFromShape(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
PhysicManager *pm = GetPMan();
pFactory *pf = pFactory::Instance();
using namespace vtTools::BehaviorTools;
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
//////////////////////////////////////////////////////////////////////////
//the object :
CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
if( !target ) return CKBR_OWNERERROR;
//////////////////////////////////////////////////////////////////////////
CK3dEntity*shapeReference = (CK3dEntity *) beh->GetInputParameterObject(bbI_ShapeReference);
if (!shapeReference)
{
beh->ActivateOutput(0);
return CKBR_PARAMETERERROR;
}
pCloth *cloth = GetPMan()->getCloth(target->GetID());
if (!cloth)
{
beh->ActivateOutput(0);
return CKBR_PARAMETERERROR;
}
NxShape *shape = cloth->getWorld()->getShapeByEntityID(shapeReference->GetID());
if(shape)
{
cloth->detachFromShape((CKBeObject*)shapeReference);
}
beh->ActivateOutput(0);
beh->ActivateOutput(0);
}
return 0;
}
示例12: PBSetTriggerMask
//************************************
// Method: PBSetTriggerMask
// FullName: PBSetTriggerMask
// Access: public
// Returns: int
// Qualifier:
// Parameter: const CKBehaviorContext& behcontext
//************************************
int PBSetTriggerMask(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
PhysicManager *pm = GetPMan();
pFactory *pf = pFactory::Instance();
using namespace vtTools::BehaviorTools;
if( beh->IsInputActive(0) )
{
beh->ActivateInput(0,FALSE);
//////////////////////////////////////////////////////////////////////////
//the object :
CK3dEntity *target = (CK3dEntity *) beh->GetTarget();
if( !target ) return CKBR_OWNERERROR;
//////////////////////////////////////////////////////////////////////////
// the world :
pWorld *world = GetPMan()->getWorldByShapeReference(target);
if (!world)
{
beh->ActivateOutput(0);
return 0;
}
if (world)
{
NxShape *shape = world->getShapeByEntityID(target->GetID());
if (shape)
{
int onEnter = GetInputParameterValue<int>(beh,bbI_OnEnter);
int onStay = GetInputParameterValue<int>(beh,bbI_OnStay);
int onLeave = GetInputParameterValue<int>(beh,bbI_OnLeave);
shape->setFlag(NX_TRIGGER_ON_ENTER,onEnter);
shape->setFlag(NX_TRIGGER_ON_STAY,onStay);
shape->setFlag(NX_TRIGGER_ON_LEAVE,onLeave);
}
}
beh->ActivateOutput(0);
}
return 0;
}
示例13: FTPLogin
int FTPLogin(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
if( beh->IsInputActive(0)){
beh->ActivateInput(0,FALSE);
HWND win = (HWND)ctx->GetMainWindow();
FtpInit(win);
//HFILE hLogFile = _lcreat (LOG_FILE, 0);
//FtpLogTo (hLogFile);
FtpSetDefaultTimeOut (30);
FtpSetPassiveMode(TRUE);
FtpSetAsynchronousMode();
int Port;
beh->GetInputParameterValue(3,&Port);
XString Host((CKSTRING) beh->GetInputParameterReadDataPtr(0));
XString User((CKSTRING) beh->GetInputParameterReadDataPtr(1));
XString Pw((CKSTRING) beh->GetInputParameterReadDataPtr(2));
int Login = FtpLogin(Host.Str(),User.Str(),Pw.Str(),win,0);
beh->SetOutputParameterValue(0,&Login);
if (Login == 0)beh->ActivateOutput(0);
else{
beh->ActivateOutput(2);
return CKBR_OK;
}
return CKBR_ACTIVATENEXTFRAME;
}
if( beh->IsInputActive(1)){
beh->ActivateInput(1,FALSE);
FtpCloseConnection();
FtpRelease ();
beh->ActivateOutput(1);
return CKBR_OK;
}
return CKBR_ACTIVATENEXTFRAME;
}
示例14: GetFile
int GetFile(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
int Length=0;
// Start by In0
if( beh->IsInputActive(0)){
beh->ActivateInput(0,FALSE);
XString RemoteFile((CKSTRING) beh->GetInputParameterReadDataPtr(0));
XString LocalFile((CKSTRING) beh->GetInputParameterReadDataPtr(1));
char *Type = "Type_B";
int Get = FtpRecvFile ( RemoteFile.Str(),LocalFile.Str(),*Type, FALSE,NULL,NULL);
Length = FtpBytesToBeTransferred();
if ( Get !=0 ){
beh->SetOutputParameterValue(3,&Get);
beh->ActivateOutput(2);
return CKBR_OK;
}
beh->SetOutputParameterValue(0,&Length);
beh->ActivateOutput(0);
return CKBR_ACTIVATENEXTFRAME;
}
beh->GetOutputParameterValue(0,&Length);
int down=FtpBytesTransferred();
beh->SetOutputParameterValue(1,&down);
float progress=(float)(down*100.0f/Length); // percentage of file downloaded
progress /=100.0f;
beh->SetOutputParameterValue(2,&progress);
if ( down == Length){
beh->ActivateOutput(1);
return CKBR_OK;
}
return CKBR_ACTIVATENEXTFRAME;
}
示例15: BehaviourFunction
int GBLCOSetID::BehaviourFunction( const CKBehaviorContext& behContext )
{
CKBehavior *behaviour = behContext.Behavior;
CKContext *context = behContext.Context;
behaviour->ActivateInput(ECGBLCOSetLAIDBehInputs::InSetIdentity, FALSE);
CKAttributeManager*attributeManager = context->GetAttributeManager();
if (attributeManager != NULL)
{
CKLevel *level = context->GetCurrentLevel();
if ( level != NULL )
{
int attributeType = attributeManager->GetAttributeTypeByName("GBLCOLAID");
if (attributeType == -1)
attributeType = attributeManager->RegisterNewAttributeType("GBLCOLAID", GUID_TGBLLAID, CKCID_BEOBJECT);
else if ( level->HasAttribute(attributeType) )
level->RemoveAttribute(attributeType);
attributeManager->SetAttributeCategory(attributeType,"GBL");
level->SetAttribute(attributeType);
CKParameter*attribute = level->GetAttributeParameter(attributeType);
if ( attribute != NULL )
{
CKParameterIn*pin = behaviour->GetInputParameter(ECGBLCOSetLAIDBehInputs::InSetIdentity);
CKParameter*laid = pin->GetDirectSource();
if ( laid != NULL )
{
CKERROR err = attribute->CopyValue(laid);
if ( err == CK_OK )
{
behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, TRUE);
behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, FALSE);
return CKBR_OK;
}
}
}
}
}
CKParameterOut *parameterOutError = behaviour->GetOutputParameter(ECGBLCOSetLAIDParamOutputs::GetError);
TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLCO_ERROR_SETID_ATTRIBUTE,GBLCO_ERROR_SETID_ATTRIBUTE_DESC);
behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutIdentitySet, FALSE);
behaviour->ActivateOutput(ECGBLCOSetLAIDBehOutputs::OutError, TRUE);
return CKBR_GENERICERROR;
}