godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.45k stars 21.27k forks source link

Can select children of instanced scene while it doesn't have editable children #46032

Closed lentsius-bark closed 3 years ago

lentsius-bark commented 3 years ago

Godot version: 3.2.4.rc.custom_build / 3.2.4.rc1 (both exhibit the same behaviour)

System Linux (PopOS - most recent, up to date including drivers), GLES3, Nvidia 1060 - laptop

Issue description: This is a really weird bug. It only affects projects created with previous versions of Godot. As of rc1 i believe, the 3d editor unreliably alters between selecting the instanced scene or its children. No errors whatsoever. In the screenshot below you can see:

image

Steps to reproduce: Open a project created in 3.2.3 or lower

Minimal reproduction project: Sadly I am not in possession of a minimal reproduction project, I've only got bigger ones, which I don't mind sharing if it'd help and you don't mind downloading a bigger project.

akien-mga commented 3 years ago

Might be related to physics picking changes @RandomShaper?

RandomShaper commented 3 years ago

@akien-mga, maybe. I'll check it.

@lentsius-bark, yes, please share the project. That'll help me a lot.

lentsius-bark commented 3 years ago

@RandomShaper here you go. I stripped the project of unnecessary parts but the problem persists on my end.

If you navigate to a scene called LeGame.tscn and try selecting the "DeliveryBox", or parts of the character on the sword it exhibits the aforementioned behaviour.

SwordSurfers-picking-test.zip

Thanks for looking into this!

RandomShaper commented 3 years ago

Bisected down to 6dbc08668b990ebb6518d37501c6d777b9a5d127.

It made this code section not work as expected: https://github.com/godotengine/godot/blob/db8c2410a4ee6213f5b78d3e8fb9783d9d4f0edf/editor/plugins/spatial_editor_plugin.cpp#L537

I've unassigned myself. I'd gladly try to fix it, but I don't think I'll have time.

RandomShaper commented 3 years ago

That said, if no one willing and able to fix it pops up soon, I'll try to find a spot to do it myself to help unblocking the release.

akien-mga commented 3 years ago

CC @hilfazer @KoBeWi

hilfazer commented 3 years ago

That said, if no one willing and able to fix it pops up soon, I'll try to find a spot to do it myself to help unblocking the release.

I'll give it a try once i'm back from work. However, i won't be able to check it on Linux, only on Windows.

lentsius-bark commented 3 years ago

@hilfazer i can test it on Linux.

hilfazer commented 3 years ago

Testing project: https://github.com/hilfazer/Projects/tree/EngineIssues/Godot/EngineIssues/SelectingHiddenNodesIn3DandCanvasEditors_godot32

Projects created in 3.2.4 are affected as well.

The bug is caused by the new way of storing Editable Children information. The code found by RandomShaper will need to change, tomorrow i'll try to figure it out.

Edit: I think i might have a fix for that. I'll make a PR soon.

lentsius-bark commented 3 years ago

@hilfazer Looking forward to the possible fix! Let me know if you need testing on Linux.

hilfazer commented 3 years ago

@lentsius-bark i'd welcome any help! PR for 3.2 is ready.

lentsius-bark commented 3 years ago

@hilfazer super sorry, I pulled your branch and went to build godot, sadly I got ALSA related errors that I had never met before. Not sure how to fix them either, meaning it looks like I wont be able to test your fix! :(

[100%] /usr/include/alsa/rawmidi.h:82: error: variable 'snd_rawmidi_open' redeclared as function
   82 | int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
      | 
drivers/alsa/asound-so_wrap.c:3042: note: previously declared here
 3042 | int (*snd_rawmidi_open)( snd_rawmidi_t**, snd_rawmidi_t**,const char*, int);
      | 
/usr/include/alsa/rawmidi.h:86: error: variable 'snd_rawmidi_close' redeclared as function
   86 | int snd_rawmidi_close(snd_rawmidi_t *rmidi);
      | 
drivers/alsa/asound-so_wrap.c:3044: note: previously declared here
 3044 | int (*snd_rawmidi_close)( snd_rawmidi_t*);
...
akien-mga commented 3 years ago

These errors should be fixed in the latest 3.2 branch, does it work if you rebase on upstream/3.2?

git remote add upstream https://github.com/godotengine/godot
git pull --rebase upstream 3.2

Edit: Alternatively check out latest 3.2, then re-apply the PR on top:

curl -LO https://github.com/godotengine/godot/pull/46141.patch
git am -3 46141.patch
lentsius-bark commented 3 years ago

@akien-mga Thank you, having done that, I could successfully build the engine! @hilfazer I can confirm that your fix does indeed fix the issue without any other regressions or newly introduced issues my testing found. All projects which previously showcased the behaviour worked fine under the latest build. Awesome work. I can't comment on the code itself as that beyond my abilities but from a pure user perspective, this does indeed fix the issue.

akien-mga commented 3 years ago

Fixed by #46141.

hilfazer commented 3 years ago

There's still a case where a node that's not visible in Scene dock can be selected in the editor - when it's a child of a node from an instanced scene. So it's not the same as this issue, since the node in question is instanced on the edited scene, but it's similar. I'm not sure if it's a bug or not. BTW, it works like that in 3.2.3 stable as well.

A picture that's worth 1000 words: selectHiddenChildOFEditable

@akien-mga @KoBeWi

KoBeWi commented 3 years ago

@hilfazer Do you have reproduction project for that? I can't reproduce it.

hilfazer commented 3 years ago

I forgot to mention "Editable Children" checkbox needs to be unchecked before selecting "ChildOfEditable".

Anyway, there were also problems with saving the scene so i've opened a new issue: https://github.com/godotengine/godot/issues/46726 Reproduction project can be found there.