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


C++ TLeafList::GetName方法代码示例

本文整理汇总了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>();
}
开发者ID:unfabio,项目名称:furosimspark,代码行数:88,代码来源:geometryserver.cpp

示例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;
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:75,代码来源:sceneserver.cpp


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