Skip to content

Conversation

@saintentropy
Copy link
Contributor

@saintentropy saintentropy commented Jun 7, 2024

Purpose

This PR corrects an error in the instancing render logic that can cause a crash. Specifically the fix adjusts the logic that is used when the HelixWatch3DViewModel is extracting regions of line vertices, colors, and indices associated with goemetry that will be rendered with instancing mechanism. The logic error occurred when the remaining indices are reset. Previous every indices was reset vs only those after the removed regions.

sudo example

Indices List before remove [1,2,3,4,5,6,7,8]

Indices List after remove [1,2,7,8]

Indices List after reset of values old way [-3,-2,3,4] WRONG

Indices List after reset of values: new way [1,2,3,4] CORRECT

The PR also add additional asserts to validate that the logic does keep the indices with the correct bounds. If the asserts fail then the render skips on completing the render of the geometry and passes a message to the user

image

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

Fixed an issue where Dynamo would crash when rendering the background preview with the instancing turned on.

Reviewers

@BogdanZavu @mjkkirschner

FYIs

@jnealb @aparajit-pratap @pinzart @QilongTang

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-7103

@github-actions
Copy link

github-actions bot commented Jun 7, 2024

UI Smoke Tests

Test: success. 2 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests - net8.0

for (int i = 0; i < l.Indices.Count; i++)
{
l.Indices[i] -= totalRemoved;
//Reset the Indices values for the indices that were after the removed region
Copy link
Contributor

@BogdanZavu BogdanZavu Jun 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a correct statement : the value of l.Indices[ j ] is always smaller then the value of l.Indices[ j+1 ] ?
I'm thinking if there is a way to check the validity of Geometry3D at the end of this operation and throw if something is not right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked into this and will have to come back to it. There isn't a very predictable try / catch situation upward. I think we will have to come back with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the assert in the tests but that is really what we want to eventually check at runtime. indices should not be less then 0 or greater then vertex count.

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this logic so I'll take your word for it. The only thing I would say is please add a test if possible.

@QilongTang QilongTang added this to the 3.2.1 milestone Jun 10, 2024
@QilongTang
Copy link
Contributor

I'm not familiar with this logic so I'll take your word for it. The only thing I would say is please add a test if possible.

Echo that

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 10, 2024

If no one can understand the logic in this file, that is not good.

It needs a diagram, better comments, something.
Anyway, I would id the conditions that cause this at runtime and log to ADP, sending enough data that we can repro - or request the user to log an issue.

@saintentropy saintentropy changed the title DYN-7103 Fix crash error in Instancing Rendering logic DYN-7103, DYN-7127 Fix crash error in Instancing Rendering logic, Fix issue with code block rendering Jun 12, 2024
Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment about using the correct error message box. Please also add another test case for the code block node case.

@saintentropy saintentropy merged commit df3a852 into DynamoDS:master Jun 13, 2024
@saintentropy saintentropy deleted the DYN-7103 branch June 13, 2024 19:05
saintentropy added a commit to saintentropy/Dynamo that referenced this pull request Jun 13, 2024
… issue with code block rendering (DynamoDS#15296)

(cherry picked from commit df3a852)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants