本文整理汇总了C++中TLeafList::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ TLeafList::GetName方法的具体用法?C++ TLeafList::GetName怎么用?C++ TLeafList::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLeafList
的用法示例。
在下文中一共展示了TLeafList::GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
boost::shared_ptr<TriMesh>
GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
// try a direct match
string meshName = name;
TMeshMap::const_iterator meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
TLeafList importer;
ListChildrenSupportingClass<MeshImporter>(importer);
if (importer.size() == 0)
{
GetLog()->Error()
<< "(GeometryServer) Warning: no MeshImporter registered\n";
return boost::shared_ptr<TriMesh>();
}
// try to mangle the name
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
string str = importer->MangleName(name, parameter);
if (str != meshName)
{
meshName = str;
meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
}
}
// try to import the mesh
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
boost::shared_ptr<TriMesh> mesh = importer->ImportMesh(name,parameter);
if (mesh.get() == 0)
{
continue;
}
string meshName = mesh->GetName();
if (meshName.empty())
{
meshName = name;
mesh->SetName(name);
}
GetLog()->Debug() << "(GeometryServer) imported mesh '" << meshName
<< " with '" << importer->GetName() << "'\n";
if (mesh.get() == 0 || mesh->GetVertexCount() == 0)
{
continue;
}
RegisterMesh(mesh);
return mesh;
}
GetLog()->Error() << "(GeometryServer) ERROR: cannot import mesh '"
<< name << "'\n";
return boost::shared_ptr<TriMesh>();
}
示例2: ImportScene
bool SceneServer::ImportScene(const string& fileName, boost::shared_ptr<BaseNode> root,
boost::shared_ptr<ParameterList> parameter)
{
string file;
if (! GetFile()->LocateResource(fileName, file))
{
GetLog()->Error() << "(SceneServer) ERROR: cannot locate file '"
<< fileName << "'\n";
return false;
}
if (root.get() == 0)
{
GetLog()->Error()
<< "(SceneServer) ERROR: NULL node given as ImportScene "
<< "root node, fileName was " << fileName << "\n";
}
GetLog()->Debug() << "(SceneServer) ImportScene fileName=" << fileName
<< " root=" << root->GetFullPath() << "\n";
TLeafList importer;
ListChildrenSupportingClass<SceneImporter>(importer);
if (importer.empty())
{
GetLog()->Error()
<< "(SceneServer) Warning: no SceneImporter registered\n";
}
// because the importer will create ODE objects,
// so we have to lock the ODE
boost::recursive_mutex::scoped_lock lock(mMutex);
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<SceneImporter> importer =
shared_static_cast<SceneImporter>(*iter);
importer->SetSceneDict(&SceneDict::GetInstance());
GetLog()->Debug()
<< "(SceneServer) trying importer " << importer->GetName() << std::endl;
if (importer->ImportScene(file,root,parameter))
{
GetLog()->Debug()
<< "(SceneServer) imported scene file '"
<< file << " with '"
<< importer->GetName()
<< " at " << root->GetFullPath() << endl;
RemoveTransformPaths(root);
// mark the corresponding scene as modified
boost::shared_ptr<Scene> scene = root->GetScene();
if (scene.get() != 0)
{
scene->SetModified(true);
}
return true;
}
}
GetLog()->Error() << "(SceneServer) ERROR: cannot import scene file '"
<< file << "'\n";
return false;
}