summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK. S. Ernest (iFire) Lee <fire@users.noreply.github.com>2021-07-12 09:25:04 -0400
committerGitHub <noreply@github.com>2021-07-12 09:25:04 -0400
commitbea8d68a8ddf8dfaf03ad4c431626dc8e0cc44f8 (patch)
tree2f1c0e5b8b01f2bcf85cb58e513dac9616d8df8c
parent5226fa11b5b8b8d2f46f00b27262365038d5b43e (diff)
parent8844bb785523691c2270426ea1eb07e8deb0161c (diff)
Merge pull request #50393 from Calinou/preview-sun-sky-add-to-beginning
Add the preview sun and sky to the beginning of the scene tree
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index a7177faafa..ec45ffc72d 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -6232,6 +6232,9 @@ void Node3DEditor::_add_sun_to_scene() {
undo_redo->create_action("Add Preview Sun to Scene");
undo_redo->add_do_method(base, "add_child", new_sun);
+ // Move to the beginning of the scene tree since more "global" nodes
+ // generally look better when placed at the top.
+ undo_redo->add_do_method(base, "move_child", new_sun, 0);
undo_redo->add_do_method(new_sun, "set_owner", base);
undo_redo->add_undo_method(base, "remove_child", new_sun);
undo_redo->add_do_reference(new_sun);
@@ -6253,6 +6256,9 @@ void Node3DEditor::_add_environment_to_scene() {
undo_redo->create_action("Add Preview Environment to Scene");
undo_redo->add_do_method(base, "add_child", new_env);
+ // Move to the beginning of the scene tree since more "global" nodes
+ // generally look better when placed at the top.
+ undo_redo->add_do_method(base, "move_child", new_env, 0);
undo_redo->add_do_method(new_env, "set_owner", base);
undo_redo->add_undo_method(base, "remove_child", new_env);
undo_redo->add_do_reference(new_env);