Ejemplo n.º 1
0
PXR_NAMESPACE_OPEN_SCOPE


bool 
UsdUtilsCopyLayerMetadata(const SdfLayerHandle &source,
                          const SdfLayerHandle &destination,
                          bool skipSublayers)
{
    if (!TF_VERIFY(source && destination))
        return false;

    SdfPrimSpecHandle sourcePseudo = source->GetPseudoRoot();
    SdfPrimSpecHandle destPseudo = destination->GetPseudoRoot();
    
    std::vector<TfToken> infoKeys = sourcePseudo->ListInfoKeys();
    std::vector<TfToken>::iterator last = infoKeys.end();
    
    if (skipSublayers){
        last = std::remove_if(infoKeys.begin(), last,
                              [](TfToken key) { return (key == SdfFieldKeys->SubLayers || key == SdfFieldKeys->SubLayerOffsets); });
    }

    for (auto key = infoKeys.begin(); key != last; ++key){
        destPseudo->SetInfo(*key, sourcePseudo->GetInfo(*key));
    }

    return true;
}
Ejemplo n.º 2
0
Sdf_SubLayerListEditor::Sdf_SubLayerListEditor(
    const SdfLayerHandle& owner)
    : Parent(owner->GetPseudoRoot(), 
             SdfFieldKeys->SubLayers, SdfListOpTypeOrdered)
{
}