diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 3 | ||||
-rw-r--r-- | editor/editor_help.cpp | 36 | ||||
-rw-r--r-- | editor/editor_quick_open.cpp | 8 | ||||
-rw-r--r-- | editor/editor_quick_open.h | 6 | ||||
-rw-r--r-- | editor/editor_resource_picker.cpp | 2 | ||||
-rw-r--r-- | editor/editor_spin_slider.cpp | 11 | ||||
-rw-r--r-- | editor/editor_spin_slider.h | 2 | ||||
-rw-r--r-- | editor/history_dock.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 13 |
9 files changed, 47 insertions, 36 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 545b0895b0..cdc3e220fb 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -752,8 +752,7 @@ CreateDialog::CreateDialog() { favorites->connect("cell_selected", callable_mp(this, &CreateDialog::_favorite_selected)); favorites->connect("item_activated", callable_mp(this, &CreateDialog::_favorite_activated)); favorites->add_theme_constant_override("draw_guides", 1); - // Cannot forward drag data to a non control, must be fixed. - //favorites->set_drag_forwarding(this); + favorites->set_drag_forwarding(this); fav_vb->add_margin_child(TTR("Favorites:"), favorites, true); VBoxContainer *rec_vb = memnew(VBoxContainer); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 973e4acbcb..efa85dadee 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -203,13 +203,20 @@ void EditorHelp::_class_desc_resized(bool p_force_update_theme) { } void EditorHelp::_add_type(const String &p_type, const String &p_enum) { - String t = p_type; - if (t.is_empty()) { - t = "void"; + if (p_type.is_empty() || p_type == "void") { + class_desc->push_color(Color(type_color, 0.5)); + class_desc->push_hint(TTR("No return value.")); + class_desc->add_text("void"); + class_desc->pop(); + class_desc->pop(); + return; } - bool can_ref = (t != "void" && !t.contains("*")) || !p_enum.is_empty(); - if (!p_enum.is_empty()) { + bool is_enum_type = !p_enum.is_empty(); + bool can_ref = !p_type.contains("*") || is_enum_type; + + String t = p_type; + if (is_enum_type) { if (p_enum.get_slice_count(".") > 1) { t = p_enum.get_slice(".", 1); } else { @@ -223,21 +230,24 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { if (t.ends_with("[]")) { add_array = true; t = t.replace("[]", ""); + + class_desc->push_meta("#Array"); //class + class_desc->add_text("Array"); + class_desc->pop(); + class_desc->add_text("["); } - if (p_enum.is_empty()) { - class_desc->push_meta("#" + t); //class - } else { + + if (is_enum_type) { class_desc->push_meta("$" + p_enum); //class + } else { + class_desc->push_meta("#" + t); //class } } class_desc->add_text(t); if (can_ref) { - class_desc->pop(); + class_desc->pop(); // Pushed meta above. if (add_array) { - class_desc->add_text(" "); - class_desc->push_meta("#Array"); //class - class_desc->add_text("[]"); - class_desc->pop(); + class_desc->add_text("]"); } } class_desc->pop(); diff --git a/editor/editor_quick_open.cpp b/editor/editor_quick_open.cpp index b4ec3bca15..50429878f9 100644 --- a/editor/editor_quick_open.cpp +++ b/editor/editor_quick_open.cpp @@ -33,7 +33,7 @@ #include "core/os/keyboard.h" #include "editor/editor_node.h" -void EditorQuickOpen::popup_dialog(const StringName &p_base, bool p_enable_multi, bool p_dontclear) { +void EditorQuickOpen::popup_dialog(const String &p_base, bool p_enable_multi, bool p_dontclear) { base_type = p_base; allow_multi_select = p_enable_multi; search_options->set_select_mode(allow_multi_select ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE); @@ -56,7 +56,7 @@ void EditorQuickOpen::_build_search_cache(EditorFileSystemDirectory *p_efsd) { _build_search_cache(p_efsd->get_subdir(i)); } - Vector<String> base_types = String(base_type).split(String(",")); + Vector<String> base_types = base_type.split(","); for (int i = 0; i < p_efsd->get_file_count(); i++) { String file = p_efsd->get_file_path(i); String engine_type = p_efsd->get_file_type(i); @@ -80,7 +80,7 @@ void EditorQuickOpen::_build_search_cache(EditorFileSystemDirectory *p_efsd) { // Store refs to used icons. String ext = file.get_extension(); if (!icons.has(ext)) { - icons.insert(ext, get_theme_icon((has_theme_icon(actual_type, SNAME("EditorIcons")) ? actual_type : String("Object")), SNAME("EditorIcons"))); + icons.insert(ext, get_theme_icon((has_theme_icon(actual_type, SNAME("EditorIcons")) ? actual_type : "Object"), SNAME("EditorIcons"))); } // Stop testing base types as soon as we got a match. @@ -231,7 +231,7 @@ Vector<String> EditorQuickOpen::get_selected_files() const { return selected_files; } -StringName EditorQuickOpen::get_base_type() const { +String EditorQuickOpen::get_base_type() const { return base_type; } diff --git a/editor/editor_quick_open.h b/editor/editor_quick_open.h index 83cbbd7cac..3b7e8136ef 100644 --- a/editor/editor_quick_open.h +++ b/editor/editor_quick_open.h @@ -41,7 +41,7 @@ class EditorQuickOpen : public ConfirmationDialog { LineEdit *search_box = nullptr; Tree *search_options = nullptr; - StringName base_type; + String base_type; bool allow_multi_select = false; bool _load_resources = false; // Prohibitively slow for now. @@ -77,12 +77,12 @@ protected: static void _bind_methods(); public: - StringName get_base_type() const; + String get_base_type() const; String get_selected() const; Vector<String> get_selected_files() const; - void popup_dialog(const StringName &p_base, bool p_enable_multi = false, bool p_dontclear = false); + void popup_dialog(const String &p_base, bool p_enable_multi = false, bool p_dontclear = false); EditorQuickOpen(); }; diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 0b38996b2d..20a9826edb 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -256,7 +256,7 @@ void EditorResourcePicker::_update_menu_items() { paste_valid = ClassDB::is_parent_class(res_type, base) || EditorNode::get_editor_data().script_class_is_parent(res_type, base); - if (!paste_valid) { + if (paste_valid) { break; } } diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 1cdfceebc8..11a8fce9c3 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -619,11 +619,9 @@ bool EditorSpinSlider::is_grabbing() const { void EditorSpinSlider::_focus_entered() { _ensure_input_popup(); - Rect2 gr = get_screen_rect(); value_input->set_text(get_text_value()); - value_input_popup->set_position(gr.position); - value_input_popup->set_size(gr.size); - value_input_popup->call_deferred(SNAME("popup")); + value_input_popup->set_size(get_size()); + value_input_popup->call_deferred(SNAME("show")); value_input->call_deferred(SNAME("grab_focus")); value_input->call_deferred(SNAME("select_all")); value_input->set_focus_next(find_next_valid_focus()->get_path()); @@ -658,14 +656,13 @@ void EditorSpinSlider::_ensure_input_popup() { return; } - value_input_popup = memnew(Popup); + value_input_popup = memnew(Control); add_child(value_input_popup); value_input = memnew(LineEdit); value_input_popup->add_child(value_input); - value_input_popup->set_wrap_controls(true); value_input->set_anchors_and_offsets_preset(PRESET_FULL_RECT); - value_input_popup->connect("popup_hide", callable_mp(this, &EditorSpinSlider::_value_input_closed)); + value_input_popup->connect("hidden", callable_mp(this, &EditorSpinSlider::_value_input_closed)); value_input->connect("text_submitted", callable_mp(this, &EditorSpinSlider::_value_input_submitted)); value_input->connect("focus_exited", callable_mp(this, &EditorSpinSlider::_value_focus_exited)); value_input->connect("gui_input", callable_mp(this, &EditorSpinSlider::_value_input_gui_input)); diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h index afcaa3e4b6..fd5c3dc5df 100644 --- a/editor/editor_spin_slider.h +++ b/editor/editor_spin_slider.h @@ -63,7 +63,7 @@ class EditorSpinSlider : public Range { Vector2 grabbing_spinner_mouse_pos; double pre_grab_value = 0.0; - Popup *value_input_popup = nullptr; + Control *value_input_popup = nullptr; LineEdit *value_input = nullptr; bool value_input_just_closed = false; bool value_input_dirty = false; diff --git a/editor/history_dock.cpp b/editor/history_dock.cpp index 57088a76cb..47b7e9f5d7 100644 --- a/editor/history_dock.cpp +++ b/editor/history_dock.cpp @@ -219,6 +219,8 @@ void HistoryDock::_notification(int p_notification) { } HistoryDock::HistoryDock() { + set_name("History"); + ur_manager = EditorNode::get_undo_redo(); ur_manager->connect("history_changed", callable_mp(this, &HistoryDock::on_history_changed)); ur_manager->connect("version_changed", callable_mp(this, &HistoryDock::on_version_changed)); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 64ac38aaa5..a7124c130b 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1814,7 +1814,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V // Sort by tree order, so re-adding is easy. p_nodes.sort_custom<Node::Comparator>(); - editor_data->get_undo_redo()->create_action(TTR("Reparent Node")); + editor_data->get_undo_redo()->create_action(TTR("Reparent Node"), UndoRedo::MERGE_DISABLE, p_nodes[0]); HashMap<Node *, NodePath> path_renames; Vector<StringName> former_names; @@ -1835,14 +1835,17 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V owners.push_back(E); } - if (new_parent == node->get_parent() && node->get_index() < p_position_in_parent + ni) { + bool same_parent = new_parent == node->get_parent(); + if (same_parent && node->get_index() < p_position_in_parent + ni) { inc--; // If the child will generate a gap when moved, adjust. } - editor_data->get_undo_redo()->add_do_method(node->get_parent(), "remove_child", node); - editor_data->get_undo_redo()->add_do_method(new_parent, "add_child", node, true); + if (!same_parent) { + editor_data->get_undo_redo()->add_do_method(node->get_parent(), "remove_child", node); + editor_data->get_undo_redo()->add_do_method(new_parent, "add_child", node, true); + } - if (p_position_in_parent >= 0) { + if (p_position_in_parent >= 0 || same_parent) { editor_data->get_undo_redo()->add_do_method(new_parent, "move_child", node, p_position_in_parent + inc); } |