godotengine / godot

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

Opening 2D/3D scene when no scene was previously open no longer switches to 2D/3D viewport #96535

Open akien-mga opened 2 months ago

akien-mga commented 2 months ago

Tested versions

System information

Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 7600M XT (RADV NAVI33) - AMD Ryzen 7 7840HS w/ Radeon 780M Graphics (16 Threads)

Issue description

Godot has this nifty behavior that it can detect the type of a scene (2D or 3D) based on its root node, and infer the viewport (2D/3D) to open for that scene accordingly.

This seems to have regressed in 4.3.stable and later.

What works:

What doesn't work:

CC @KoBeWi

Steps to reproduce

See above.

Minimal reproduction project (MRP)

Test2DAnd3DScenes.zip

matheusmdx commented 2 months ago

Bisecting points to #91435 as the culprit, @ajreckof

image

fire commented 2 months ago

Read the https://github.com/godotengine/godot/pull/91435 description seems like this was a bugfix, but I not sure how to restore it without breaking it.

ajreckof commented 2 months ago

So what happens here is that when opening a scene it was always selecting the root of the scene when loading in addition to whatever the selection was and this made a lot of problems. The fact that it was switching to the 2D/3D viewer was simply a consequence of this selection. One thing I suggested was to add back the selection in the cases where there is no prior selection. If the switch is always wanted whatever the selection and only depending on the root node then I could add a patch in this way too.

KoBeWi commented 2 months ago

If the switch is always wanted whatever the selection and only depending on the root node then I could add a patch in this way too.

This seems to be the old behavior. #91411 is a regression between dev5 and dev6. In dev5 root node is not selected, but the editor switches correctly.

EDIT: To be precise, this only happens with no selection. If the newly opened scene has selected node, that node is used instead.