Skip to content

Commit

Permalink
Merge pull request #2768 from dgovil/export-normals
Browse files Browse the repository at this point in the history
Export Normals by default and modify docs to match code behaviour
  • Loading branch information
seando-adsk authored Dec 14, 2022
2 parents e0badff + e42c4d0 commit a3d3289
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/mayaUsd/commands/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ using the Python "adaptor" helper; see the section on
| **All DAG nodes (UsdGeomImageable attributes)**: These attributes get converted into attributes of the UsdGeomImageable schema. You can use UsdMaya adaptors to author them. Note that these are only the common imageable attributes; you can export any known schema attribute using UsdMaya adaptors. |
| `USD_ATTR_purpose` | string | `default`, `render`, `proxy`, `guide` | Directly corresponds to UsdGeomImageable's purpose attribute for specifying context-sensitive and selectable scenegraph visibility. This attribute will be populated from an imported USD scene wherever it is explicitly authored, and wherever authored on a Maya dag node, will be exported to USD. |
| **Mesh nodes (internal for UsdMaya)**: Internal to Maya; cannot be set using adaptors. |
| `USD_EmitNormals` | bool | true/false | UsdMaya uses this attribute to determine if mesh normals should be emitted; by default, without the tag, UsdMaya won't export mesh normals to USD. **Note**: Currently Maya reads/writes face varying normals. This is only valid when the mesh's subdivision scheme is `none` (regular poly mesh), and is ignored otherwise. |
| `USD_EmitNormals` | bool | true/false | UsdMaya uses this attribute to determine if mesh normals should be emitted; by default, without the tag, UsdMaya will export mesh normals to USD. **Note**: Currently Maya reads/writes face varying normals. This is only valid when the mesh's subdivision scheme is `none` (regular poly mesh), and is ignored otherwise. |
| **Mesh nodes (UsdGeomMesh attributes)**: These attributes get converted into attributes of the UsdGeomMesh schema. You can use UsdMaya adaptors to author them. Note that these are only the common mesh attributes; you can export any known schema attribute using UsdMaya adaptors. |
| `USD_ATTR_faceVaryingLinearInterpolation` | string | `none`, `cornersOnly`, `cornersPlus1`, `cornersPlus2`, `boundaries`, `all` | Determines the Face-Varying Interpolation rule. Used for texture mapping/shading purpose. Defaults to `cornersPlus1`. See the [OpenSubdiv documentation](http://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#face-varying-interpolation-rules) for more detail. |
| `USD_ATTR_interpolateBoundary` | string | `none`, `edgeAndCorner`, `edgeOnly` | Determines the Boundary Interpolation rule. Valid for Catmull-Clark and Loop subdivision surfaces. Defaults to `edgeAndCorner`. |
Expand Down
2 changes: 1 addition & 1 deletion lib/usd/translators/meshWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ bool PxrUsdTranslators_MeshWriter::writeMeshAttrs(

if (sdScheme == UsdGeomTokens->none) {
// Polygonal mesh - export normals.
bool emitNormals = false; // Skip writing normals if no tagging.
bool emitNormals = true; // Write mesh normals if USD_EmitNormals is not present
UsdMayaMeshReadUtils::getEmitNormalsTag(finalMesh, &emitNormals);
if (emitNormals) {
UsdMayaMeshWriteUtils::writeNormalsData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ createNode mesh -n "polyShape" -p "poly";
addAttr -ci true -sn "USD_subdivisionScheme" -ln "USD_subdivisionScheme" -dt "string";
addAttr -ci true -sn "USD_ATTR_faceVaryingLinearInterpolation" -ln "USD_ATTR_faceVaryingLinearInterpolation"
-dt "string";
addAttr -ci true -sn "USD_EmitNormals" -ln "USD_EmitNormals" -min 0 -max 1 -at "bool";
setAttr -k off ".v";
setAttr ".vir" yes;
setAttr ".vif" yes;
Expand Down Expand Up @@ -117,11 +116,11 @@ createNode mesh -n "polyShape" -p "poly";
setAttr ".mgi" -type "string" "ID_d97c1ddc-ac7f-457f-b695-b70e17ea65e7";
setAttr -k on ".USD_subdivisionScheme" -type "string" "none";
setAttr -k on ".USD_ATTR_faceVaryingLinearInterpolation" -type "string" "all";
setAttr ".USD_EmitNormals" yes;
createNode transform -n "polyNoNormals" -p "UsdExportMeshTest";
rename -uid "3440D8C0-0000-61FE-5853-262100000251";
createNode mesh -n "polyNoNormalsShape" -p "polyNoNormals";
rename -uid "3440D8C0-0000-61FE-5853-262100000252";
addAttr -ci true -sn "USD_EmitNormals" -ln "USD_EmitNormals" -min 0 -max 1 -at "bool";
addAttr -ci true -sn "mgi" -ln "mayaGprimID" -dt "string";
addAttr -ci true -sn "USD_subdivisionScheme" -ln "USD_subdivisionScheme" -dt "string";
setAttr -k off ".v";
Expand Down Expand Up @@ -157,6 +156,7 @@ createNode mesh -n "polyNoNormalsShape" -p "polyNoNormals";
setAttr ".cvd" -type "dataPolyComponent" Index_Data Vertex 0 ;
setAttr ".pd[0]" -type "dataPolyComponent" Index_Data UV 0 ;
setAttr ".hfd" -type "dataPolyComponent" Index_Data Face 0 ;
setAttr -k on ".USD_EmitNormals";
setAttr ".mgi" -type "string" "ID_015d3451-d9dd-4b20-a91f-d49b8213a692";
setAttr -k on ".USD_subdivisionScheme" -type "string" "none";
createNode transform -n "subdiv" -p "UsdExportMeshTest";
Expand Down Expand Up @@ -213,7 +213,6 @@ createNode transform -n "unspecified" -p "UsdExportMeshTest";
createNode mesh -n "unspecifiedShape" -p "unspecified";
rename -uid "3440D8C0-0000-61FE-5853-236C00000247";
addAttr -ci true -sn "mgi" -ln "mayaGprimID" -dt "string";
addAttr -ci true -sn "USD_EmitNormals" -ln "USD_EmitNormals" -min 0 -max 1 -at "bool";
setAttr -k off ".v";
setAttr ".vir" yes;
setAttr ".vif" yes;
Expand All @@ -224,7 +223,6 @@ createNode mesh -n "unspecifiedShape" -p "unspecified";
setAttr ".covm[0]" 0 1 1;
setAttr ".cdvm[0]" 0 1 1;
setAttr ".mgi" -type "string" "ID_ac3a300d-bd34-46a3-9429-3dc78911b8b4";
setAttr ".USD_EmitNormals" yes;
createNode transform -n "TestNormalsMesh" -p "UsdExportMeshTest";
rename -uid "723618C0-0000-704C-5872-BC9000000268";
setAttr ".r" -type "double3" 0 -3.1805546814635168e-15 0 ;
Expand All @@ -236,7 +234,6 @@ createNode mesh -n "TestNormalsMeshShape" -p "TestNormalsMesh";
addAttr -ci true -sn "mgi" -ln "mayaGprimID" -dt "string";
addAttr -ci true -k true -sn "RMNCFaxis" -ln "RMNCFaxis" -dv 1 -at "float";
addAttr -ci true -sn "USD_subdivisionScheme" -ln "USD_subdivisionScheme" -dt "string";
addAttr -ci true -sn "USD_EmitNormals" -ln "USD_EmitNormals" -min 0 -max 1 -at "bool";
setAttr -k off ".v";
setAttr ".vir" yes;
setAttr ".vif" yes;
Expand Down Expand Up @@ -281,7 +278,6 @@ createNode mesh -n "TestNormalsMeshShape" -p "TestNormalsMesh";
setAttr ".dr" 1;
setAttr ".mgi" -type "string" "ID_feecf336-849b-4b53-af4d-ae97ce301741";
setAttr -k on ".USD_subdivisionScheme" -type "string" "none";
setAttr ".USD_EmitNormals" yes;
createNode transform -n "creased" -p "UsdExportMeshTest";
rename -uid "3C1599C0-0000-0CF1-5F06-03ED00000288";
createNode mesh -n "creasedShape" -p "creased";
Expand Down

0 comments on commit a3d3289

Please sign in to comment.