Skip to content

Commit

Permalink
Merge branch 'ignoreEmptyOverrides' into 'main'
Browse files Browse the repository at this point in the history
Fix for incorrectly ignoring meshes after show/hide is used in USD Composer

See merge request lightspeedrtx/dxvk-remix-nv!1207
  • Loading branch information
MarkEHenderson committed Dec 10, 2024
2 parents 4d3b1d0 + 54a2510 commit 2ca2a27
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/dxvk/rtx_render/rtx_mod_usd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class UsdMod::Impl {
void processPrim(Args& args, pxr::UsdPrim& prim);

void processLight(Args& args, const pxr::UsdPrim& lightPrim, const bool isOverride);
void processReplacement(Args& args);
bool processReplacement(Args& args);

Categorizer processCategoryFlags(const pxr::UsdPrim& prim);

Expand Down Expand Up @@ -527,7 +527,7 @@ bool explicitlyNoReferences(const pxr::UsdPrim& prim) {
return false;
}

void UsdMod::Impl::processReplacement(Args& args) {
bool UsdMod::Impl::processReplacement(Args& args) {
ScopedCpuProfileZone();

if (args.rootPrim.IsA<pxr::UsdGeomMesh>()) {
Expand All @@ -551,6 +551,14 @@ void UsdMod::Impl::processReplacement(Args& args) {
if (args.meshes[0].includeOriginal) {
args.meshes[0].categories = processCategoryFlags(args.rootPrim);
}
return true;
} else {
bool result = preserveGameObject(args.rootPrim);
if (result) {
Logger::warn(str::format("Empty override prim found. ", args.rootPrim.GetPrimPath().GetString(), " has no children, but the original mesh reference is not explicitely deleted."));
}
return !result;

}
}

Expand Down Expand Up @@ -663,11 +671,11 @@ void UsdMod::Impl::processUSD(const Rc<DxvkContext>& context) {

Args args = {context, xformCache, child, replacementVec};

processReplacement(args);

variantCounts[hash]++;
if (processReplacement(args)) {
variantCounts[hash]++;

m_owner.m_replacements->set<AssetReplacement::eMesh>(hash, std::move(replacementVec));
m_owner.m_replacements->set<AssetReplacement::eMesh>(hash, std::move(replacementVec));
}
}
}
}
Expand Down Expand Up @@ -695,9 +703,9 @@ void UsdMod::Impl::processUSD(const Rc<DxvkContext>& context) {

Args args = {context, xformCache, rootPrim, replacementVec};

processReplacement(args);

m_owner.m_replacements->set<AssetReplacement::eMesh>(variantHash, std::move(replacementVec));
if (processReplacement(args)) {
m_owner.m_replacements->set<AssetReplacement::eMesh>(variantHash, std::move(replacementVec));
}
}
}

Expand All @@ -710,9 +718,9 @@ void UsdMod::Impl::processUSD(const Rc<DxvkContext>& context) {
std::vector<AssetReplacement> replacementVec;
Args args = {context, xformCache, child, replacementVec};

processReplacement(args);

m_owner.m_replacements->set<AssetReplacement::eLight>(hash, std::move(replacementVec));
if (processReplacement(args)) {
m_owner.m_replacements->set<AssetReplacement::eLight>(hash, std::move(replacementVec));
}
}
}
}
Expand Down

0 comments on commit 2ca2a27

Please sign in to comment.