本文整理汇总了C++中CKParameterManager::GetEnumDescByType方法的典型用法代码示例。如果您正苦于以下问题:C++ CKParameterManager::GetEnumDescByType方法的具体用法?C++ CKParameterManager::GetEnumDescByType怎么用?C++ CKParameterManager::GetEnumDescByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKParameterManager
的用法示例。
在下文中一共展示了CKParameterManager::GetEnumDescByType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMaterialFromEntity
NxMaterialDesc* pFactory::createMaterialFromEntity(CKBeObject*object)
{
//////////////////////////////////////////////////////////////////////////
//sanity checks :
if (!object )
{
return NULL;
}
if (!object->HasAttribute(GetPMan()->att_surface_props))
{
return NULL;
}
//////////////////////////////////////////////////////////////////////////
CKParameterManager *pm = object->GetCKContext()->GetParameterManager();
int parameterType = pm->ParameterGuidToType(VTE_XML_MATERIAL_TYPE);
NxMaterialDesc *result = new NxMaterialDesc();
using namespace vtTools::AttributeTools;
XString nodeName;
int enumID = GetValueFromAttribute<int>(object,GetPMan()->att_surface_props,0);
if (enumID==0)
{
goto takeFromAttribute;
}
CKEnumStruct *enumStruct = pm->GetEnumDescByType(parameterType);
if ( enumStruct )
{
for (int i = 0 ; i < enumStruct->GetNumEnums() ; i ++ )
{
if(i == enumID)
{
nodeName = enumStruct->GetEnumDescription(i);
if (nodeName.Length())
{
result = createMaterialFromXML(nodeName.CStr(),getDefaultDocument());
if (result)
{
return result;
}
}
}
}
}
takeFromAttribute :
{
float dynamicFriction = GetValueFromAttribute<float>(object,GetPMan()->att_surface_props,1);
if (dynamicFriction >=0.0f)
{
result->dynamicFriction =dynamicFriction;
}
float statFriction = GetValueFromAttribute<float>(object,GetPMan()->att_surface_props,2);
if (statFriction>=0.0f)
{
result->staticFriction=statFriction;
}
float rest = GetValueFromAttribute<float>(object,GetPMan()->att_surface_props,3);
if (rest>=0.0f)
{
result->restitution=rest;
}
float dynamicFrictionV = GetValueFromAttribute<float>(object,GetPMan()->att_surface_props,4);
if (dynamicFrictionV >=0.0f)
{
result->dynamicFrictionV =dynamicFrictionV;
}
float staticFrictionV = GetValueFromAttribute<float>(object,GetPMan()->att_surface_props,5);
if (staticFrictionV>=0.0f)
{
result->staticFriction=staticFrictionV;
}
VxVector anis = GetValueFromAttribute<VxVector>(object,GetPMan()->att_surface_props,6);
if (anis.Magnitude()>=0.01f)
{
result->dirOfAnisotropy=pMath::getFrom(anis);
}
int fMode = GetValueFromAttribute<int>(object,GetPMan()->att_surface_props,7);
if (fMode !=-1)
{
result->frictionCombineMode=(NxCombineMode)fMode;
}
int rMode = GetValueFromAttribute<int>(object,GetPMan()->att_surface_props,8);
if (rMode !=-1)
{
result->restitutionCombineMode=(NxCombineMode)rMode;
}
//.........这里部分代码省略.........
示例2:
vtTools::Enums::SuperType
vtTools::ParameterTools::
GetVirtoolsSuperType(CKContext *ctx,
const CKGUID guid)
{
assert(ctx);
using namespace vtTools::Enums;
CKParameterTypeDesc *tdescr = ctx->GetParameterManager()->GetParameterTypeDescription(guid);
CKParameterManager *pm = static_cast<CKParameterManager *>(ctx->GetParameterManager());
if ( (pm->GetEnumDescByType(pm->ParameterGuidToType(guid))) )
{
return vtENUMERATION;
}
// parameter is a flag
if ( (pm->GetFlagsDescByType(pm->ParameterGuidToType(guid))) )
{
return vtFLAGS;
}
// is a bool :
if( (ctx->GetParameterManager()->ParameterGuidToType(guid)) == ctx->GetParameterManager()->ParameterGuidToType(CKPGUID_BOOL))
return vtBOOL;
/*// is a file :
if( (ctx->GetParameterManager()->ParameterGuidToType(guid)) == ctx->GetParameterManager()->ParameterGuidToType(GBLCO_FILE_TYPE))
return vtFile;*/
// is a string :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_STRING))
return vtSTRING;
// is a float :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_FLOAT))
return vtFLOAT;
// is a integer :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_INT))
return vtINTEGER;
// is a VxVector :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_VECTOR))
return vtVECTOR;
// is a Vx2DVector :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_2DVECTOR))
return vtVECTOR2D;
// is a VxColor :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_COLOR))
return vtCOLOUR;
// is a VxMatrix :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_MATRIX))
return vtMATRIX;
// is a VxQuaternion :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_QUATERNION))
return vtQUATERNION;
// is a Rectangle :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_RECT))
return vtRECTANGLE;
// is a Box :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_BOX))
return vtBOX;
// is a CKObject :
if(ctx->GetParameterManager()->IsDerivedFrom(guid,CKPGUID_OBJECT))
return vtOBJECT;
return vtUNKNOWN;
}
示例3: WidgetInfo
//.........这里部分代码省略.........
}
result->items.PushBack(item);
}
break;
}
////////////////////////////////////////////////////////////////////////// vector 3 //////////////////////////////////////////////////////////////////////////
case vtVECTOR:
{
for (int i = 0 ; i < 3 ; i ++ )
{
WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
VxVector VectorValue;
localCopy->GetValue(&VectorValue);
item->value << VectorValue[i];
item->widgetType = EVT_WIDGET_EDIT_TEXT;
switch(i)
{
case 0:
item->label = "x";
break;
case 1:
item->label = "y";
break;
case 2:
item->label = "z";
break;
}
result->items.PushBack(item);
}
break;
}
////////////////////////////////////////////////////////////////////////// vector4 //////////////////////////////////////////////////////////////////////////
case vtQUATERNION:
{
for (int i = 0 ; i < 4 ; i ++ )
{
WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
VxQuaternion realValue;
localCopy->GetValue(&realValue);
item->value << realValue[i];
item->widgetType = EVT_WIDGET_EDIT_TEXT;
switch(i)
{
case 0:
item->label = "x: ";
break;
case 1:
item->label = "y: ";
break;
case 2:
item->label = "z: ";
break;
case 3:
item->label = "w: ";
break;
}
result->items.PushBack(item);
}
break;
}
////////////////////////////////////////////////////////////////////////// enumeration //////////////////////////////////////////////////////////////////////////
case vtENUMERATION:
{
CKEnumStruct *enumStruct = pm->GetEnumDescByType(parameterType);
if ( enumStruct )
{
for (int i = 0 ; i < enumStruct->GetNumEnums() ; i ++ )
{
WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
item->value = enumStruct->GetEnumDescription(i);
item->widgetType = EVT_WIDGET_COMBO_BOX;
result->items.PushBack(item);
}
}
break;
}
////////////////////////////////////////////////////////////////////////// flags //////////////////////////////////////////////////////////////////////////
case vtFLAGS:
{
CKFlagsStruct*flagStruct = pm->GetFlagsDescByType(parameterType);
if ( flagStruct )
{
for (int i = 0 ; i < flagStruct->GetNumFlags() ; i ++ )
{
WidgetInfo::WidgetInfoItem *item = new WidgetInfo::WidgetInfoItem();
item->value = flagStruct->GetFlagDescription(i);
item->widgetType = EVT_WIDGET_CHECK_BUTTON;
result->items.PushBack(item);
}
}
break;
}
}
return result;
}