-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Duplicating a node with an export variable doesn't update variable's nodepath #82670
Comments
Scene.tscn might give a clue since it has saved NodePaths of objects that were duplicated in the video. |
What you're referring to here is definitely a bug though (and something I've reproduced in 4.2.dev5). |
As I mentioned in #82711 I think part of the issue is that when instancing a scene ("SceneInstance") with NodePath exports, these exports are marked as overridden from the start, even if they are not changed. At least when hovering over it looks like the path is set correctly. And if you reset the overrides the path doesn't change. However, if the NodePaths have these override flags they are treated as referencing a specific node when duplicating SceneInstance and the path is changed to keep referencing this specific node. If you remove the override by clicking the reset button the NodePath export is not changed this way when duplicating SceneInstance and it references the corresponding node in the new copy of SceneInstance. I think this duplication behavior may be correct and can be seen as intentional. The bug is instead I think that the NodePath exports are flagged as overridden when the first SceneInstance is instanced from file. Not that overridden NodePaths are changed when SceneInstance is duplicated. |
https://github.com/godotengine/godot/blob/master/scene/main/node.cpp#L2541 |
|
Another update, the underlying issue seems to be that when we are reading from a packedscene we don't differentiate between an export variable that is a nodepath and an export variable that is of type Node, thus getting this issue where types don't match and being able to revert variables in the editor inspector. |
Decided to find the first version when this bug happened... 4.1-dev4. How nobody has noticed this for so long😂 |
#76389 |
Noticed this issue in 4.1.3 and it results in weird and hard to find bugs as is expected ^^' |
@RoboClonk don't worry, the fix is coming #83343 :) |
Cool! Thanks for that :) |
Was this only fixed for scene-owned nodes or for packed scene instances as well? I am still able to reproduce the issue with packed scene instances in 4.3dev5 (it actually seems to be broken worse - with some references being nulled out instead of copied; in C# at least, I haven't tried GDScript yet) |
Should be for both and this should be language independent fix. Are the nulled references by any chance inherited from Resource? |
Weird, I can’t replicate this on my end (tested against master branch and gdscript). Open up a new issue and just in case try this with both C# and gdscript. I’m also curious if this also happens with master branch of godot on your end. |
I was able to verify the same behavior with gdscript in a much simpler project as well. I've grabbed a video of the issue here (on 4.3dev5): I'd like to test master, but am having trouble generating the glue at the moment so I'll have to poke at that some more tomorrow. That said, GDScript seems to be working fine there, so maybe I'll just have to wait until the next dev6/alpha build for the fix. |
@fmoo Aight, I decided to test 4.3 dev 5, it's indeed broken. I incorrectly said that I tested against master branch, in reality I tested against my pr (that is up to date with master) where I might have fixed it. #91329. Can you try and confirm it for yourself? Edit: Wait so it works fine with GDScript in master build? |
@warriormaster12 yes, gdscript and c# exhibit the bad behavior on 4.3dev5 (with and without mono), but when I checked the github artifacts from yesterday morning, as well as a local build of master, duplicating the GDScript nodes were behaving as expected. |
Perfect, thanks 👍. Sorry for my rambling btw, bad habbit. |
Just for fun I did a bisect and confirmed that 9851c1b did fix this. The missing piece for me was that this wasn't merged in until Mar 24, and dev5 was built on Mar 15. Sorry for the scare! |
Godot version
v4.2.dev.custom_build [0ca8542]
System information
Pop Os 22.04 lts 12th Gen Intel® Core™ i7-12700H × 20 NVIDIA RTX A2000 8GB 32.0GB ram
Issue description
A node that has a script attached to it and it has a couple of child nodes (type of a child node doesn't matter). In the script you have an export variable of type Node. You save the scene into a file and you add it in level scene. When you start to duplicate that scene in the level and you'll hover over exported variable to show a node path, it will show an incorrect path.
2023-10-02.12-27-37.mp4
Steps to reproduce
Minimal reproduction project
NodeTest.zip
The text was updated successfully, but these errors were encountered: