コード例 #1
0
ファイル: prim.cpp プロジェクト: lvxejay/USD
 void _VisitImpl(SdfPathVector const &paths) {
     if (!paths.empty()) {
         for (SdfPath const &p: paths) {
             _workQueue.push(p);
         }
         _consumerTask.Wake();
     }
     
     if (_recurse) {
         WorkParallelForEach(
             paths.begin(), paths.end(),
             [this](SdfPath const &path) {
                 if (!path.HasPrefix(_prim.GetPath())) {
                     if (UsdPrim owningPrim = _prim.GetStage()->
                         GetPrimAtPath(path.GetPrimPath())) {
                         _VisitSubtree(owningPrim);
                     }
                 }
             });
     }
 }    
コード例 #2
0
ファイル: gl.cpp プロジェクト: 400dama/USD
static
UsdImagingEngine* _InitEngine(const SdfPath& rootPath,
                              const SdfPathVector& excludedPaths,
                              const SdfPathVector& invisedPaths,
                              const SdfPath& sharedId =
                                        SdfPath::AbsoluteRootPath(),
                              const UsdImagingEngineSharedPtr& sharedEngine =
                                        UsdImagingEngineSharedPtr())
{
    if (UsdImagingGL::IsEnabledHydra()) {
        return new UsdImagingHdEngine(rootPath, excludedPaths, invisedPaths, 
            sharedId, 
            boost::dynamic_pointer_cast<UsdImagingHdEngine>(sharedEngine));
    } else {
        // In the refEngine, both excluded paths and invised paths are treated
        // the same way.
        SdfPathVector pathsToExclude = excludedPaths;
        pathsToExclude.insert(pathsToExclude.end(), 
            invisedPaths.begin(), invisedPaths.end());
        return new UsdImagingRefEngine(pathsToExclude);
    }
}
コード例 #3
0
ファイル: attributeSpec.cpp プロジェクト: 400dama/USD
void
SdfAttributeSpec::ChangeMapperPath(
    const SdfPath& oldPath, const SdfPath& newPath)
{
    if (not PermissionToEdit()) {
        TF_CODING_ERROR("Change mapper path: Permission denied.");
        return;
    }

    const SdfPath& attrPath = GetPath();

    // Absolutize.
    SdfPath oldAbsPath = oldPath.MakeAbsolutePath(attrPath.GetPrimPath());
    SdfPath newAbsPath = newPath.MakeAbsolutePath(attrPath.GetPrimPath());

    // Validate.
    if (oldAbsPath == newAbsPath) {
        // Nothing to do.
        return;
    }
    if (not newAbsPath.IsPropertyPath()) {
        TF_CODING_ERROR("cannot change connection path for attribute %s's "
                        "mapper at connection path <%s> to <%s> because it's "
                        "not a property path",
                        attrPath.GetString().c_str(),
                        oldAbsPath.GetString().c_str(),
                        newAbsPath.GetString().c_str());
        return;
    }
    
    SdfPathVector mapperPaths = 
        GetFieldAs<SdfPathVector>(SdfChildrenKeys->MapperChildren);

    // Check that a mapper actually exists at the old path.
    SdfPathVector::iterator mapperIt = 
        std::find(mapperPaths.begin(), mapperPaths.end(), oldAbsPath);
    if (mapperIt == mapperPaths.end()) {
        TF_CODING_ERROR("Change mapper path: No mapper exists for "
            "connection path <%s>.", oldAbsPath.GetText());
        return;
    }

    // Check that no mapper already exists at the new path.
    const bool mapperExistsAtNewPath = 
        (std::find(mapperPaths.begin(), mapperPaths.end(), newAbsPath) != 
            mapperPaths.end());
    if (mapperExistsAtNewPath) {
        TF_CODING_ERROR("Change mapper path: Mapper already exists for "
            "connection path <%s>.", newAbsPath.GetText());
        return;
    }

    // Things look OK -- let's go ahead and move the mapper over to the
    // new path.
    SdfChangeBlock block;
        
    const SdfPath oldMapperSpecPath = attrPath.AppendMapper(oldAbsPath);
    const SdfPath newMapperSpecPath = attrPath.AppendMapper(newAbsPath);
    _MoveSpec(oldMapperSpecPath, newMapperSpecPath);

    *mapperIt = newAbsPath;
    SetField(SdfChildrenKeys->MapperChildren, VtValue(mapperPaths));

}