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 default export value type resets every inherited instance #46103

Open
chucklepie opened this issue Feb 16, 2021 · 4 comments
Open

Changing default export value type resets every inherited instance #46103

chucklepie opened this issue Feb 16, 2021 · 4 comments

Comments

@chucklepie
Copy link

Godot version:
3.2.3 stable

OS/device including version:
Linux

Issue description:
I imagine you are going to say this is as expected as it's changing internal data types, but it ends up losing all data without any warning.

Pretend you have a scene with a default export:

export var life_span:=10

You have created many inherited scenes using this node,e.g.
image

For many of these instances you have changed the export value of this instance (as you see by the icon changed) and the value:
image

You then go into the code of the master node and change the default from the inferred int as you realised it should have been a float:

export var life_span:=10.0

What happens, without warning, is every single instance in your scenes that have an override are reset to the default value you just changed it to, and you might not even realised. But you've just wiped out over 100 nodes custom data despite the change not being an invalid cast or a loss of precision. The least I would expect would be a warning, but given the change hasn't affected the data there should be a bit more intelligence...

Steps to reproduce:

  1. create export int
  2. add some instances and override
  3. change to float
@Calinou
Copy link
Member

Calinou commented Feb 17, 2021

I'm fairly sure this has been reported in another issue already, but I can't find it right now.

@snoopdouglas
Copy link
Contributor

I feel the same principle should also apply to renaming exported variables; when instanced scenes are opened, the old value is discarded (although an error is printed to the console).

Likewise, think I've seen this in a GIP somewhere but can't find it at the moment

@chucklepie
Copy link
Author

I'm fairly sure this has been reported in another issue already, but I can't find it right now.

Other than the one snoopdouglas mentioned, could you be thinking one I raised last year where renaming a node loses all editable children and their data?

Oddly enough, this bug I mentioned has happened to me half a dozen times and I thought I'd done something wrong until I realised the steps to do it :)

@snoopdouglas
Copy link
Contributor

snoopdouglas commented Feb 17, 2021

Haha, yeah for that kind of refactoring you pretty much have to get familiar with the .tscn format (and have a text editor on hand to do a global find+replace).

It feels a bit dodgy to have Godot automatically refactoring instanced scenes based on changes that'd just been saved to a script, though I'm unsure whether this is just my bad intuition. Perhaps a dedicated 'refactor' menu would be a good idea for tasks like these?

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

No branches or pull requests

3 participants