1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #95540 from KoBeWi/mouse_buttons_in_the_void

Allow empty click in scene tree dock
This commit is contained in:
Thaddeus Crews
2025-05-28 17:09:37 -05:00

View File

@@ -3747,28 +3747,26 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
} }
void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
if (!EditorNode::get_singleton()->get_edited_scene()) { ERR_FAIL_COND(!EditorNode::get_singleton()->get_edited_scene());
menu->clear(false); menu->clear(false);
if (profile_allow_editing) {
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Add")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
}
menu->reset_size();
menu->set_position(get_screen_position() + p_menu_pos);
menu->popup();
return;
}
List<Node *> selection = editor_selection->get_top_selected_node_list(); List<Node *> selection = editor_selection->get_top_selected_node_list();
List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent. List<Node *> full_selection = editor_selection->get_full_selected_node_list(); // Above method only returns nodes with common parent.
if (selection.is_empty()) { if (selection.is_empty()) {
if (!profile_allow_editing) {
return;
}
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Add")), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Instance")), ED_GET_SHORTCUT("scene_tree/instantiate_scene"), TOOL_INSTANTIATE);
menu->reset_size();
menu->set_position(p_menu_pos);
menu->popup();
return; return;
} }
menu->clear(false);
Ref<Script> existing_script; Ref<Script> existing_script;
bool existing_script_removable = true; bool existing_script_removable = true;
bool allow_attach_new_script = true; bool allow_attach_new_script = true;