当前位置: 首页>>代码示例>>C++>>正文


C++ CKBehavior::SetOutputParameterValue方法代码示例

本文整理汇总了C++中CKBehavior::SetOutputParameterValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CKBehavior::SetOutputParameterValue方法的具体用法?C++ CKBehavior::SetOutputParameterValue怎么用?C++ CKBehavior::SetOutputParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKBehavior的用法示例。


在下文中一共展示了CKBehavior::SetOutputParameterValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetNextBBId

int GetNextBBId(const CKBehaviorContext& behcontext)
{
	CKBehavior* beh = behcontext.Behavior;
	CKContext* ctx = behcontext.Context;
	
	beh->ActivateInput(0,FALSE);
	
	int count = beh->GetParent()->GetSubBehaviorLinkCount();
	int result = -1;
    
	for (int i=0; i<count; i++)
	{
		CKBehaviorLink *link =  beh->GetParent()->GetSubBehaviorLink(i);
		if (link->GetInBehaviorIO() == beh->GetOutput(0))
		{
			result   = link->GetOutBehaviorIO()->GetOwner()->GetID();
			beh->SetOutputParameterValue(0,&result);
			break;
		}
	}
	
	CKBehavior *script   = static_cast<CKBehavior*>(ctx->GetObject(result));
	if (script)
	{
		int bc = script->GetOutputCount();

		int bc2 = script->GetInputCount();

	}


	beh->ActivateOutput(0);
	beh->SetOutputParameterValue(0,&result);
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:35,代码来源:GetSubBBId.cpp

示例2: ClearParameterOutputs

/*
*******************************************************************
* Function: void CGBLBuildCommand::ClearParameterOutputs(const CKBehaviorContext& behaviorContext)
*
* Description : Clears the values of parameter outputs for this building block
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*******************************************************************
*/
void CGBLBuildCommand::ClearParameterOutputs(const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
	char *emptyString = "";
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentName, emptyString, strlen(emptyString)+1);
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentType, emptyString, strlen(emptyString)+1);
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetCommandString, emptyString, strlen(emptyString)+1);
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:21,代码来源:GBLBuildCommand.cpp

示例3: retx

//************************************
// Method:    vt_SetOutVal
// FullName:  vt_SetOutVal
// Access:    public static 
// Returns:   PyObject *
// Qualifier:
// Parameter: PyObject * self
// Parameter: PyObject * args
//************************************
static PyObject *vt_SetOutVal( PyObject * self, PyObject * args )
{
	
	int size = PyTuple_Size(args);
	PyObject *val;
	int bid, index;
	PyArg_ParseTuple(args, "iiO", &bid, &index,&val); 

	CK_ID cid = bid; 
	CKBehavior *beh = static_cast<CKBehavior*>(pym->m_Context->GetObject(cid)); 
	if (size!=3)
	{

		pym->m_Context->OutputToConsole("PyError : This function only accepts 3 arguments : \n\t bid,index,value ");
		Py_RETURN_NONE;
	}
	
	using namespace vtTools;
	
	if (beh && val &&  index < beh->GetOutputParameterCount() )
	{
		if (PyInt_Check(val))
		{
			long ret = PyInt_AsLong(val);
			int retx = static_cast<int>(ret);
			beh->SetOutputParameterValue(index,&retx);
			Py_RETURN_NONE;
		}
		if (PyFloat_Check(val))
		{
			double ret = PyFloat_AsDouble(val);
			float retx  = static_cast<float>(ret);
			beh->SetOutputParameterValue(index,&retx);
			Py_RETURN_NONE;
		}
		if (PyString_Check(val))
		{
			std::string ret;
			CKParameterOut * pout = beh->GetOutputParameter(index);
			XString retx(ret.c_str());
			pout->SetStringValue(retx.Str());
			Py_RETURN_NONE;
		}
		if (PyTuple_Check(val))
		{
			std::string outList = to_string(val);
			CKParameterOut * pout = beh->GetOutputParameter(index);
			XString retx(outList.c_str());
			pout->SetStringValue(retx.Str());
			Py_RETURN_NONE;
		}

		
	}
	Py_RETURN_NONE;
}
开发者ID:,项目名称:,代码行数:65,代码来源:

示例4: 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;
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例5: 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;
	
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例6: 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;
}
开发者ID:,项目名称:,代码行数:50,代码来源:

示例7: GetNextArgument

/*
*******************************************************************
* Function: int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
*
* Description : This function sets corresponding outputs with requested argument's 
*				name, type and if the type of arguments is TGBLFCStringFromList, it also
*				provides designer specified list array with GetDesignerSpecifiedList output.
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*	nextArgument	    r	Required argument to have parameters provided by the command
*
*	targetBB			r	Target GBLWaitForCommand building block
*
* Returns : int, The return value is 0 if no error occured or -1 on error 
*
*******************************************************************
*/
int CGBLBuildCommand::GetNextArgument (CKParameter* nextArgument,CKBehavior* targetBB, const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
	CKContext*  context = behaviorContext.Context;

	XString typeName = context->GetParameterManager()->ParameterTypeToName(nextArgument->GetType());
	XString argumentName = nextArgument->GetName();

	if (typeName == "TGBLFCStringFromList")
	{
		int inputs = targetBB->GetInputParameterCount();

		for (int i=0; i<inputs; i++)
		{
			CKParameterIn *parameterInput = targetBB->GetInputParameter(i);

			if ( argumentName == parameterInput->GetName() )
			{
				CKParameterOut *parameterOutput = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetDesignerSpecifiedList);

				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterOutput->GetType()), FALSE);
				context->OutputToConsole(context->GetParameterManager()->ParameterTypeToName(parameterInput->GetType()), FALSE);
				
				parameterOutput->CopyValue (parameterInput->GetDirectSource());
				break;
			}
		}
	}

	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentType, typeName.Str(), strlen (typeName.Str()) + 1 );
	behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetArgumentName, argumentName.Str(), strlen (argumentName.Str()) + 1 );

	behavior->ActivateOutput (EGBLBuildCommandBehOutputs::GetNextParameterValue);

	return 0;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:57,代码来源:GBLBuildCommand.cpp

示例8: BehaviourFunction

/*
 *******************************************************************
 * Function: int BehaviourFunction() 
 *
 * Description : Returns the number of plugins in this DLL
 *		
 * Paramters :
 *    CKBehaviorContext& r The virtools behaviour context
 *
 * Returns : One of the many virtools return values
 *
 *******************************************************************
 */
int CGBLFileSystem::BehaviourFunction(const CKBehaviorContext& behContext)
{
	BOOL error = FALSE;

	// Quick bit of error checking
	CKBehavior* beh = behContext.Behavior;
	CKBeObject* beObject = beh->GetTarget();
	int fileSystemBrowseMode = 0;

    if (!beObject)
	{
       error = TRUE;
	}

	if (!error)
	{
		// Reset On input, if active
		if (beh->IsInputActive(eBehInputOn)) 
		{
			beh->ActivateInput(eBehInputOn, FALSE);

			// Clear error message output
			beh->SetOutputParameterValue(eParamOutputErrorMsg, EMPTY_STRING);
		}

		// see which mode we are in
		beh->GetInputParameterValue(eParamInputMode, &fileSystemBrowseMode);
	}

	if (!error)
	{
		// See if we have the special case
		char *currentFolder = NULL;
		currentFolder = (char*)(beh->GetInputParameterReadDataPtr(eParamInputCurrentFolder));

		XString scannedFolder = currentFolder;

		if (currentFolder) 
		{
			// special case takes priority over FILES / FOLDER mode
			if (strcmp(currentFolder,SPECIAL_CASE)==0)
			{
				beh->SetOutputParameterValue(eParamOutputScannedFolder, scannedFolder.CStr(),scannedFolder.Length()+1 );
				if (fileSystemBrowseMode == eFolder)
				{			
					if (GetLogicalDrives(beh))
					{
						// Everythings gone ok we have a list of the logical drives
						beh->ActivateOutput(eBehOutputDone, TRUE);
					}
					else
					{
						// Something went wrong
						beh->SetOutputParameterValue(eParamOutputErrorMsg, "Failed To Scan The Logical Drives");
						beh->ActivateOutput(eBehOutputError, TRUE);
					}
				}
				else
				{
					//  Cant scan for files in the SPECIAL_CASE
					// Get the destination data array and clear it out
					CKDataArray* dataArray = static_cast<CKDataArray*>(beh->GetInputParameterObject(eParamInputDataArray));
					if (!dataArray)
					{
						CGBLWidget::OutputBBErrorMsg(beh, "Please attatch an array to the BB");
					}
					else
					{
						dataArray->Clear();
						dataArray->AddRow();
						int currentRow = dataArray->GetRowCount()-1; // 0 index
						dataArray->SetElementStringValue(currentRow,NAME_COLUMN,NOT_FOUND);
						beh->ActivateOutput(eBehOutputDone, TRUE);
					}
					
				}
			}
			else
			{
				// add a "\" to the end, it makes the ouput consistent.
				int len = strlen (scannedFolder.CStr());
				if ((scannedFolder[len-1])!=SINGLE_SEPERATOR)
				{
					scannedFolder << SINGLE_SEPERATOR;
				}

				// Try to scan the passed folder
//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLFileSystem.cpp

示例9: BehaviourFunction


//.........这里部分代码省略.........
    ent->GetExtents(fullUVRect, clientRect);

    // Check for Select b-in
    if (beh->IsInputActive(eBehInputSelect)) 
    {
        // Reset b-in
        beh->ActivateInput(eBehInputSelect, FALSE);

        int select = 0;
        beh->GetInputParameterValue(eParamInputSelectedItem, &select);

        // Check we are in single selection mode
        int selectionType = 0;
        beh->GetLocalParameterValue(eLocalParamSelectionType, &selectionType);
        if (selectionType == eSelectionTypeSingleSelection)
        {
            // Is this row selectable?
            CKBOOL selectable = FALSE;
            stringListArray->GetElementValue(select, CGBLWidget::eStringListArrayColumnSelectable, &selectable);
            if (selectable || (select < 0) || (select >= stringListArray->GetRowCount()) ) 
            {
                // Select only this row
                for (int selRow = 0;selRow < stringListArray->GetRowCount();selRow++) 
                {
                    CKBOOL bSelect = (selRow == select);
                    stringListArray->SetElementValue(selRow, CGBLWidget::eStringListArrayColumnSelected, &bSelect);
                }

                // Set focus to this item too
                if (selectable) 
                    beh->SetLocalParameterValue(eLocalParamFocussedItem, &select);

                // Update selected item p-out
                beh->SetOutputParameterValue(eParamOutputSelectedItem, &select);

                // Activate new selection b-out
                beh->ActivateOutput(eBehOutputNewSelection);

                // Do we need to scroll?
                int scrollOffset;
                beh->GetLocalParameterValue(eLocalParamScrollOffset, &scrollOffset);

                VxRect stringListRect = GetRectStringList(clientRect, fontHeight, columnsArray);
                if (!CGBLWidget::GetListRowRect(stringListRect, select, scrollOffset, stringListArray->GetRowCount(),
                    fontHeight, NULL)) 
                {
                        
                    // Set the scroll offset to the focussed item
                    scrollOffset = select;
                    beh->SetLocalParameterValue(eLocalParamScrollOffset, &scrollOffset);
                }
            }
        }
    }

    // Check for Focus b-in
    if (beh->IsInputActive(eBehInputFocus)) 
    {
        // Reset b-in
        beh->ActivateInput(eBehInputFocus, FALSE);

        // Set focus
        int nFocus = 0;
        beh->GetInputParameterValue(eParamInputFocusItem, &nFocus);

        // Copy to focus item and scroll offset
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:67,代码来源:GBLListBox.cpp

示例10: PMaterialIterator

int PMaterialIterator(const CKBehaviorContext& behcontext)
{
	
	CKBehavior* beh = behcontext.Behavior;

	CKContext* ctx = behcontext.Context;

	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	if (beh->IsInputActive(0))
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//we reset our session counter
		int sessionIndex=-1;
		beh->SetOutputParameterValue(0,&sessionIndex);


		LMaterials*sResults = NULL;
		beh->GetLocalParameterValue(0,&sResults);
		if (!sResults)
		{
			sResults = new LMaterials();
		}else
			sResults->clear();


		NxScene * scene = GetPMan()->getDefaultWorld()->getScene();
		for(int i = 0 ; i < GetPMan()->getDefaultWorld()->getScene()->getNbMaterials() ; i ++)
		{
		
			NxMaterial *currentMaterial = scene->getMaterialFromIndex(i);

			sResults->push_back(currentMaterial);
		}

		beh->SetLocalParameterValue(0,&sResults);



		if (sResults->size())
		{
			beh->ActivateInput(1);
		}else
		{
			beh->ActivateOutput(0);
			return 0;
		}
	}




	if( beh->IsInputActive(1) )
	{
		beh->ActivateInput(1,FALSE);

		int currentIndex=0;	CKParameterOut *pout = beh->GetOutputParameter(0);		pout->GetValue(&currentIndex);
		currentIndex++;



		LMaterials *sResults = NULL;	beh->GetLocalParameterValue(0,&sResults);
		if (!sResults)		{			beh->ActivateOutput(0);			return 0;		}

		if (currentIndex>=sResults->size())
		{
			sResults->clear();
			beh->ActivateOutput(0);
			return 0;
		}

		NxMaterial * material =  sResults->at(currentIndex);
		if (material!=NULL)
		{

			int sIndex = currentIndex+1;
			beh->SetOutputParameterValue(0,&sIndex);

			

					
			//SetOutputParameterValue<int>(beh,O_XML,material->xmlLinkID);
			SetOutputParameterValue<float>(beh,O_DFRICTION,material->getDynamicFriction());
			SetOutputParameterValue<float>(beh,O_SFRICTION,material->getStaticFriction());

			SetOutputParameterValue<float>(beh,O_RES,material->getRestitution());

			SetOutputParameterValue<float>(beh,O_DFRICTIONV,material->getDynamicFrictionV());
			SetOutputParameterValue<float>(beh,O_SFRICTIONV,material->getStaticFrictionV());

			SetOutputParameterValue<VxVector>(beh,O_ANIS,getFrom(material->getDirOfAnisotropy()));
			SetOutputParameterValue<int>(beh,O_FCMODE,material->getFrictionCombineMode());
			SetOutputParameterValue<int>(beh,O_RCMODE,material->getFrictionCombineMode());
			SetOutputParameterValue<int>(beh,O_FLAGS,material->getFlags());
		}

//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:vt,代码行数:101,代码来源:PMaterialIterator.cpp

示例11: ARTPlusPatternTransformation

int ARTPlusPatternTransformation(const CKBehaviorContext& BehContext)
{
	CKBehavior* beh = BehContext.Behavior;
	CKBOOL detected = FALSE;
	int patternID = -1;
	int markerId = -1;
	float buffer[16];
	float patternWidth = 8.0f;
	CK3dEntity* Object = NULL;
	VxQuaternion quat = VxQuaternion();
	VxVector pos = VxVector();
	VxVector scale = VxVector();

	float gl_para[4][4] = { {1.0f, 0.0f, 0.0f, 0.0f},
							{0.0f, 1.0f, 0.0f, 0.0f},
							{0.0f, 0.0f, 1.0f, 0.0f},
							{0.0f, 0.0f, 0.0f, 1.0f} };

	float gl_tmp[4][4] =  { {0.0f, 0.0f, 0.0f, 0.0f},
							{0.0f, 0.0f, 0.0f, 0.0f},
							{0.0f, 0.0f, 0.0f, 0.0f},
							{0.0f, 0.0f, 0.0f, 0.0f} };

	float koordSys[4][4] = { {1.0f, 0.0f, 0.0f, 0.0f},
							 {0.0f, 0.0f, 1.0f, 0.0f},
							 {0.0f, 1.0f, 0.0f, 0.0f},
							 {0.0f, 0.0f, 0.0f, 1.0f} };
 
	float koordSys2[4][4] = { {1.0f, 0.0f, 0.0f, 0.0f},
							  {0.0f, -1.0f, 0.0f, 0.0f},
							  {0.0f, 0.0f, 1.0f, 0.0f},
							  {0.0f, 0.0f, 0.0f, 1.0f} };

	beh->ActivateInput(0, FALSE);
	beh->ActivateOutput(0);

	if(ARTPlusInitialized == true)
	{
		// get object
		Object = CK3dEntity::Cast(beh->GetInputParameterObject(IN_OBJECT));
		if(Object==NULL)  return CKBR_BEHAVIORERROR;

		if(markerInfo!=NULL && numMarkers>0)
		{
			// Get pattern id
			beh->GetInputParameterValue(IN_PATTERN_NUMBER, &patternID);

			// Get pattern width
			beh->GetInputParameterValue(IN_PATTERN_WIDTH, &patternWidth);

			// define size of the marker
			tracker->setPatternWidth(patternWidth);

			markerId = findMarker(patternID);
			if(	markerId>=0 && markerInfo[markerId].id==patternID)
			{
				ARFloat	patt_center[2] = {0.0f, 0.0f};
				tracker->calcOpenGLMatrixFromMarker(&markerInfo[markerId], patt_center, patternWidth, (float *)buffer);

				detected = TRUE;

				for( int j = 0; j < 4; j++ )
				{
					for( int i = 0; i < 4; i++ )
					{
						gl_para[j][i] = buffer[j*4+i];
					}
				}

				for( int j = 0; j < 4; j++ )
				{
					for( int i = 0; i < 4; i++ )
					{
						gl_tmp[j][i] = 0.0;
						for(int k=0 ; k<4 ; k++)
						{
							gl_tmp[j][i] += koordSys[j][k]*gl_para[k][i];
						}
					}
				}

				for( int j = 0; j < 4; j++ )
				{
					for( int i = 0; i < 4; i++ )
					{
						gl_para[j][i] = 0.0;
						for(int k=0 ; k<4 ; k++)
						{
							gl_para[j][i] += gl_tmp[j][k]*koordSys2[k][i];
						}
					}
				}
			}
		}

		VxMatrix mat = VxMatrix(gl_para);
		Vx3DDecomposeMatrix(mat, quat, pos, scale);

		// Set true, if marker is detected
		beh->SetOutputParameterValue(OUT_DETECTED, &detected, 0);
//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:vt,代码行数:101,代码来源:ARTPlusPatternTransformation.cpp

示例12: DoBuildCommand

/*
*******************************************************************
* Function: int CGBLBuildCommand::DoBuildCommand(const CKBehaviorContext& behaviorContext)
*
* Description : Starts building the command. Find required GBLWaitForCommand BB,
*				determine its target (GBLTarget) and take corresponded actions.
*
* Parameters :
*    behaviourContext    r   Behavior context reference, which gives 
*                            access to frequently used global objects 
*                            ( context, level, manager, etc... )
*
*******************************************************************
*/
int CGBLBuildCommand::DoBuildCommand(const CKBehaviorContext& behaviorContext)
{
	CKBehavior* behavior = behaviorContext.Behavior;
  	CKContext* context = behaviorContext.Context;

	//set to initial state
	int stateValue = EGBLBuildCommandState::Initial;
	behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos, &stateValue);

	int initialParameterPosition = 0;
	behavior->SetLocalParameterValue (currentParameterPositionLocalPos, &initialParameterPosition);

	char *emptyString = "";
	behavior->SetLocalParameterValue(commandStringLocalPos, emptyString, strlen(emptyString)+1);

	ClearParameterOutputs(behaviorContext);


	int targetID = 0;
	behavior->GetInputParameterValue (EGBLBuildCommandParamInputs::SetCommandID, &targetID);


	CKBehavior* targetBB = CGBLCommandUtil::GetTargetCommand (targetID, behaviorContext);

	if (targetBB == NULL)
	{
		CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
		TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_TARGET_NOT_FOUND,GBLFC_ERROR_BUILDCOMMAND_TARGET_NOT_FOUND_DESC);

		behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
		return CKBR_OK;
	}
	CK_ID targetBBID = targetBB->GetID();
	behavior->SetLocalParameterValue (targetBBLocalPos, &targetBBID);

	int gblTatgetType = -1;
	targetBB->GetLocalParameterValue (CGBLWaitForCommand::EGBLWaitForCommandLocalVariables::EGBLFCTarget, &gblTatgetType);

	switch (gblTatgetType)
	{
	case CGBLWaitForCommand::EGBLFCTarget::Untargeted:
		{
			XString commandString;
			commandString << targetID << CGBLCommandUtil::commandSeparator;

			behavior->SetLocalParameterValue(commandStringLocalPos, commandString.Str(), strlen(commandString.Str()) + 1 );

			return DoHandleNextLocalArgument (behaviorContext);
		}
		break;

		case CGBLWaitForCommand::EGBLFCTarget::Player:
		case CGBLWaitForCommand::EGBLFCTarget::Team:
		{
			//set state to GetTargets
			int stateValue = EGBLBuildCommandState::GetTargets;
			behavior->SetLocalParameterValue (gblBuildCommandStateLocalPos,&stateValue);

			//get list of recipients
			behavior->SetOutputParameterValue (EGBLBuildCommandParamOutputs::GetTarget, &gblTatgetType); 
			behavior->ActivateOutput (EGBLBuildCommandBehOutputs::ListRecipients);
			return CKBR_OK;
		}
		break;

		default:
			CKParameterOut *parameterOutError = behavior->GetOutputParameter(EGBLBuildCommandParamOutputs::GetError);
			TGBLError::SetTGBLError(parameterOutError,CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,GBLFC_ERROR_BUILDCOMMAND_UNSPECIFIED_RECIPIENT,GBLFC_ERROR_BUILDCOMMAND_UNSPECIFIED_RECIPIENT_DESC);

			behavior->ActivateOutput (EGBLBuildCommandBehOutputs::Error);
		break;
	}
	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:88,代码来源:GBLBuildCommand.cpp

示例13: RetrieveCI


//.........这里部分代码省略.........

	CGBLSMStorageManager *storageManager = static_cast<CGBLSMStorageManager *>(ctx->GetManagerByGuid(GBLSMStorageManagerGUID));
	IGBLSMConfigurationAccess* smCIS = storageManager->GetConfigurationInterface();

	
	currentCI = new CGBLCI("temp",CKPGUID_INT);
	
	CGBLCOError returnValue  = 	accessInterface->GetCI(currentCI,idCI);

	//get error parameter
	CKParameterOut *parameterOutError = beh->GetOutputParameter(BEH_PIN_OUT_INDEX_ERROR);
	// check results and output error
	if (returnValue == CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{
		//////////////////////////////////////////////////////////////////////////
		// output values :
		CKParameterOut *pout = beh->GetOutputParameter(1);
		if(getAsString)
		{
			//output  the value 
			VxScratch sbuffer(currentCI->realValue->GetDataSize());
			CKSTRING buffer = (CKSTRING)sbuffer.Mem();
			currentCI->realValue->GetStringValue(buffer);
			pout->SetStringValue(buffer);
		}else
		{

			CKParameterManager *pm = static_cast<CKParameterManager*>(ctx->GetParameterManager());
			if ( beh->GetOutputParameter(0)->GetType() == currentCI->realValue->GetType() )
			{
				pout->CopyValue(currentCI->realValue);
			}else
			{
				pout->SetType(currentCI->realValue->GetType());
				return CKBR_PARAMETERERROR;
			}
		}



		//////////////////////////////////////////////////////////////////////////
		// output custom attributes :
		if(outputAttriubtes)
		{
			//output unique name : 
			CKParameterOut *poutName = beh->GetOutputParameter(BEH_OUT_INDEX_UNAME);
			poutName->SetStringValue(currentCI->name.Str());		
			//output description : 
			CKParameterOut *poutDescription = beh->GetOutputParameter(BEH_OUT_INDEX_DESCRIPTION);
			poutDescription->SetStringValue(currentCI->description.Str());

			//output default value : 
			CKParameterOut *poutDefaultValue = beh->GetOutputParameter(BEH_OUT_INDEX_DEFAULTVALUE);
			TypeCheckedParameterCopy(poutDefaultValue,currentCI->defaultValue);

			if(getAsString)
			{
				XString outDefValue  = GBLCommon::ParameterTools::GetParameterAsString(currentCI->defaultValue);
				poutDefaultValue->SetStringValue( outDefValue.Str() );
			}else{
				poutDefaultValue->CopyValue(currentCI->defaultValue,TRUE);
			}

			//output flags :
			int flags = 0 ;
			beh->SetOutputParameterValue(BEH_OUT_INDEX_FLAGS,&currentCI->flags);

			//output type 
			int type = ctx->GetParameterManager()->ParameterGuidToType(currentCI->type);
			beh->SetOutputParameterValue(BEH_OUT_INDEX_TYPE,&type);

		}
		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;

}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:101,代码来源:GBLCIRetrieveCI.cpp

示例14: DOOwnerChanged

int DOOwnerChanged(const CKBehaviorContext& behcontext)
{
    CKBehavior* beh = behcontext.Behavior;
    CKMessageManager* mm = behcontext.MessageManager;
    CKContext* ctx = behcontext.Context;

    //////////////////////////////////////////////////////////////////////////
    //connection id :
    int connectionID = vtTools::BehaviorTools::GetInputParameterValue<int>(beh,0);

    //////////////////////////////////////////////////////////////////////////
    //we come in by input 0 :
    if (beh->IsInputActive(0))
    {
        beh->ActivateOutput(0);
        beh->ActivateInput(0,FALSE);
    }

    if (beh->IsInputActive(1))
    {
        beh->ActivateOutput(1);
        beh->ActivateInput(1,FALSE);
        return 0;
    }

    //////////////////////////////////////////////////////////////////////////
    //the object :
    CK3dEntity *obj= (CK3dEntity*)beh->GetInputParameterObject(1);
    if (!obj)
    {
        beh->ActivateOutput(4);
        return CKBR_ACTIVATENEXTFRAME;
    }

    //////////////////////////////////////////////////////////////////////////
    //network ok  ?
    xNetInterface *cin  = GetNM()->GetClientNetInterface();
    if (!cin)
    {
        CKParameterOut *pout = beh->GetOutputParameter(1);
        XString errorMesg("distributed object creation failed,no network connection !");
        pout->SetStringValue(errorMesg.Str());
        beh->ActivateOutput(4);
        return CKBR_ACTIVATENEXTFRAME;
    }


    IDistributedObjects*doInterface  = cin->getDistObjectInterface();
    //////////////////////////////////////////////////////////////////////////
    //we come in by input 0 :
    xDistributedObject *dobj = doInterface->getByEntityID(obj->GetID());
    if (!dobj)
    {
        CKParameterOut *pout = beh->GetOutputParameter(1);
        XString errorMesg("There is no such an object");
        pout->SetStringValue(errorMesg.Str());
        beh->ActivateOutput(4);
    } else
    {
        if (dobj->getOwnershipState().test(1 << E_DO_OS_RELEASED) && dobj->getOwnershipState().test( 1 << E_DO_OS_OWNERCHANGED) )
        {
            beh->ActivateOutput(3);
        }

        if (dobj->getOwnershipState().testStrict(1 << E_DO_OS_OWNERCHANGED))
        {
            dobj->getOwnershipState().set( 1<<E_DO_OS_OWNERCHANGED ,false );
            int newCLientID   = dobj->getUserID();
            beh->SetOutputParameterValue(0,&newCLientID);
            beh->ActivateOutput(2);
        }
    }
    return CKBR_ACTIVATENEXTFRAME;
}
开发者ID:,项目名称:,代码行数:74,代码来源:

示例15: BehaviourFunction

/*
 *******************************************************************
 * Function: int BehaviourFunction() 
 *
 * Description : Returns the number of plugins in this DLL
 *		
 * Paramters :
 *    CKBehaviorContext& r The virtools behaviour context
 *
 * Returns : One of the many virtools return values
 *
 *******************************************************************
 */
int CGBLLOGetMOStatus::BehaviourFunction(const CKBehaviorContext& behContext)
{
	CKBehavior* beh = behContext.Behavior; 
	CKBOOL localError = false;
	CGBLCOError retVal(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

	MeasuredObjectiveControllerMgr* MOMngr = 
        static_cast<MeasuredObjectiveControllerMgr*>(behContext.Context->GetManagerByGuid(MeasuredObjectiveControllerMgrGUID));

	// Check to see if we got the manager ok
	if (!MOMngr) 
	{
		assert(NULL);
		return CKBR_OK;
	} 

	if (beh->IsInputActive(eBehInputStart)) 
	{
		// Get the details of the MO P-In
		CKParameterIn *pIn = beh->GetInputParameter(eParamInputMO);
		CKParameter *moParam = pIn->GetRealSource();
		// Ensure we read the P-In ok
		if (!moParam)
		{
			// Report the error
			CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
			TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
					GBLLO_ERROR_NO_PARAM_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
			beh->ActivateOutput(eBehOutputError, TRUE);
			localError = true;
		}
		if (!localError)
		{
			// Get the data from the P-In
			CGBLMOData *moData = static_cast<CGBLMOData*>(moParam->GetAppData());
			if (moData)
			{
				// Get the name from the MO and use this to get the
				// runtime MO from the controller
				XString moName = moData->GetName();
				CGBLLOMeasuredObjective *mo=NULL;
				retVal=MOMngr->GetRunTimeMO(moName,mo);
				// See if the controller gave us the MO
				if((retVal==CGBLCOError::EGBLCOErrorType::GBLCO_OK)&&(mo))
				{
					// Get the status of the MO
					bool moStatus=mo->GetMOStatus();
					// return the status of the MO back to Virtools Dev
					beh->SetOutputParameterValue(eParamOutputGetStatus, &moStatus);
				}
			}
			else
			{
				// Report the fact that we couldnt create a runtime MO from the param
				CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
				TGBLError::SetTGBLError(pOut, CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,
						GBLLO_ERROR_NO_DATA_FROM_BB,GBLLO_ERROR_NO_DATA_FROM_BB_DESC);
				beh->ActivateOutput(eBehOutputError, TRUE);
				localError = true;
			}
		}
	}

	if (localError)
	{
		// error allready dealt with
	}
	else if (retVal!=CGBLCOError::EGBLCOErrorType::GBLCO_OK)
	{	
		// Report the error back to Virtools dev
		CKParameterOut *pOut = beh->GetOutputParameter(eParamOutputGetError);
		const char* errorString = retVal;
        TGBLError::SetTGBLError(pOut, retVal,retVal,(CKSTRING)errorString);
		beh->ActivateOutput(eBehOutputError, TRUE);
	}
	else
	{
		// We are ok
		beh->ActivateOutput(eBehOutputDone, TRUE);
	}

	return CKBR_OK;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:96,代码来源:CGBLLOGetMOStatus.cpp


注:本文中的CKBehavior::SetOutputParameterValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。