Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-4224 / DYN-4225 Watch3d Updates (Persistent camera and node size between saves / Ignore Node preview state) #12150

Merged
merged 25 commits into from
Nov 17, 2022

Conversation

saintentropy
Copy link
Contributor

Purpose

This PR covers https://jira.autodesk.com/browse/DYN-4224 and https://jira.autodesk.com/browse/DYN-4225

This PR updates the behavior of the Watch3d node in three ways.

  1. Fix regression from 2.0 where the camera data that is saved to the DYN file is not used to set the nodes camera view on deserialization. Previously it would always reset to default. Now it will set the camera to the view that was saved to the file.
  2. Fix regression from 2.0 where the node canvas size that is saved to the DYN file is not used to set the watch node size on deserialization. Previously it would always reset to the default 200 x 200. Now it will restore the watch size on canvas to the size that was saved to file.
  3. Change the behavior for Watch3D to always show geometry from connected node regardless of the nodes preview state. In the past the Watch3D node had functionality that gave the user more control over what geometry was displayed within the node (ie visible upstream). Currently the node is only limited to showing a subset of geometry that is visible in the Background Preview. This limits the user ability to visualize subsets of geometry independently. This change will allow the user to visualize geometry in Watch3d nodes independent of the preview state set on the node.

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

Reviewers

TBD

FYIs

@saintentropy saintentropy changed the title Watch3d Updates (Persistent camera and node size between saves / Ignore Node preview state) DYN-4224 / DYN-4225 Watch3d Updates (Persistent camera and node size between saves / Ignore Node preview state) Oct 18, 2021
var connected = watchModel.InPorts.SelectMany(p => p.Connectors.Select(c => c.Start.Owner));
if (!connected.Contains(node))
{
return;
Copy link
Member

Choose a reason for hiding this comment

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

when would this occur?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The DefaultWatch is wired up to every node.PropertyChanged event in the graph. In the case of the background preview you want all of them. For the Watch3D we want to only react to changes that are for the node that is directly connected

protected override void PortDisconnectedHandler(PortModel obj)
{
OnClear();
if (obj.PortType == PortType.Input && watchModel == obj.Owner)
Copy link
Member

Choose a reason for hiding this comment

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

when could it occur that obj is not a portModel of this node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case the PortConnected and PortDisconnected Handler are registered in the DefaultWatchViewModel as well. So we need to filter out port events unrelated to this node.

@mjkkirschner
Copy link
Member

@saintentropy this PR needs tests.

Copy link
Member

@mjkkirschner mjkkirschner left a comment

Choose a reason for hiding this comment

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

a few questions and a request for at least the following tests:

  • calling RequestVisualUpdateAsync with ignoreIsVisible works correctly with true and with false inputs
  • deserialization test for watch3d node camera sets some properties correctly.

@@ -610,7 +611,8 @@ protected virtual void OnRenderPackagesUpdated(NodeModel node, RenderPackageCach
// If there is no attached model update for all render packages
if (watchModel == null)
{
if(node.IsVisible == false)
//When Watch3D nodes are in canvis we need to ignore this even under certain situations.
Copy link
Member

Choose a reason for hiding this comment

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

spelling (canvas) - also comment is not super clear to me?
ignore this even under certain situations
whats this,
what situations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mjkkirschner Does this make more sence now?

@twastvedt
Copy link
Contributor

@mjkkirschner I believe this is ready to go, but have a look at the added tests when you get a chance.

@twastvedt
Copy link
Contributor

Also, can we still cherry-pick this into 2.17? I notice the PR isn't marked 2.17, though the corresponding Jira task is.

@mjkkirschner
Copy link
Member

@twastvedt yes, please cherry pick the squash commit.

@mjkkirschner mjkkirschner added this to the 2.17.0 milestone Nov 16, 2022
@mjkkirschner
Copy link
Member

mjkkirschner commented Nov 16, 2022

@twastvedt while this looks good, there are 2 failing tests, please check them out before merging!
⚠️
WpfVisualizationTests.HelixImageComparisonTests.HelixWatch3DViewModelTests.Node_IgnoreIsVisible
WpfVisualizationTests.HelixWatch3DViewModelTests.Node_IgnoreIsVisible

I actually think this is 1 test just listed incorrectly as 2 by jenkins.

@twastvedt
Copy link
Contributor

@twastvedt while this looks good, there are 2 failing tests, please check them out before merging! ⚠️ WpfVisualizationTests.HelixImageComparisonTests.HelixWatch3DViewModelTests.Node_IgnoreIsVisible WpfVisualizationTests.HelixWatch3DViewModelTests.Node_IgnoreIsVisible

I actually think this is 1 test just listed incorrectly as 2 by jenkins.

Ah, sorry about that. Ok, passing now!

@twastvedt twastvedt merged commit 903ca10 into DynamoDS:master Nov 17, 2022
twastvedt pushed a commit that referenced this pull request Nov 17, 2022
…between saves / Ignore Node preview state) (#12150)

* Use exisitng width, height, and camera during deserialization

* Allow Watch3D to tessellate directly connected nodes independent of preview state

* One more change for directly connected

* Fix bug with port connection and disconnect events

* pr comments

* Ignore certain cases

* PR comments

* update comments

* Update DefaultWatch3DViewModel.cs

* Added deserialization test for HelixWatch3D node

* Added the dyn file for the HelixWatch3D node deserialization test

* Added testing for Width deserialization

* Renamed test dyn file

* Added test for ignoring IsVisible parameter by Watch3d node

* Fixed wrong test geometry in dyn file

* Added another Assert to the IgnoreIsVisible test

* Fixed Assert statements

* Simplified a test

* Remove node_modules.

* Fix test.

* Simplify

Co-authored-by: Craig Long <[email protected]>
Co-authored-by: Long Nguyen <[email protected]>
Co-authored-by: Trygve Wastvedt <[email protected]>
(cherry picked from commit 903ca10)
QilongTang pushed a commit that referenced this pull request Nov 17, 2022
…between saves / Ignore Node preview state) (#12150) (#13534)

* Use exisitng width, height, and camera during deserialization

* Allow Watch3D to tessellate directly connected nodes independent of preview state

* One more change for directly connected

* Fix bug with port connection and disconnect events

* pr comments

* Ignore certain cases

* PR comments

* update comments

* Update DefaultWatch3DViewModel.cs

* Added deserialization test for HelixWatch3D node

* Added the dyn file for the HelixWatch3D node deserialization test

* Added testing for Width deserialization

* Renamed test dyn file

* Added test for ignoring IsVisible parameter by Watch3d node

* Fixed wrong test geometry in dyn file

* Added another Assert to the IgnoreIsVisible test

* Fixed Assert statements

* Simplified a test

* Remove node_modules.

* Fix test.

* Simplify

Co-authored-by: Craig Long <[email protected]>
Co-authored-by: Long Nguyen <[email protected]>
Co-authored-by: Trygve Wastvedt <[email protected]>
(cherry picked from commit 903ca10)

Co-authored-by: Craig Long <[email protected]>
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.

4 participants