diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/code_editor.cpp | 18 | ||||
-rw-r--r-- | editor/code_editor.h | 1 | ||||
-rw-r--r-- | editor/connections_dialog.cpp | 70 | ||||
-rw-r--r-- | editor/connections_dialog.h | 8 | ||||
-rw-r--r-- | editor/dependency_editor.cpp | 2 | ||||
-rw-r--r-- | editor/editor_file_dialog.cpp | 9 | ||||
-rw-r--r-- | editor/editor_file_dialog.h | 1 | ||||
-rw-r--r-- | editor/editor_help.cpp | 3 | ||||
-rw-r--r-- | editor/editor_help_search.cpp | 95 | ||||
-rw-r--r-- | editor/editor_help_search.h | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 11 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 | ||||
-rw-r--r-- | editor/plugins/text_editor.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/text_editor.h | 1 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 25 | ||||
-rw-r--r-- | editor/scene_tree_editor.h | 2 |
21 files changed, 183 insertions, 92 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 33adb33c8c..4a440510db 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -804,6 +804,24 @@ void CodeTextEditor::trim_trailing_whitespace() { } } +void CodeTextEditor::insert_final_newline() { + int final_line = text_editor->get_line_count() - 1; + + String line = text_editor->get_line(final_line); + + //length 0 means it's already an empty line, + //no need to add a newline + if (line.length() > 0 && !line.ends_with("\n")) { + text_editor->begin_complex_operation(); + + line += "\n"; + text_editor->set_line(final_line, line); + + text_editor->end_complex_operation(); + text_editor->update(); + } +} + void CodeTextEditor::convert_indent_to_spaces() { int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); String indent = ""; diff --git a/editor/code_editor.h b/editor/code_editor.h index 5c6b54ae44..cf97f30b72 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -195,6 +195,7 @@ protected: public: void trim_trailing_whitespace(); + void insert_final_newline(); void convert_indent_to_spaces(); void convert_indent_to_tabs(); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index a9a96da7b1..82fc8e5cfa 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -307,39 +307,42 @@ void ConnectDialog::init(Connection c, bool bEdit) { bEditMode = bEdit; } -void ConnectDialog::popup_dialog(const String &p_for_signal, bool p_advanced) { +void ConnectDialog::popup_dialog(const String &p_for_signal) { - advanced->set_pressed(p_advanced); from_signal->set_text(p_for_signal); error_label->add_color_override("font_color", get_color("error_color", "Editor")); - vbc_right->set_visible(p_advanced); + if (!advanced->is_pressed()) + error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); - if (p_advanced) { + popup_centered(); +} + +void ConnectDialog::_advanced_pressed() { - popup_centered(Size2(900, 500) * EDSCALE); - connect_to_label->set_text("Connect to Node:"); + if (advanced->is_pressed()) { + set_custom_minimum_size(Size2(900, 500) * EDSCALE); + connect_to_label->set_text(TTR("Connect to Node:")); tree->set_connect_to_script_mode(false); + + vbc_right->show(); error_label->hide(); } else { - popup_centered(Size2(700, 500) * EDSCALE); - connect_to_label->set_text("Connect to Script:"); + set_custom_minimum_size(Size2(600, 500) * EDSCALE); + set_size(Size2()); + connect_to_label->set_text(TTR("Connect to Script:")); tree->set_connect_to_script_mode(true); - if (!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())) { - error_label->show(); - } else { - error_label->hide(); - } + vbc_right->hide(); + error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); } -} -void ConnectDialog::_advanced_pressed() { - - popup_dialog(from_signal->get_text(), advanced->is_pressed()); + set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2); } ConnectDialog::ConnectDialog() { + set_custom_minimum_size(Size2(600, 500) * EDSCALE); + VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -356,6 +359,7 @@ ConnectDialog::ConnectDialog() { vbc_left->add_margin_child(TTR("From Signal:"), from_signal); tree = memnew(SceneTreeEditor(false)); + tree->set_connecting_signal(true); tree->get_scene_tree()->connect("item_activated", this, "_ok"); tree->connect("node_selected", this, "_tree_node_selected"); tree->set_connect_to_script_mode(true); @@ -381,7 +385,7 @@ ConnectDialog::ConnectDialog() { type_list->add_item("bool", Variant::BOOL); type_list->add_item("int", Variant::INT); type_list->add_item("real", Variant::REAL); - type_list->add_item("string", Variant::STRING); + type_list->add_item("String", Variant::STRING); type_list->add_item("Vector2", Variant::VECTOR2); type_list->add_item("Rect2", Variant::RECT2); type_list->add_item("Vector3", Variant::VECTOR3); @@ -416,28 +420,26 @@ ConnectDialog::ConnectDialog() { dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); - advanced = memnew(CheckBox); + advanced = memnew(CheckButton); dstm_hb->add_child(advanced); - advanced->set_text(TTR("Advanced...")); + advanced->set_text(TTR("Advanced")); advanced->connect("pressed", this, "_advanced_pressed"); - /* - dst_method_list = memnew( MenuButton ); - dst_method_list->set_text("List..."); - dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_LEFT, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_TOP, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - dst_method_list->set_begin( Point2( 70,59) ); - dst_method_list->set_end( Point2( 15,39 ) ); - */ + // Add spacing so the tree and inspector are the same size. + Control *spacing = memnew(Control); + spacing->set_custom_minimum_size(Size2(0, 4) * EDSCALE); + vbc_right->add_child(spacing); - deferred = memnew(CheckButton); + deferred = memnew(CheckBox); + deferred->set_h_size_flags(0); deferred->set_text(TTR("Deferred")); + deferred->set_tooltip(TTR("Defers the signal, storing it in a queue and only firing it at idle time.")); vbc_right->add_child(deferred); - oneshot = memnew(CheckButton); + oneshot = memnew(CheckBox); + oneshot->set_h_size_flags(0); oneshot->set_text(TTR("Oneshot")); + oneshot->set_tooltip(TTR("Disconnects the signal after its first emission.")); vbc_right->add_child(oneshot); set_as_toplevel(true); @@ -662,9 +664,7 @@ void ConnectionsDock::_open_connection_dialog(TreeItem &item) { c.signal = StringName(signalname); c.target = dst_node; c.method = dst_method; - - //connect_dialog->set_title(TTR("Connect Signal: ") + signalname); - connect_dialog->popup_dialog(signalname, false); + connect_dialog->popup_dialog(signalname); connect_dialog->init(c); connect_dialog->set_title(TTR("Connect a Signal to a Method")); } diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 9b35d84426..94f1510810 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -67,9 +67,9 @@ class ConnectDialog : public ConfirmationDialog { AcceptDialog *error; EditorInspector *bind_editor; OptionButton *type_list; - CheckButton *deferred; - CheckButton *oneshot; - CheckBox *advanced; + CheckBox *deferred; + CheckBox *oneshot; + CheckButton *advanced; Label *error_label; @@ -99,7 +99,7 @@ public: void init(Connection c, bool bEdit = false); - void popup_dialog(const String &p_for_signal, bool p_advanced); + void popup_dialog(const String &p_for_signal); ConnectDialog(); ~ConnectDialog(); }; diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index bde73e9268..cc9e2c12e8 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -725,7 +725,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa int ds = efsd->get_file_deps(i).size(); ti->set_text(1, itos(ds)); if (ds) { - ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons")); + ti->add_button(1, get_icon("GuiVisibilityVisible", "EditorIcons"), -1, false, TTR("Show Dependencies")); } ti->set_metadata(0, path); has_children = true; diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 3d198dec67..1a293adb4b 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1253,6 +1253,12 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) { _update_favorites(); } +void EditorFileDialog::_favorite_pressed() { + + favorite->set_pressed(!favorite->is_pressed()); + _favorite_toggled(favorite->is_pressed()); +} + void EditorFileDialog::_recent_selected(int p_idx) { Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs(); @@ -1376,6 +1382,7 @@ void EditorFileDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("_go_up"), &EditorFileDialog::_go_up); ClassDB::bind_method(D_METHOD("_favorite_toggled"), &EditorFileDialog::_favorite_toggled); + ClassDB::bind_method(D_METHOD("_favorite_pressed"), &EditorFileDialog::_favorite_pressed); ClassDB::bind_method(D_METHOD("_favorite_selected"), &EditorFileDialog::_favorite_selected); ClassDB::bind_method(D_METHOD("_favorite_move_up"), &EditorFileDialog::_favorite_move_up); ClassDB::bind_method(D_METHOD("_favorite_move_down"), &EditorFileDialog::_favorite_move_down); @@ -1519,7 +1526,7 @@ EditorFileDialog::EditorFileDialog() { favorite->set_flat(true); favorite->set_toggle_mode(true); favorite->set_tooltip(TTR("(Un)favorite current folder.")); - favorite->connect("toggled", this, "_favorite_toggled"); + favorite->connect("pressed", this, "_favorite_pressed"); pathhb->add_child(favorite); Ref<ButtonGroup> view_mode_group; diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h index edaccac51d..529aaa71de 100644 --- a/editor/editor_file_dialog.h +++ b/editor/editor_file_dialog.h @@ -151,6 +151,7 @@ private: void _update_favorites(); void _favorite_toggled(bool p_toggle); + void _favorite_pressed(); void _favorite_selected(int p_idx); void _favorite_move_up(); void _favorite_move_down(); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 5917869988..df25b08b4c 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -203,8 +203,9 @@ String EditorHelp::_fix_constant(const String &p_constant) const { if (p_constant.strip_edges() == "2147483647") { return "0x7FFFFFFF"; } + if (p_constant.strip_edges() == "1048575") { - return "0xfffff"; + return "0xFFFFF"; } return p_constant; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 616a52e25b..55ab38ba6c 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -250,6 +250,25 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(results_tree, true); } +bool EditorHelpSearch::Runner::_is_class_disabled_by_feature_profile(const StringName &p_class) { + + Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); + if (profile.is_null()) { + return false; + } + + StringName class_name = p_class; + while (class_name != StringName()) { + + if (!ClassDB::class_exists(class_name) || profile->is_class_disabled(class_name)) { + return true; + } + class_name = ClassDB::get_parent_class(class_name); + } + + return false; +} + bool EditorHelpSearch::Runner::_slice() { bool phase_done = false; @@ -299,43 +318,45 @@ bool EditorHelpSearch::Runner::_phase_match_classes_init() { bool EditorHelpSearch::Runner::_phase_match_classes() { DocData::ClassDoc &class_doc = iterator_doc->value(); - - matches[class_doc.name] = ClassMatch(); - ClassMatch &match = matches[class_doc.name]; - - match.doc = &class_doc; - - // Match class name. - if (search_flags & SEARCH_CLASSES) - match.name = term == "" || _match_string(term, class_doc.name); - - // Match members if the term is long enough. - if (term.length() > 1) { - if (search_flags & SEARCH_METHODS) - for (int i = 0; i < class_doc.methods.size(); i++) { - String method_name = search_flags & SEARCH_CASE_SENSITIVE ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); - if (method_name.find(term) > -1 || - (term.begins_with(".") && method_name.begins_with(term.right(1))) || - (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || - (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) - match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); - } - if (search_flags & SEARCH_SIGNALS) - for (int i = 0; i < class_doc.signals.size(); i++) - if (_match_string(term, class_doc.signals[i].name)) - match.signals.push_back(const_cast<DocData::MethodDoc *>(&class_doc.signals[i])); - if (search_flags & SEARCH_CONSTANTS) - for (int i = 0; i < class_doc.constants.size(); i++) - if (_match_string(term, class_doc.constants[i].name)) - match.constants.push_back(const_cast<DocData::ConstantDoc *>(&class_doc.constants[i])); - if (search_flags & SEARCH_PROPERTIES) - for (int i = 0; i < class_doc.properties.size(); i++) - if (_match_string(term, class_doc.properties[i].name)) - match.properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.properties[i])); - if (search_flags & SEARCH_THEME_ITEMS) - for (int i = 0; i < class_doc.theme_properties.size(); i++) - if (_match_string(term, class_doc.theme_properties[i].name)) - match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i])); + if (!_is_class_disabled_by_feature_profile(class_doc.name)) { + + matches[class_doc.name] = ClassMatch(); + ClassMatch &match = matches[class_doc.name]; + + match.doc = &class_doc; + + // Match class name. + if (search_flags & SEARCH_CLASSES) + match.name = term == "" || _match_string(term, class_doc.name); + + // Match members if the term is long enough. + if (term.length() > 1) { + if (search_flags & SEARCH_METHODS) + for (int i = 0; i < class_doc.methods.size(); i++) { + String method_name = search_flags & SEARCH_CASE_SENSITIVE ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.right(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) + match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i])); + } + if (search_flags & SEARCH_SIGNALS) + for (int i = 0; i < class_doc.signals.size(); i++) + if (_match_string(term, class_doc.signals[i].name)) + match.signals.push_back(const_cast<DocData::MethodDoc *>(&class_doc.signals[i])); + if (search_flags & SEARCH_CONSTANTS) + for (int i = 0; i < class_doc.constants.size(); i++) + if (_match_string(term, class_doc.constants[i].name)) + match.constants.push_back(const_cast<DocData::ConstantDoc *>(&class_doc.constants[i])); + if (search_flags & SEARCH_PROPERTIES) + for (int i = 0; i < class_doc.properties.size(); i++) + if (_match_string(term, class_doc.properties[i].name)) + match.properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.properties[i])); + if (search_flags & SEARCH_THEME_ITEMS) + for (int i = 0; i < class_doc.theme_properties.size(); i++) + if (_match_string(term, class_doc.theme_properties[i].name)) + match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i])); + } } iterator_doc = iterator_doc->next(); diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index 93cf66a0dd..12ffd024a7 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -125,6 +125,8 @@ class EditorHelpSearch::Runner : public Reference { Map<String, TreeItem *> class_items; TreeItem *matched_item; + bool _is_class_disabled_by_feature_profile(const StringName &p_class); + bool _slice(); bool _phase_match_classes_init(); bool _phase_match_classes(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index ecb9ea5f35..e4ddf44bc4 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -66,7 +66,7 @@ Size2 EditorProperty::get_minimum_size() const { if (checkable) { Ref<Texture> check = get_icon("checked", "CheckBox"); - ms.width += check->get_width() + get_constant("hseparator", "Tree"); + ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree"); } if (bottom_editor != NULL && bottom_editor->is_visible()) { @@ -228,8 +228,7 @@ void EditorProperty::_notification(int p_what) { } check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height()); draw_texture(checkbox, check_rect.position, color2); - ofs += get_constant("hseparator", "Tree"); - ofs += checkbox->get_width(); + ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox"); text_limit -= ofs; } else { check_rect = Rect2(); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 0dfb53b34a..a0774ac696 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -733,6 +733,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt image_data = cached_data; file->close(); + memdelete(file); } } @@ -807,6 +808,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons if (file) { file->store_line(new_etag); file->close(); + memdelete(file); } int len = p_data.size(); @@ -816,6 +818,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons file->store_32(len); file->store_buffer(r.ptr(), len); file->close(); + memdelete(file); } break; @@ -855,6 +858,7 @@ void EditorAssetLibrary::_update_image_queue() { if (file) { headers.push_back("If-None-Match: " + file->get_line()); file->close(); + memdelete(file); } } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 641c387c64..f45e6a2c9a 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -723,6 +723,8 @@ void ScriptEditor::_resave_scripts(const String &p_str) { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { se->convert_indent_to_spaces(); @@ -1078,6 +1080,8 @@ void ScriptEditor::_menu_option(int p_option) { if (trim_trailing_whitespace_on_save) current->trim_trailing_whitespace(); + current->insert_final_newline(); + if (convert_indent_on_save) { if (use_space_indentation) { current->convert_indent_to_spaces(); @@ -1097,7 +1101,10 @@ void ScriptEditor::_menu_option(int p_option) { } break; case FILE_SAVE_AS: { - current->trim_trailing_whitespace(); + if (trim_trailing_whitespace_on_save) + current->trim_trailing_whitespace(); + + current->insert_final_newline(); if (convert_indent_on_save) { if (use_space_indentation) { @@ -2121,6 +2128,8 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + se->insert_final_newline(); + if (!se->is_unsaved()) continue; diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 683fa881f8..fae98d6ec8 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -99,6 +99,7 @@ public: virtual void set_executing_line(int p_line) = 0; virtual void clear_executing_line() = 0; virtual void trim_trailing_whitespace() = 0; + virtual void insert_final_newline() = 0; virtual void convert_indent_to_spaces() = 0; virtual void convert_indent_to_tabs() = 0; virtual void ensure_focus() = 0; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 1fe4ac1372..79867f40ca 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -457,6 +457,11 @@ void ScriptTextEditor::trim_trailing_whitespace() { code_editor->trim_trailing_whitespace(); } +void ScriptTextEditor::insert_final_newline() { + + code_editor->insert_final_newline(); +} + void ScriptTextEditor::convert_indent_to_spaces() { code_editor->convert_indent_to_spaces(); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index bdfdf18d45..7f5b6c065d 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -194,6 +194,7 @@ public: virtual void set_edit_state(const Variant &p_state); virtual void ensure_focus(); virtual void trim_trailing_whitespace(); + virtual void insert_final_newline(); virtual void convert_indent_to_spaces(); virtual void convert_indent_to_tabs(); virtual void tag_saved_version(); diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp index a0f3c253d1..d036d7e965 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -251,6 +251,11 @@ void TextEditor::trim_trailing_whitespace() { code_editor->trim_trailing_whitespace(); } +void TextEditor::insert_final_newline() { + + code_editor->insert_final_newline(); +} + void TextEditor::convert_indent_to_spaces() { code_editor->convert_indent_to_spaces(); diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h index 2da7474793..e06d816177 100644 --- a/editor/plugins/text_editor.h +++ b/editor/plugins/text_editor.h @@ -130,6 +130,7 @@ public: virtual void set_executing_line(int p_line); virtual void clear_executing_line(); virtual void trim_trailing_whitespace(); + virtual void insert_final_newline(); virtual void convert_indent_to_spaces(); virtual void convert_indent_to_tabs(); virtual void ensure_focus(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 3f513de30f..5e1d818ce9 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -780,7 +780,8 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p r.position += (r.size + Vector2(spacing, spacing)) * offset; } Size2 sc = p_xform.get_scale(); - Size2 cell_size = node->get_cell_size(); + /* For a future CheckBox to Center Texture: + Size2 cell_size = node->get_cell_size(); */ Rect2 rect = Rect2(); rect.position = node->map_to_world(p_point) + node->get_cell_draw_offset(); @@ -792,10 +793,11 @@ void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p if (p_transpose) { SWAP(tile_ofs.x, tile_ofs.y); + /* For a future CheckBox to Center Texture: rect.position.x += cell_size.x / 2 - rect.size.y / 2; rect.position.y += cell_size.y / 2 - rect.size.x / 2; } else { - rect.position += cell_size / 2 - rect.size / 2; + rect.position += cell_size / 2 - rect.size / 2; */ } if (p_flip_h) { diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 5ca3448693..e1b4320378 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -51,6 +51,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i if (connect_to_script_mode) { return; //don't do anything in this mode } + TreeItem *item = Object::cast_to<TreeItem>(p_item); ERR_FAIL_COND(!item); @@ -220,23 +221,27 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { } if (marked.has(p_node)) { - item->set_text(0, String(p_node->get_name()) + " " + TTR("(Connecting From)")); - + String node_name = p_node->get_name(); + if (connecting_signal) { + node_name += " " + TTR("(Connecting From)"); + } + item->set_text(0, node_name); item->set_custom_color(0, accent); } } else if (part_of_subscene) { - //item->set_selectable(0,marked_selectable); if (valid_types.size() == 0) { item->set_custom_color(0, get_color("disabled_font_color", "Editor")); } - } else if (marked.has(p_node)) { - if (!connect_to_script_mode) { - item->set_selectable(0, marked_selectable); + String node_name = p_node->get_name(); + if (connecting_signal) { + node_name += " " + TTR("(Connecting From)"); } - item->set_custom_color(0, get_color("error_color", "Editor")); + item->set_text(0, node_name); + item->set_selectable(0, marked_selectable); + item->set_custom_color(0, get_color("accent_color", "Editor")); } else if (!marked_selectable && !marked_children_selectable) { Node *node = p_node; @@ -1033,6 +1038,11 @@ void SceneTreeEditor::set_connect_to_script_mode(bool p_enable) { update_tree(); } +void SceneTreeEditor::set_connecting_signal(bool p_enable) { + connecting_signal = p_enable; + update_tree(); +} + void SceneTreeEditor::_bind_methods() { ClassDB::bind_method("_tree_changed", &SceneTreeEditor::_tree_changed); @@ -1077,6 +1087,7 @@ void SceneTreeEditor::_bind_methods() { SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_open_instance) { connect_to_script_mode = false; + connecting_signal = false; undo_redo = NULL; tree_dirty = true; selected = NULL; diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index 1c14da0d3a..68642910e8 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -68,6 +68,7 @@ class SceneTreeEditor : public Control { AcceptDialog *warning; bool connect_to_script_mode; + bool connecting_signal; int blocked; @@ -155,6 +156,7 @@ public: void update_tree() { _update_tree(); } void set_connect_to_script_mode(bool p_enable); + void set_connecting_signal(bool p_enable); Tree *get_scene_tree() { return tree; } |