Skip to content

Commit 1a02eef

Browse files
committed
Merge pull request #95540 from KoBeWi/mouse_buttons_in_the_void
Allow empty click in scene tree dock
2 parents f8a4781 + e5ed038 commit 1a02eef

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

editor/scene_tree_dock.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,28 +3747,26 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
37473747
}
37483748

37493749
void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
3750-
if (!EditorNode::get_singleton()->get_edited_scene()) {
3751-
menu->clear(false);
3752-
if (profile_allow_editing) {
3753-
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Add")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
3754-
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
3755-
}
3756-
3757-
menu->reset_size();
3758-
menu->set_position(get_screen_position() + p_menu_pos);
3759-
menu->popup();
3760-
return;
3761-
}
3750+
ERR_FAIL_COND(!EditorNode::get_singleton()->get_edited_scene());
3751+
menu->clear(false);
37623752

37633753
List<Node *> selection = editor_selection->get_top_selected_node_list();
37643754
List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent.
37653755

37663756
if (selection.is_empty()) {
3757+
if (!profile_allow_editing) {
3758+
return;
3759+
}
3760+
3761+
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Add")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
3762+
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
3763+
3764+
menu->reset_size();
3765+
menu->set_position(p_menu_pos);
3766+
menu->popup();
37673767
return;
37683768
}
37693769

3770-
menu->clear(false);
3771-
37723770
Ref<Script> existing_script;
37733771
bool existing_script_removable = true;
37743772
bool allow_attach_new_script = true;

0 commit comments

Comments
 (0)