houdiniInputGeometry node was getting dirtied needlessly
when the shading group and materialPerFace flag were set, resulting in
needless re-cooking of  downstream asset nodes.
@@ -179,8 +179,11 @@ getInputNodeForSingle(string $object, int $connectGeoForAsset )
string $inputNode = plugNode($inputNodeIdAttr);
string $objectShader[] = `listConnections -type shadingEngine ($object + ".instObjGroups")`;
if(size($objectShader) > 0) {
+ string $oldShadingGroup = `getAttr ($inputNode + ".objectShadingGroup")`;
+ if($oldShadingGroup != $objectShader[0]) {
setAttr -type "string" ($inputNode + ".objectShadingGroup") $objectShader[0];
}
+ }
return $inputNodeIdAttr;
}
}
@@ -420,12 +423,18 @@ houdiniEngine_setAssetInput(string $inputAttr, string $objects[])
}
else if(size($sourceInputAttr) == 1)
{
+ // the materialPerFace attr means, "store shading group per face even if
+ // the input geo does not have shaderPerFace" - if it does have shaderPerFace
+ // this flag has no effect
+
$finalInputAttr = $sourceInputAttr[0];
// don't promote shading to primitives
// if there is one input, or if the input has no primitives
string $inputNode = plugNode($finalInputAttr);
if(`nodeType $inputNode` == "houdiniInputGeometry") {
string $matOverrideAttr = $inputNode + ".materialPerFace";
+ int $oldMatPerFace = `getAttr($matOverrideAttr)`;
+ if($oldMatPerFace > 0)
setAttr $matOverrideAttr 0;
}
}
@@ -442,6 +451,8 @@ houdiniEngine_setAssetInput(string $inputAttr, string $objects[])
string $inputNode = plugNode($sourceInputAttr[$i]);
if(`nodeType $inputNode` == "houdiniInputGeometry") {
string $matOverrideAttr = $inputNode + ".materialPerFace";
+ int $oldMatPerFace = `getAttr($matOverrideAttr)`;
+ if($oldMatPerFace == 0)
setAttr $matOverrideAttr 1;
}
}
