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 all 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
12 changes: 11 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;
jstone-lucasfilm marked this conversation as resolved.
Show resolved Hide resolved
this._defaultMaterial = null;
var looks = doc.getLooks();
if (looks.length)
Expand Down Expand Up @@ -633,6 +633,16 @@ export class Material
let newAssignment;
if (collection || geom)
{
// Remove leading "/" from collection and geom for
// later assignment comparison checking
if (collection && collection.charAt(0) == "/")
{
collection = collection.slice(1);
}
if (geom && geom.charAt(0) == "/")
{
geom = geom.slice(1);
}
newAssignment = new MaterialAssign(shader, geom, collection);
}
else
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))
jstone-lucasfilm marked this conversation as resolved.
Show resolved Hide resolved
{
matAssigns.push_back(matAssign);
continue;
Expand Down