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

Changing a instanced Object's class' values should only affect the changed values. #3344

Closed
UliAbo opened this issue May 2, 2022 · 3 comments
Assignees
Labels
bug Broken behavior.

Comments

@UliAbo
Copy link

UliAbo commented May 2, 2022

Describe the bug
I know it's not a bug, but it definitely FEELS likes one :)
(Maybe someone can phrase a more precise / more correct headline for this thread?)

Example with two Objects Alpha and Beta:

  • Alpha and Beta have both OrangeAmount and AppleAmount as two properties.
  • Alpha has for both properties the value 3 and 4
  • Beta has for both properties the value 55 and 66
  • When I now select both Alpha and Beta and change their Oranges to 777, then I expect that both have this value only for Oranges which work fine. BUT the strange thing is, their AppleAmount also changed! And it changed both to either 3 and 4.
    Nevertheless, this really feels buggy for me because when I only want to change Oranges to become the same value, Apple should not change? This issue doesn't occur when not using Classes / Enums.

Expected behavior
When I select two Objects sharing one Class, then I expect to only change the desired value without all other properties' value becoming the same.

@bjorn
Copy link
Member

bjorn commented Aug 26, 2022

It is important to note that this only happens, when OrangeAmount and AppleAmount are nested values. If both are top-level properties of Alpha and Beta (which can still be based on the class of these objects), then the change happens only to the edited property. I do agree, that this is unintuitive and dangerous behavior (due to being unexpected and quite hidden).

Unfortunately it will be hard to address, since all the change events are currently applying only to top-level properties. When you change a nested property, this change is bubbling up towards the affected top-level property, and the resulting compound value is then applied to all selected objects.

To fix it, we will need to use the information about where this property is nested while applying the change to all selected objects. And in this, we'll also need to deal with the fact that some of the selected objects may not actually have the affected property (currently it would cause the compound value to get added at the top-level, but the new behavior should probably be to ignore that specific object then).

bjorn added a commit that referenced this issue Sep 7, 2022
Now only applies the change to the actual nested value, rather than
synchronizing the top-level property for all selected objects.

Closes #3344
@bjorn bjorn closed this as completed in adc443d Sep 9, 2022
@bjorn
Copy link
Member

bjorn commented Sep 9, 2022

While working on this I noticed that overridden values in nested classes were not displayed correctly, so I fixed that as well in 449f333. I will aim for a Tiled 1.9.2 release soon.

@UliAbo
Copy link
Author

UliAbo commented Sep 10, 2022

@bjorn That's great! I'm looking forward to 1.9.2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
None yet
Development

No branches or pull requests

2 participants