Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parent/child handling in getGeometryBindings #1113

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion javascript/MaterialXView/source/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ export class Material
// and assign to the associatged geometry. If there are no looks
// then the first material is found and assignment to all the
// geometry.
this._materials = [];
this._materials.length = 0;
this._defaultMaterial = null;
var looks = doc.getLooks();
if (looks.length)
Expand All @@ -629,7 +629,15 @@ export class Material
}
}
let collection = materialAssign.getCollection();
if (collection && collection && collection.charAt(0) == "/")
{
collection = collection.slice(1);
}
let geom = materialAssign.getGeom();
if (geom && geom && geom.charAt(0) == "/")
{
geom = geom.slice(1);
}
let newAssignment;
if (collection || geom)
{
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXCore/Look.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ vector<MaterialAssignPtr> getGeometryBindings(ConstNodePtr materialNode, const s
{
if (matAssign->getReferencedMaterial() == materialNode)
{
if (geomStringsMatch(geom, matAssign->getActiveGeom()))
if (geomStringsMatch(matAssign->getActiveGeom(), geom, true))
{
matAssigns.push_back(matAssign);
continue;
Expand Down