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

Do not set execution hint on undo move #11519

Merged
merged 2 commits into from
Feb 26, 2021
Merged

Conversation

mmisol
Copy link
Collaborator

@mmisol mmisol commented Feb 25, 2021

Purpose

There were a couple of issues that were causing a node to be set to be
executed on undoing an action that consisted of just a move:

  1. The 'UsingDefaultValue' property was triggering a property changed
    even if the deserialized value was the same as the current. This was
    fixed by checking if the value is the same and not doing anything in
    that case.

  2. Even if the 'IsFrozen' property for the current node had not changed
    an undo would mark the current and all downstream nodes as if they were
    modified. This was fixed by relying on the 'IsFrozen' property
    setter, which correctly handles the cases when the previous should be
    done.

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

There were a couple of issues that were causing a node to be set to be
executed on undoing an action that consisted of just a move:

1. The 'UsingDefaultValue' property was triggering a property changed
even if the deserialized value was the same as the current. This was
fixed by checking if the value is the same and not doing anything in
that case.

2. Even if the 'IsFrozen' property for the current node had not changed
an undo would mark the current and all downstream nodes as if they were
modified. This was fixed by relying on the 'IsFrozen' property
setter, which correctly handles the cases when the previous should be
done.
{
usingDefaultValue = value;
RaisePropertyChanged("UsingDefaultValue");
RaisePropertyChanged("ToolTip");
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the fix here. Also curious does similar problem not exist for other properties, e.g. X, Y etc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this pattern is used in most places. For X and Y, I noticed they are deprecated and there is a Position which is a way to update both. Maybe that's the reason why it's different.

{
// For Python nodes, changing the Engine property does not set the node Modified flag.
// This is done externally in all event handlers, so for Undo we do it here.
OnNodeModified();
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

//undo is for toggling freeze. This is ONLY modifying the execution hint.
// this does not run the graph.
RaisePropertyChanged(nameof(IsFrozen));
MarkDownStreamNodesAsModified(this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @mmisol Did you test that downstream node can be also reverted back to the previous state?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure I follow. Could you mention the steps of the test?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, if a node is frozen, the downstream nodes are also frozen. The original code seems taking care of correctly marking downstream nodes when undo freezing node as well. Just want to make sure the behavior is the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh ok. Yes, I tested that and it works

Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

LGTM with two questions

@mmisol mmisol merged commit d44c913 into DynamoDS:master Feb 26, 2021
mmisol added a commit to mmisol/Dynamo that referenced this pull request Mar 2, 2021
There were a couple of issues that were causing a node to be set to be
executed on undoing an action that consisted of just a move:

1. The 'UsingDefaultValue' property was triggering a property changed
even if the deserialized value was the same as the current. This was
fixed by checking if the value is the same and not doing anything in
that case.

2. Even if the 'IsFrozen' property for the current node had not changed
an undo would mark the current and all downstream nodes as if they were
modified. This was fixed by relying on the 'IsFrozen' property
setter, which correctly handles the cases when the previous should be
done.
QilongTang pushed a commit that referenced this pull request Mar 2, 2021
There were a couple of issues that were causing a node to be set to be
executed on undoing an action that consisted of just a move:

1. The 'UsingDefaultValue' property was triggering a property changed
even if the deserialized value was the same as the current. This was
fixed by checking if the value is the same and not doing anything in
that case.

2. Even if the 'IsFrozen' property for the current node had not changed
an undo would mark the current and all downstream nodes as if they were
modified. This was fixed by relying on the 'IsFrozen' property
setter, which correctly handles the cases when the previous should be
done.
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.

2 participants