Skip to content

Commit

Permalink
Ensure subdiv_iterations is not set uselessly during procedural updat…
Browse files Browse the repository at this point in the history
…es (#1931)

* Ensure subdiv_iterations is not set uselessly during procedural updates #1929

(cherry picked from commit 1adc860)

* Add changelog
  • Loading branch information
sebastienblor authored Jun 11, 2024
1 parent 3d27341 commit 7673dd3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
## Pending feature release

## Pending bugfix release
- [usd#1923](https://github.com/Autodesk/arnold-usd/issues/1923) - Fix instance primvar indices with multiple prototypes
- [usd#1923](https://github.com/Autodesk/arnold-usd/issues/1923) - Fix instance primvar indices
with multiple prototypes
- [usd#1929](https://github.com/Autodesk/arnold-usd/issues/1929) - Ensure subdiv_iterations is not set uselessly during procedural updates

## [7.3.2.0] - 2024-05-22

Expand Down
2 changes: 2 additions & 0 deletions libs/common/constant_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ ASTR2(primvars_arnold, "primvars:arnold");
ASTR2(primvars_arnold_light, "primvars:arnold:light");
ASTR2(log_file, "log:file");
ASTR2(log_verbosity, "log:verbosity");
ASTR2(primvars_arnold_smoothing, "primvars:arnold:smoothing");
ASTR2(primvars_arnold_subdiv_iterations, "primvars:arnold:subdiv_iterations");
ASTR2(primvars_arnold_subdiv_type, "primvars:arnold:subdiv_type");
ASTR2(primvars_arnold_normalize, "primvars:arnold:normalize");
ASTR2(renderPassAOVDriver, "HdArnoldRenderPass_aov_driver");
Expand Down
28 changes: 19 additions & 9 deletions libs/translator/reader/read_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ AtNode* UsdArnoldReadMesh::Read(const UsdPrim &prim, UsdArnoldReaderContext &con
staticTime.motionBlur = false;

AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());

ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, true);
if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, true);

// Get mesh.
UsdGeomMesh mesh(prim);
Expand Down Expand Up @@ -393,8 +393,10 @@ AtNode* UsdArnoldReadMesh::Read(const UsdPrim &prim, UsdArnoldReaderContext &con

_ReadSidedness(mesh, node, frame);

// reset subdiv_iterations to 0, it might be set in readArnoldParameter
AiNodeSetByte(node, str::subdiv_iterations, 0);
// reset subdiv_iterations to 0, unless primvars:arnold:subdiv_iterations is
// explicitely set, in which case it would be applied during readArnoldParameter #1929
if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_subdiv_iterations))
AiNodeSetByte(node, str::subdiv_iterations, 0);

MeshPrimvarsRemapper primvarsRemapper(meshOrientation);
ReadPrimvars(prim, node, time, context, &primvarsRemapper);
Expand Down Expand Up @@ -661,7 +663,8 @@ AtNode* UsdArnoldReadCube::Read(const UsdPrim &prim, UsdArnoldReaderContext &con
float frame = time.frame;
AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());
ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, false);
if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, false);

static const VtIntArray numVerts { 4, 4, 4, 4, 4, 4 };
static const VtIntArray verts { 0, 1, 2, 3,
Expand Down Expand Up @@ -713,7 +716,8 @@ AtNode* UsdArnoldReadSphere::Read(const UsdPrim &prim, UsdArnoldReaderContext &c
float frame = time.frame;
AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());
ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, true);
if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, true);

static const VtIntArray numVerts{
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
Expand Down Expand Up @@ -882,7 +886,9 @@ AtNode* UsdArnoldReadCylinder::Read(const UsdPrim &prim, UsdArnoldReaderContext
float frame = time.frame;
AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());
ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, true);
if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, true);

static const VtIntArray numVerts{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
Expand Down Expand Up @@ -947,7 +953,9 @@ AtNode* UsdArnoldReadCone::Read(const UsdPrim &prim, UsdArnoldReaderContext &con
float frame = time.frame;
AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());
ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, true);

if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, true);

static const VtIntArray numVerts{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4 };
Expand Down Expand Up @@ -1005,7 +1013,9 @@ AtNode* UsdArnoldReadCapsule::Read(const UsdPrim &prim, UsdArnoldReaderContext &
float frame = time.frame;
AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText());
ReadMatrix(prim, node, time, context);
AiNodeSetBool(node, str::smoothing, true);

if (!HasAuthoredAttribute(prim, str::t_primvars_arnold_smoothing))
AiNodeSetBool(node, str::smoothing, true);

// slices are segments around the mesh
static constexpr int _capsuleSlices = 10;
Expand Down

0 comments on commit 7673dd3

Please sign in to comment.