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

Reset button set resource **Reference** to a default_value #36650

Closed
ThakeeNathees opened this issue Feb 28, 2020 · 0 comments · Fixed by #39479
Closed

Reset button set resource **Reference** to a default_value #36650

ThakeeNathees opened this issue Feb 28, 2020 · 0 comments · Fixed by #39479

Comments

@ThakeeNathees
Copy link
Contributor

Godot version: 3.2.stable

OS/device including version: Win 64

Issue description:
when resetting a resource to default at editor inspector, it sets reference to the default resource at ClassDB::default_value, which leads multiple nodes refer to same resource (if those nodes were resetted)
bug

Steps to reproduce:

  1. create a path (path1)
  2. draw curve (path1's curve is curve1)
  3. reset curve (now path1's curve is default_curve)
  4. redraw path1 curve (editting default_curve)
  5. create another path (path2)
  6. draw curve (path2's curve is curve2)
  7. reset curve (now path2's curve is default_curve)
    (now path1 and path2 are overlapped)
  8. set path2's position to some value (ex: y=400) to see those paths seperately
  9. edit paths2's curve -> path1's curve also effected

Minimal reproduction project:

@akien-mga akien-mga added this to the 4.0 milestone Jun 9, 2020
akien-mga added a commit to akien-mga/godot that referenced this issue Jun 9, 2020
To do so, Object gets a new virtual `object_duplicate` (`duplicate`
already taken by incompatible implementations in derived classes)
which is implemented in `Node` and `Resource`.

This allows fixing godotengine#36372 properly in `ClassDB` by duplicating
Objects that need it to avoid using the same one as default value.
(So far it seems only Path2D/Path3D's `curve` property uses this.)

Fixes godotengine#36372.
Fixes godotengine#36650.

Supersedes godotengine#36644 and godotengine#36656.
akien-mga added a commit to akien-mga/godot that referenced this issue Jun 12, 2020
Fixes godotengine#36372 as Path2D/Path3D's `curve` property no longer uses a Curve
instance as default value, but instead it gets a (unique) default Curve
instance when created through the editor (CreateDialog).

ClassDB gets a sanity check to ensure that we don't do the same mistake
for other properties in the future, but instead use the dedicated
property usage hint.

Fixes godotengine#36372.
Fixes godotengine#36650.

Supersedes godotengine#36644 and godotengine#36656.

Co-authored-by: Thakee Nathees <thakeenathees@gmail.com>
Co-authored-by: simpuid <utkarsh.email@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment