diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/connections_dialog.cpp | 4 | ||||
-rw-r--r-- | editor/editor_help.cpp | 3 | ||||
-rw-r--r-- | editor/editor_help.h | 5 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 49 | ||||
-rw-r--r-- | editor/editor_inspector.h | 11 | ||||
-rw-r--r-- | editor/editor_node.cpp | 6 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 3 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 2 |
10 files changed, 94 insertions, 12 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 8933fd7fe8..c4f4e28fec 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -820,7 +820,9 @@ void ConnectionsDock::update_tree() { if (i > 0) signaldesc += ", "; String tname = "var"; - if (pi.type != Variant::NIL) { + if (pi.type == Variant::OBJECT && pi.class_name != StringName()) { + tname = pi.class_name.operator String(); + } else if (pi.type != Variant::NIL) { tname = Variant::get_type_name(pi.type); } signaldesc += tname + " " + (pi.name == "" ? String("arg " + itos(i)) : pi.name); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 65e50560bc..727383b960 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1900,6 +1900,7 @@ void EditorHelpBit::_meta_clicked(String p_select) { void EditorHelpBit::_bind_methods() { ClassDB::bind_method("_meta_clicked", &EditorHelpBit::_meta_clicked); + ClassDB::bind_method(D_METHOD("set_text", "text"), &EditorHelpBit::set_text); ADD_SIGNAL(MethodInfo("request_hide")); } @@ -1925,7 +1926,7 @@ EditorHelpBit::EditorHelpBit() { rich_text = memnew(RichTextLabel); add_child(rich_text); - rich_text->set_anchors_and_margins_preset(Control::PRESET_WIDE); + //rich_text->set_anchors_and_margins_preset(Control::PRESET_WIDE); rich_text->connect("meta_clicked", this, "_meta_clicked"); rich_text->add_color_override("selection_color", get_color("text_editor/theme/selection_color", "Editor")); rich_text->set_override_selected_font_color(false); diff --git a/editor/editor_help.h b/editor/editor_help.h index 514169dc19..dbea97e98b 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -272,9 +272,9 @@ public: ~EditorHelp(); }; -class EditorHelpBit : public Panel { +class EditorHelpBit : public PanelContainer { - GDCLASS(EditorHelpBit, Panel); + GDCLASS(EditorHelpBit, PanelContainer); RichTextLabel *rich_text; void _go_to_help(String p_what); @@ -285,6 +285,7 @@ protected: void _notification(int p_what); public: + RichTextLabel *get_rich_text() { return rich_text; } void set_text(const String &p_text); EditorHelpBit(); }; diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 8d5c320743..488980db07 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -719,6 +719,24 @@ void EditorProperty::set_object_and_property(Object *p_object, const StringName property = p_property; } +Control *EditorProperty::make_custom_tooltip(const String &p_text) const { + + tooltip_text = p_text; + EditorHelpBit *help_bit = memnew(EditorHelpBit); + help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->get_rich_text()->set_fixed_size_to_width(300); + + String text = TTR("Property: ") + "[u][b]" + p_text.get_slice("::", 0) + "[/b][/u]\n"; + text += p_text.get_slice("::", 1).strip_edges(); + help_bit->set_text(text); + help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene + return help_bit; +} + +String EditorProperty::get_tooltip_text() const { + return tooltip_text; +} + void EditorProperty::_bind_methods() { ClassDB::bind_method(D_METHOD("set_label", "text"), &EditorProperty::set_label); @@ -745,6 +763,8 @@ void EditorProperty::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &EditorProperty::_gui_input); ClassDB::bind_method(D_METHOD("_focusable_focused"), &EditorProperty::_focusable_focused); + ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checkable"), "set_checkable", "is_checkable"); @@ -919,6 +939,20 @@ void EditorInspectorCategory::_notification(int p_what) { } } +Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) const { + + tooltip_text = p_text; + EditorHelpBit *help_bit = memnew(EditorHelpBit); + help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel")); + help_bit->get_rich_text()->set_fixed_size_to_width(300); + + String text = "[u][b]" + p_text.get_slice("::", 0) + "[/b][/u]\n"; + text += p_text.get_slice("::", 1).strip_edges(); + help_bit->set_text(text); + help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene + return help_bit; +} + Size2 EditorInspectorCategory::get_minimum_size() const { Ref<Font> font = get_font("font", "Tree"); @@ -934,6 +968,15 @@ Size2 EditorInspectorCategory::get_minimum_size() const { return ms; } +void EditorInspectorCategory::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorInspectorCategory::get_tooltip_text); +} + +String EditorInspectorCategory::get_tooltip_text() const { + + return tooltip_text; +} + EditorInspectorCategory::EditorInspectorCategory() { } @@ -1395,7 +1438,7 @@ void EditorInspector::update_tree() { class_descr_cache[type] = descr.word_wrap(80); } - category->set_tooltip(TTR("Class:") + " " + p.name + (class_descr_cache[type] == "" ? "" : "\n\n" + class_descr_cache[type])); + category->set_tooltip(p.name + "::" + (class_descr_cache[type] == "" ? "" : class_descr_cache[type])); } for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) { @@ -1587,9 +1630,9 @@ void EditorInspector::update_tree() { ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED); ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED); if (doc_hint != String()) { - ep->set_tooltip(TTR("Property:") + " " + property_prefix + p.name + "\n\n" + doc_hint); + ep->set_tooltip(property_prefix + p.name + "::" + doc_hint); } else { - ep->set_tooltip(TTR("Property:") + " " + property_prefix + p.name); + ep->set_tooltip(property_prefix + p.name); } ep->set_draw_red(draw_red); ep->set_use_folding(use_folding); diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index d9b66b05b2..454622d662 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -85,6 +85,8 @@ private: Control *label_reference; Control *bottom_editor; + mutable String tooltip_text; + protected: void _notification(int p_what); static void _bind_methods(); @@ -143,6 +145,10 @@ public: float get_name_split_ratio() const; void set_object_and_property(Object *p_object, const StringName &p_property); + virtual Control *make_custom_tooltip(const String &p_text) const; + + String get_tooltip_text() const; + EditorProperty(); }; @@ -180,12 +186,17 @@ class EditorInspectorCategory : public Control { Ref<Texture> icon; String label; Color bg_color; + mutable String tooltip_text; protected: void _notification(int p_what); + static void _bind_methods(); public: virtual Size2 get_minimum_size() const; + virtual Control *make_custom_tooltip(const String &p_text) const; + + String get_tooltip_text() const; EditorInspectorCategory(); }; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 88266f468a..ff97878e71 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5270,7 +5270,7 @@ EditorNode::EditorNode() { video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor.")); video_restart_dialog->get_ok()->set_text(TTR("Save & Restart")); video_restart_dialog->connect("confirmed", this, "_menu_option", varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART)); - add_child(video_restart_dialog); + gui_base->add_child(video_restart_dialog); progress_hb = memnew(BackgroundProgress); @@ -5289,8 +5289,8 @@ EditorNode::EditorNode() { update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons")); update_menu->get_popup()->connect("id_pressed", this, "_menu_option"); p = update_menu->get_popup(); - p->add_check_item(TTR("Update Always"), SETTINGS_UPDATE_ALWAYS); - p->add_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES); + p->add_radio_check_item(TTR("Update Always"), SETTINGS_UPDATE_ALWAYS); + p->add_radio_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES); p->add_separator(); p->add_check_item(TTR("Disable Update Spinner"), SETTINGS_UPDATE_SPINNER_HIDE); int update_always = EditorSettings::get_singleton()->get_project_metadata("editor_options", "update_always", false); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 4cfdb6f6d3..466b12157d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -364,6 +364,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/highlighting/highlight_all_occurrences", true); _initial_set("text_editor/highlighting/highlight_current_line", true); + _initial_set("text_editor/highlighting/highlight_type_safe_lines", true); _initial_set("text_editor/cursor/scroll_past_end_of_file", false); _initial_set("text_editor/indent/type", 0); @@ -404,6 +405,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { _initial_set("text_editor/completion/callhint_tooltip_offset", Vector2()); _initial_set("text_editor/files/restore_scripts_on_load", true); _initial_set("text_editor/completion/complete_file_paths", true); + _initial_set("text_editor/completion/add_type_hints", false); _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false); _initial_set("docks/scene_tree/draw_relationship_lines", false); @@ -592,6 +594,7 @@ void EditorSettings::_load_default_text_editor_theme() { _initial_set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa")); + _initial_set("text_editor/highlighting/safe_line_number_color", Color::html("99aac8aa")); _initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/caret_background_color", Color::html("000000")); _initial_set("text_editor/highlighting/text_selected_color", Color::html("000000")); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 084caff083..ea9f6db61a 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1089,6 +1089,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { const Color completion_font_color = font_color; const Color text_color = font_color; const Color line_number_color = dim_color; + const Color safe_line_number_color = dim_color * Color(1, 1.2, 1, 1.5); const Color caret_color = mono_color; const Color caret_background_color = mono_color.inverted(); const Color text_selected_color = dark_color_3; @@ -1123,6 +1124,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { setting->set_initial_value("text_editor/highlighting/completion_font_color", completion_font_color, true); setting->set_initial_value("text_editor/highlighting/text_color", text_color, true); setting->set_initial_value("text_editor/highlighting/line_number_color", line_number_color, true); + setting->set_initial_value("text_editor/highlighting/safe_line_number_color", safe_line_number_color, true); setting->set_initial_value("text_editor/highlighting/caret_color", caret_color, true); setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color, true); setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color, true); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index ffc2203475..2263d782d9 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -116,6 +116,7 @@ void ScriptTextEditor::_load_theme_settings() { Color completion_font_color = EDITOR_GET("text_editor/highlighting/completion_font_color"); Color text_color = EDITOR_GET("text_editor/highlighting/text_color"); Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color"); + Color safe_line_number_color = EDITOR_GET("text_editor/highlighting/safe_line_number_color"); Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color"); Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color"); Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color"); @@ -147,6 +148,7 @@ void ScriptTextEditor::_load_theme_settings() { text_edit->add_color_override("completion_font_color", completion_font_color); text_edit->add_color_override("font_color", text_color); text_edit->add_color_override("line_number_color", line_number_color); + text_edit->add_color_override("safe_line_number_color", safe_line_number_color); text_edit->add_color_override("caret_color", caret_color); text_edit->add_color_override("caret_background_color", caret_background_color); text_edit->add_color_override("font_selected_color", text_selected_color); @@ -589,6 +591,7 @@ void ScriptTextEditor::set_edited_script(const Ref<Script> &p_script) { emit_signal("name_changed"); code_editor->update_line_and_column(); + call_deferred("_validate_script"); } void ScriptTextEditor::_validate_script() { @@ -599,8 +602,9 @@ void ScriptTextEditor::_validate_script() { String text = te->get_text(); List<String> fnc; + Set<int> safe_lines; - if (!script->get_language()->validate(text, line, col, errortxt, script->get_path(), &fnc)) { + if (!script->get_language()->validate(text, line, col, errortxt, script->get_path(), &fnc, &safe_lines)) { String error_text = "error(" + itos(line) + "," + itos(col) + "): " + errortxt; code_editor->set_error(error_text); } else { @@ -621,8 +625,23 @@ void ScriptTextEditor::_validate_script() { } line--; + bool highlight_safe = EDITOR_DEF("text_editor/highlighting/highlight_type_safe_lines", true); + bool last_is_safe = false; for (int i = 0; i < te->get_line_count(); i++) { te->set_line_as_marked(i, line == i); + if (highlight_safe) { + if (safe_lines.has(i + 1)) { + te->set_line_as_safe(i, true); + last_is_safe = true; + } else if (last_is_safe && (te->is_line_comment(i) || te->get_line(i).strip_edges().empty())) { + te->set_line_as_safe(i, true); + } else { + te->set_line_as_safe(i, false); + last_is_safe = false; + } + } else { + te->set_line_as_safe(i, false); + } } emit_signal("name_changed"); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 682ca744ff..b9b8b07a2e 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -735,7 +735,7 @@ VisualShaderEditor::VisualShaderEditor() { graph->connect("duplicate_nodes_request", this, "_duplicate_nodes"); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_SCALAR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_SCALAR, VisualShaderNode::PORT_TYPE_VECTOR); - //graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_VECTOR, VisualShaderNode::PORT_TYPE_SCALAR); + graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_VECTOR, VisualShaderNode::PORT_TYPE_SCALAR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_VECTOR, VisualShaderNode::PORT_TYPE_VECTOR); graph->add_valid_connection_type(VisualShaderNode::PORT_TYPE_TRANSFORM, VisualShaderNode::PORT_TYPE_TRANSFORM); |