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


C++ CKParameterManager::ParameterTypeToGuid方法代码示例

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


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

示例1: 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;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:67,代码来源:xRegisterAttributeType.cpp

示例2: ParamOpParameterValidateString

/*
*******************************************************************
* Function: ParamOpParameterValidateString()
*
* Description :	This function validates a string for a correct float or an integer.

* Parameters :		context, r : The virtools context.
							p1 ( type : "String" ),r : The given string.
							p2 ( type : "Registered Parameter" ),r : The given virtools type. Used to determine whether the string contain a dot or not.
							res ( type : "Integer" ), w : The result of the validation.
* Returns : void
*******************************************************************
*/
void ParamOpParameterValidateString(CKContext* context, CKParameterOut* res, CKParameterIn* p1, CKParameterIn* p2)
{
    assert(context && p1 && p2 && res );

    //get the string which want to be validate
    CKSTRING stringValue =  GBLCommon::ParameterTools::GetParameterAsString(p1->GetRealSource());

    //get the supertype of the parameter type :
    CKParameterManager *pm = static_cast<CKParameterManager *>(context->GetParameterManager());
    CKParameterType parameterType =0;
    p2->GetValue(&parameterType);

    using namespace GBLCommon::enumerations;
    using namespace GBLCommon::ParameterTools;
    CO_EGBL_VirtoolsSuperType superType = GetVirtoolsSuperType(context,pm->ParameterTypeToGuid(parameterType) );

    int sscanf_result= GBLCommon::ParameterTools::IsNumeric(stringValue,superType);

    res->SetValue(&sscanf_result);
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:33,代码来源:GBLCommonParameterOperations.cpp

示例3: ParamOpParameterTypeToSuperType

/*
*******************************************************************
* Function: ParamOpParameterTypeToSuperType()
*
* Description :	This function returns the virtools super type for a given virtools type.

* Parameters :		context, r : The virtools context.
							p1 ( type : "Registered Parameter" ),r : The given virtools type.
							p2 : Not used.
							res ( type : CO_EGBL_VirtoolsSuperType ), w : The filled virtools super type.
* Returns : void
*******************************************************************
*/
void ParamOpParameterTypeToSuperType(CKContext* context, CKParameterOut* res, CKParameterIn* p1, CKParameterIn* p2)
{

    assert(context && p1);

    CKParameterManager *pm = static_cast<CKParameterManager *>(context->GetParameterManager());
    CKParameterType parameterType =0;


    p1->GetValue(&parameterType);

    using namespace GBLCommon::enumerations;
    using namespace GBLCommon::ParameterTools;

    CKGUID guid =pm->ParameterTypeToGuid(parameterType);

    CO_EGBL_VirtoolsSuperType superType = GetVirtoolsSuperType(context,guid);

    res->SetValue(&superType);


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

示例4: WidgetInfo

/*
*******************************************************************
* Function: CreateWidgetInfo()
*
* Description :	CreateWidgetInfo returns an handy info about an parameter type an a
						given string value of this parameter.
                        
* Parameters :	CKContext* context, r : the virtools context.
						CKParameterType parameterType, r : the type to test.
						XString stringValue,r : the string value of the given type.

* Returns : WidgetInfo
*******************************************************************
*/
vtTools::Structs::WidgetInfo* 
vtTools::ParameterTools::
CreateWidgetInfo(CKContext* context,
				 CKParameterType parameterType,
				 XString stringValue)
{
	using namespace vtTools::Structs;
	using namespace vtTools::Enums;
	using namespace vtTools::ParameterTools;


	CKParameterManager *pm = static_cast<CKParameterManager *>(context->GetParameterManager());

	CKGUID guid =pm->ParameterTypeToGuid(parameterType);

	WidgetInfo* result = new WidgetInfo();

	result->parameterInfo  =  GetParameterInfo(context,parameterType);

	CKParameterLocal *localCopy = context->CreateCKParameterLocal("buffer",guid,TRUE);

	localCopy->SetStringValue(stringValue.Str());


	switch(result->parameterInfo.superType) {

		//////////////////////////////////////////////////////////////////////////	color  //////////////////////////////////////////////////////////////////////////
		case vtCOLOUR:
			{
				WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
				VxColor realValue;
				localCopy->GetValue(&realValue);

				DWORD32 dColor = realValue.GetRGBA();

				int r = ColorGetRed(dColor);
				int g = ColorGetGreen(dColor);
				int b = ColorGetBlue(dColor);
				int a = ColorGetAlpha(dColor);

				item->value << r << "," << g << "," << b << "," << a;

				item->widgetType = EVT_WIDGET_COLOR_SELECTION;
				result->items.PushBack(item);
				break;
			}
		//////////////////////////////////////////////////////////////////////////	integer //////////////////////////////////////////////////////////////////////////
		case vtFLOAT:
			{
				WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
				float realValue;
				localCopy->GetValue(&realValue);
				item->value << realValue;
				item->widgetType = EVT_WIDGET_EDIT_TEXT;
				result->items.PushBack(item);
				break;
			}
		//////////////////////////////////////////////////////////////////////////	integer //////////////////////////////////////////////////////////////////////////
		case vtINTEGER:
			{
				WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
				int realValue;
				localCopy->GetValue(&realValue);
				item->value << realValue;
				item->widgetType = EVT_WIDGET_EDIT_TEXT;
				result->items.PushBack(item);
				break;
			}
		//////////////////////////////////////////////////////////////////////////	bool //////////////////////////////////////////////////////////////////////////
		case vtBOOL:
			{
				WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
				CKBOOL realValue;
				localCopy->GetValue(&realValue);
				item->value << realValue;
				item->widgetType = EVT_WIDGET_CHECK_BUTTON;
				result->items.PushBack(item);
				break;
			}

		//////////////////////////////////////////////////////////////////////////	string or file //////////////////////////////////////////////////////////////////////////
		case vtFile :
			{
				WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
				item->value = stringValue;
				item->widgetType = EVT_WIDGET_FILE_SELECTION;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例5:

/*
*******************************************************************
* Function: GetParameterInfo()
*
* Description :	GetParameterInfo returns an info about a virtools type. 
						Example : Vector4D returns :
										result.horizontalItems = 4 ;
										result.verticalItems = 1 ;
										result.memberType =  vtFLOAT
										result.superType = vtQUATERNION; 

* Parameters :	CKContext* context, r : the virtools context.
						CKParameterType parameterType, r : the type to test.
* Returns : ParameterInfo
*
*******************************************************************
*/
vtTools::Structs::ParameterInfo
vtTools::ParameterTools::GetParameterInfo(CKContext* context,CKParameterType parameterType)
{

	assert(context);

	using namespace vtTools::Structs;
	using namespace vtTools::Enums;
	using namespace vtTools::ParameterTools;

    CKParameterManager *pm = static_cast<CKParameterManager *>(context->GetParameterManager());

	ParameterInfo result;
   
	result.memberType =   vtTools::ParameterTools::GetParameterMemberInfo(context,parameterType);
	result.superType =     vtTools::ParameterTools::GetVirtoolsSuperType(context,pm->ParameterTypeToGuid(parameterType));


	switch(result.superType) 
	{

		case vtFLAGS:
		{    
			CKFlagsStruct *flagStruct = pm->GetFlagsDescByType(parameterType);
			if (flagStruct)
			{ 
				result.horizontalItems = 1 ;
				result.verticalItems = flagStruct->GetNumFlags() ;

			}
			break;
		}
		case vtENUMERATION:
		{    
			CKEnumStruct* enumStruct = pm->GetEnumDescByType(parameterType);
			if (enumStruct)
			{
					result.horizontalItems = 1 ; 
					result.verticalItems = enumStruct->GetNumEnums();
					break;
			}
		}
		case vtBOOL:
		case vtINTEGER:
		case vtFLOAT:
		case vtFile:
		case vtSTRING:
			result.horizontalItems		= 1;
			result.verticalItems			= 1;
			break;
		case vtVECTOR2D:
			result.horizontalItems = 2;
			result.verticalItems = 1;
			break;
		case vtRECTANGLE:
			result.horizontalItems = 2;
			result.verticalItems	    = 2;
			break;
		case vtVECTOR: 
			result.horizontalItems = 3;
			result.verticalItems	    = 1;
			break;
		case vtBOX:
			result.horizontalItems = 3;
			result.verticalItems = 2;
			break;
		case vtQUATERNION:
		case vtCOLOUR:
			result.horizontalItems = 4;
			result.verticalItems	    = 1;
			break;
		case vtMATRIX:
			result.horizontalItems = 4;
			result.verticalItems	    = 4;
			break;
		default:
			{
								result.horizontalItems = 0;
								result.verticalItems	    = 0;
			break;
			}
	}
	return result;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: err

//************************************
// Method:    vt_GetInVal
// FullName:  vt_GetInVal
// Access:    public static 
// Returns:   PyObject *
// Qualifier:
// Parameter: PyObject * self
// Parameter: PyObject * args
//************************************
static PyObject *vt_GetInVal( PyObject * self, PyObject * args )
{

	int size = PyTuple_Size(args);
	int bid, index;
	PyArg_ParseTuple(args, "ii", &bid, &index); 

	CK_ID cid = bid; 
	CKBehavior *beh = static_cast<CKBehavior*>(pym->m_Context->GetObject(cid)); 
	if (size!=2)
	{
		pym->m_Context->OutputToConsole("PyError : This function needs 2 arguments : \n\t bid,index");
		Py_RETURN_NONE;
	}

	using namespace vtTools;
	using namespace vtTools::Enums;

	CKParameterManager *pam = static_cast<CKParameterManager *>(pym->m_Context->GetParameterManager());

	if (index < beh->GetInputParameterCount() )
	{
		CKParameterIn *ciIn = beh->GetInputParameter(index);

		CKParameterType pType  = ciIn->GetType();
		vtTools::Enums::SuperType sType = ParameterTools::GetVirtoolsSuperType(pym->m_Context,pam->ParameterTypeToGuid(pType));	
	
		PyObject *val;

		switch (sType)
		{
		case vtSTRING:
			{
				val = PyString_FromString( vtTools::BehaviorTools::GetInputParameterValue<CKSTRING>(beh,index ));
				break;
			}
		case vtFLOAT:
			{
				val = PyFloat_FromDouble(static_cast<float>(vtTools::BehaviorTools::GetInputParameterValue<float>(beh,index )));
				break;
			}
		case vtINTEGER:
			{
				val = PyInt_FromLong( static_cast<long>(vtTools::BehaviorTools::GetInputParameterValue<int>(beh,index )));
				break;
			}

		default :
			XString err("wrong input parameter type: ");
			err << ciIn->GetName() << "Only Types derivated from Interger,Float or String are acceptable";
			pym->m_Context->OutputToConsole(err.Str(),FALSE );
			Py_RETURN_NONE;
		}

		if (!val)
		{
			Py_DECREF(val);	  
		}
		return val;
	}
	Py_RETURN_NONE;
}
开发者ID:,项目名称:,代码行数:71,代码来源:

示例7: DOUserValueModified

int DOUserValueModified(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);





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



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

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

	//use objects name, if not specified : 
	CKSTRING name= obj->GetName();
	
	IDistributedObjects*doInterface  = cin->getDistObjectInterface();
	IDistributedClasses*cInterface = cin->getDistributedClassInterface();
    
	XString className((CKSTRING) beh->GetLocalParameterReadDataPtr(0));
	XString parameterName((CKSTRING) beh->GetLocalParameterReadDataPtr(1));

	xDistributedClass *_class = cInterface->get(className.CStr());
	
	
	//////////////////////////////////////////////////////////////////////////
	//dist class ok  ? 
	if (_class==NULL)
	{
		beh->ActivateOutput(3);
		ctx->OutputToConsoleEx("Distributed Class doesn't exists : %s",className.CStr());
		return CKBR_ACTIVATENEXTFRAME;
	}
	const char * cNAme  = _class->getClassName().getString();

	int classType  = _class->getEnitityType();
	int bcount = beh->GetInputParameterCount();

	//////////////////////////////////////////////////////////////////////////
	//we come in by input 0 : 

	

	xDistributedObject *dobjDummy = NULL;
	xDistributedObject *dobj = doInterface->getByEntityID(obj->GetID());
	if (!dobj)
	{
		beh->ActivateOutput(3);
		return CKBR_ACTIVATENEXTFRAME;
	}

	if (dobj)
	{
		xDistributedProperty * prop  = dobj->getUserProperty(parameterName.CStr());
		if (prop)
		{
			if ( dobj->getGhostUpdateBits().testStrict(1 << prop->getBlockIndex()))
			{
				CKParameterManager *pam = static_cast<CKParameterManager *>(ctx->GetParameterManager());
				CKParameterOut *ciIn = beh->GetOutputParameter(1);
				CKParameterType pType  = ciIn->GetType();

				int sType = vtTools::ParameterTools::GetVirtoolsSuperType(ctx,pam->ParameterTypeToGuid(pType));	
				int userType = xDistTools::ValueTypeToSuperType(prop->getPropertyInfo()->mValueType);
				if ( userType ==sType )
				{
					beh->ActivateOutput(2);
					dobj->getGhostUpdateBits().set(1 << prop->getBlockIndex(),false);
					switch(xDistTools::ValueTypeToSuperType(prop->getPropertyInfo()->mValueType))
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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