From 50ede5b3648f7f76f404953b4d0fc7aac351cee6 Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Sat, 12 Oct 2024 10:57:32 -0700 Subject: [PATCH] Simplify updates to UnitTypeDef::getUnitDefs --- source/MaterialXCore/Definition.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/source/MaterialXCore/Definition.cpp b/source/MaterialXCore/Definition.cpp index 439fc711d0..874b49183e 100644 --- a/source/MaterialXCore/Definition.cpp +++ b/source/MaterialXCore/Definition.cpp @@ -186,21 +186,8 @@ StringVec TargetDef::getMatchingTargets() const vector UnitTypeDef::getUnitDefs() const { vector unitDefs; - - // Gather from data library. - if (getDocument()->hasDataLibrary()) - { - for (UnitDefPtr unitDef : getDocument()->getDataLibrary()->getChildrenOfType()) - { - if (unitDef->getUnitType() == _name) - { - unitDefs.push_back(unitDef); - } - } - } - - // Gather from content document. - for (UnitDefPtr unitDef : getDocument()->getChildrenOfType()) + + for (UnitDefPtr unitDef : getDocument()->getChildrenOfType(EMPTY_STRING, getDocument()->getDataLibrary())) { if (unitDef->getUnitType() == _name) { @@ -210,5 +197,4 @@ vector UnitTypeDef::getUnitDefs() const return unitDefs; } - MATERIALX_NAMESPACE_END