DYN-10416: Cleanup frozen geometry when the parent node is deleted#17069
Conversation
Add a forceDelete parameter to DeleteGeometries so frozen GeometryModel3D instances are skipped during normal re-evaluation but can be removed when a node is permanently deleted. Update DeleteGeometryForNode to call DeleteGeometries with forceDelete:true. Add a test WhenFrozenNodeIsDeletedThenItsGeometryIsCleared to ensure deleting a frozen node clears its geometry from the background preview. This preserves frozen visuals during routine updates while ensuring cleanup on node removal.
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10416
There was a problem hiding this comment.
Pull request overview
Ensures background preview geometry for frozen nodes is still cleaned up when the node is permanently deleted, while preserving the existing behavior of keeping frozen visuals during normal re-evaluation.
Changes:
- Added a
forceDeleteoption to the internal geometry deletion routine so frozen geometry can be removed on node deletion. - Updated
DeleteGeometryForNodeto force-delete geometries for the removed node. - Added a visualization test to validate frozen-node deletion clears background preview meshes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/VisualizationTests/HelixWatch3DViewModelTests.cs | Adds regression test asserting frozen node deletion clears preview geometry. |
| src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs | Introduces forceDelete path so frozen geometry isn’t skipped during node removal. |
|
| { | ||
| var geometryModels = FindAllGeometryModel3DsForNode(node); | ||
| DeleteGeometries(geometryModels, requestUpdate); | ||
| DeleteGeometries(geometryModels, requestUpdate, forceDelete: true); |
There was a problem hiding this comment.
Who else is calling DeleteGeometries? If nobody else, then we can just have the new default argument equal true.
| var nodeToDelete = Model.CurrentWorkspace.Nodes | ||
| .First(x => x.Name.Contains("ByGeometryColor")); | ||
| nodeToDelete.IsFrozen = true; | ||
| DispatcherUtil.DoEvents(); |
There was a problem hiding this comment.
It might be good to validate here that the number of meshes is still greater than zero at this point.



Purpose
Cause:
The guard was added in 2015 for a re-evaluation scenario: when a frozen node's graph re-runs, RemoveGeometryForUpdatedPackages calls DeleteGeometryForIdentifier to pre-clear geometry before writing new render packages — the frozen guard correctly prevents wiping cached geometry that won't be regenerated. But the same DeleteGeometries is called by DeleteGeometryForNode when the node is actually removed from the workspace, which is a completely different scenario where geometry must always be cleaned up.
Added a forceDelete parameter to
DeleteGeometriesso frozenGeometryModel3Dinstances are skipped during normal re-evaluation but can be removed when a node is permanently deleted.Update
DeleteGeometryForNodeto callDeleteGeometrieswithforceDelete:true.Added a test
WhenFrozenNodeIsDeletedThenItsGeometryIsClearedto ensure deleting a frozen node clears its geometry from the background preview.This preserves frozen visuals during routine updates while ensuring cleanup on node removal.
Declarations
Check these if you believe they are true
Release Notes
Cleanup frozen geometry when the parent node is deleted