Skip to content

Commit

Permalink
Simplify updates to UnitTypeDef::getUnitDefs
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm authored Oct 12, 2024
1 parent 51c4f55 commit 50ede5b
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions source/MaterialXCore/Definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,8 @@ StringVec TargetDef::getMatchingTargets() const
vector<UnitDefPtr> UnitTypeDef::getUnitDefs() const
{
vector<UnitDefPtr> unitDefs;

// Gather from data library.
if (getDocument()->hasDataLibrary())
{
for (UnitDefPtr unitDef : getDocument()->getDataLibrary()->getChildrenOfType<UnitDef>())
{
if (unitDef->getUnitType() == _name)
{
unitDefs.push_back(unitDef);
}
}
}

// Gather from content document.
for (UnitDefPtr unitDef : getDocument()->getChildrenOfType<UnitDef>())

for (UnitDefPtr unitDef : getDocument()->getChildrenOfType<UnitDef>(EMPTY_STRING, getDocument()->getDataLibrary()))
{
if (unitDef->getUnitType() == _name)
{
Expand All @@ -210,5 +197,4 @@ vector<UnitDefPtr> UnitTypeDef::getUnitDefs() const

return unitDefs;
}

MATERIALX_NAMESPACE_END

0 comments on commit 50ede5b

Please sign in to comment.