Always process both vertex and point maya_locked_normal
Regardless of whether vertex or point normals were used.
@@ -1334,6 +1334,7 @@ OutputGeometryPart::computeMesh(
}
// normal array
+ bool hasNormal = false;
if(hasMesh)
{
HAPI_AttributeOwner owner = HAPI_ATTROWNER_MAX;
@@ -1359,6 +1360,7 @@ OutputGeometryPart::computeMesh(
if(owner != HAPI_ATTROWNER_MAX)
{
markAttributeUsed("N");
+ hasNormal = true;
// assume 3 tuple
MVectorArray normals(
@@ -1381,7 +1383,25 @@ OutputGeometryPart::computeMesh(
}
meshFn.setFaceVertexNormals(normals, faceList, polygonConnects);
+ }
+ else if(owner == HAPI_ATTROWNER_POINT)
+ {
+ MIntArray vertexList;
+ vertexList.setLength(vertexArray.length());
+ for(unsigned int i = 0, length = vertexList.length();
+ i < length; ++i)
+ {
+ vertexList[i] = i;
+ }
+
+ meshFn.setVertexNormals(normals, vertexList);
+ }
+ }
+ }
+ // unlock/lock normals
+ if(hasMesh && hasNormal)
+ {
if(!HAPI_FAIL(hapiGetVertexAttribute(
myNodeId, myPartId,
"maya_locked_normal",
@@ -1413,20 +1433,7 @@ OutputGeometryPart::computeMesh(
meshFn.unlockFaceVertexNormals(unlockFaceList, unlockVertexList);
}
- }
- else if(owner == HAPI_ATTROWNER_POINT)
- {
- MIntArray vertexList;
- vertexList.setLength(vertexArray.length());
- for(unsigned int i = 0, length = vertexList.length();
- i < length; ++i)
- {
- vertexList[i] = i;
- }
-
- meshFn.setVertexNormals(normals, vertexList);
-
- if(!HAPI_FAIL(hapiGetPointAttribute(
+ else if(!HAPI_FAIL(hapiGetPointAttribute(
myNodeId, myPartId,
"maya_locked_normal",
attrInfo,
@@ -1450,8 +1457,6 @@ OutputGeometryPart::computeMesh(
meshFn.unlockVertexNormals(unlockVertexList);
}
}
- }
- }
// hard/soft edge
if(hasMesh)
