예제 #1
0
SdfPath
UsdImagingMaterialAdapter::Populate(UsdPrim const& prim,
                            UsdImagingIndexProxy* index,
                            UsdImagingInstancerContext const* instancerContext)
{
    // Since material are populated by reference, they need to take care not to
    // be populated multiple times.
    SdfPath cachePath = prim.GetPath();
    if (index->IsPopulated(cachePath)) {
        return cachePath;
    }

    index->InsertSprim(HdPrimTypeTokens->material,
                       cachePath,
                       prim, shared_from_this());
    HD_PERF_COUNTER_INCR(UsdImagingTokens->usdPopulatedPrimCount);

    // Also register this adapter on behalf of any descendent
    // UsdShadeShader prims, since they are consumed to
    // create the material network.
    for (UsdPrim const& child: prim.GetDescendants()) {
        if (child.IsA<UsdShadeShader>()) {
            index->AddPrimInfo(child.GetPath(), child, shared_from_this());
        }
    }

    return prim.GetPath();
}
예제 #2
0
파일: prim.cpp 프로젝트: lvxejay/USD
 void _VisitSubtree(UsdPrim const &prim) {
     _VisitPrim(prim);
     auto range = prim.GetDescendants();
     WorkParallelForEach(range.begin(), range.end(),
                         [this](UsdPrim const &desc) { _VisitPrim(desc); });
 }