diff options
-rw-r--r-- | core/extension/gdextension.cpp | 4 | ||||
-rw-r--r-- | core/variant/type_info.h | 1 | ||||
-rw-r--r-- | editor/SCsub | 1 | ||||
-rw-r--r-- | editor/debugger/editor_performance_profiler.cpp | 2 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 6 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.cpp | 2 | ||||
-rw-r--r-- | editor/editor_builders.py | 10 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 16 | ||||
-rw-r--r-- | editor/editor_properties.h | 3 | ||||
-rw-r--r-- | editor/editor_translation.cpp | 24 | ||||
-rw-r--r-- | editor/plugins/font_config_plugin.cpp | 20 | ||||
-rw-r--r-- | editor/plugins/packed_scene_translation_parser_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 15 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | platform/linuxbsd/wayland/wayland_thread.cpp | 2 | ||||
-rw-r--r-- | scene/gui/color_picker.cpp | 28 | ||||
-rw-r--r-- | scene/gui/color_picker.h | 7 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 4 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp | 2 |
19 files changed, 108 insertions, 45 deletions
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 5d43dceece..0ed4c3380c 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -735,7 +735,7 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb bool library_copied = false; if (Engine::get_singleton()->is_editor_hint()) { if (!FileAccess::exists(abs_path)) { - ERR_PRINT("GDExtension library not found: " + library_path); + ERR_PRINT("GDExtension library not found: " + abs_path); return ERR_FILE_NOT_FOUND; } @@ -750,7 +750,7 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb Error copy_err = DirAccess::copy_absolute(abs_path, copy_path); if (copy_err) { - ERR_PRINT("Error copying GDExtension library: " + library_path); + ERR_PRINT("Error copying GDExtension library: " + abs_path); return ERR_CANT_CREATE; } FileAccess::set_hidden_attribute(copy_path, true); diff --git a/core/variant/type_info.h b/core/variant/type_info.h index 32c410463b..9c52db3345 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -296,6 +296,7 @@ public: _FORCE_INLINE_ constexpr BitField(T p_value) { value = (int64_t)p_value; } _FORCE_INLINE_ operator int64_t() const { return value; } _FORCE_INLINE_ operator Variant() const { return value; } + _FORCE_INLINE_ BitField<T> operator^(const BitField<T> &p_b) const { return BitField<T>(value ^ p_b.value); } }; #define TEMPL_MAKE_BITFIELD_TYPE_INFO(m_enum, m_impl) \ diff --git a/editor/SCsub b/editor/SCsub index 442d0a3b75..f4d30b68b1 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -104,6 +104,7 @@ if env.editor_build: # Extractable translations tlist = glob.glob(env.Dir("#editor/translations/extractable").abspath + "/*.po") + tlist.extend(glob.glob(env.Dir("#editor/translations/extractable").abspath + "/extractable.pot")) env.Depends("#editor/extractable_translations.gen.h", tlist) env.CommandNoCache( "#editor/extractable_translations.gen.h", diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index ffff362a94..da75715b6d 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -84,7 +84,7 @@ String EditorPerformanceProfiler::_create_label(float p_value, Performance::Moni return String::humanize_size(p_value); } case Performance::MONITOR_TYPE_TIME: { - return TS->format_number(rtos(p_value * 1000).pad_decimals(2)) + " " + RTR("ms"); + return TS->format_number(rtos(p_value * 1000).pad_decimals(2)) + " " + TTR("ms"); } default: { return TS->format_number(rtos(p_value)); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index c1500631fe..ce08d40634 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -125,12 +125,12 @@ String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_ca const int dmode = display_mode->get_selected(); if (dmode == DISPLAY_FRAME_TIME) { - return TS->format_number(rtos(p_time * 1000).pad_decimals(2)) + " " + RTR("ms"); + return TS->format_number(rtos(p_time * 1000).pad_decimals(2)) + " " + TTR("ms"); } else if (dmode == DISPLAY_AVERAGE_TIME) { if (p_calls == 0) { - return TS->format_number("0.00") + " " + RTR("ms"); + return TS->format_number("0.00") + " " + TTR("ms"); } else { - return TS->format_number(rtos((p_time / p_calls) * 1000).pad_decimals(2)) + " " + RTR("ms"); + return TS->format_number(rtos((p_time / p_calls) * 1000).pad_decimals(2)) + " " + TTR("ms"); } } else if (dmode == DISPLAY_FRAME_PERCENT) { return _get_percent_txt(p_time, m.frame_time); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 72f1060589..8a5c464c2f 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -116,7 +116,7 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) { int dmode = display_mode->get_selected(); if (dmode == DISPLAY_FRAME_TIME) { - return TS->format_number(String::num(p_time, 2)) + " " + RTR("ms"); + return TS->format_number(String::num(p_time, 2)) + " " + TTR("ms"); } else if (dmode == DISPLAY_FRAME_PERCENT) { return TS->format_number(String::num(p_time * 100 / graph_limit, 2)) + " " + TS->percent_sign(); } diff --git a/editor/editor_builders.py b/editor/editor_builders.py index 68595047fe..a25f4949c4 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -61,7 +61,9 @@ def make_translations_header(target, source, env, category): xl_names = [] for i in range(len(sorted_paths)): - if msgfmt_available: + name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] + # msgfmt erases non-translated messages, so avoid using it if exporting the POT. + if msgfmt_available and name != category: mo_path = os.path.join(tempfile.gettempdir(), uuid.uuid4().hex + ".mo") cmd = "msgfmt " + sorted_paths[i] + " --no-hash -o " + mo_path try: @@ -79,7 +81,7 @@ def make_translations_header(target, source, env, category): try: os.remove(mo_path) except OSError as e: - # Do not fail the entire build if it cannot delete a temporary file + # Do not fail the entire build if it cannot delete a temporary file. print( "WARNING: Could not delete temporary .mo file: path=%r; [%s] %s" % (mo_path, e.__class__.__name__, e) @@ -88,11 +90,13 @@ def make_translations_header(target, source, env, category): with open(sorted_paths[i], "rb") as f: buf = f.read() + if name == category: + name = "source" + decomp_size = len(buf) # Use maximum zlib compression level to further reduce file size # (at the cost of initial build times). buf = zlib.compress(buf, zlib.Z_BEST_COMPRESSION) - name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] g.write("static const unsigned char _{}_translation_{}_compressed[] = {{\n".format(category, name)) for j in range(len(buf)): diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 0e3b408996..b7380c9fc2 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2630,16 +2630,22 @@ void EditorPropertyColor::_set_read_only(bool p_read_only) { } void EditorPropertyColor::_color_changed(const Color &p_color) { + if (!live_changes_enabled) { + return; + } + // Cancel the color change if the current color is identical to the new one. - if (get_edited_property_value() == p_color) { + if (((Color)get_edited_property_value()).is_equal_approx(p_color)) { return; } - emit_changed(get_edited_property(), p_color, "", true); + // Preview color change, bypassing undo/redo. + get_edited_object()->set(get_edited_property(), p_color); } void EditorPropertyColor::_popup_closed() { - if (picker->get_pick_color() != last_color) { + get_edited_object()->set(get_edited_property(), last_color); + if (!picker->get_pick_color().is_equal_approx(last_color)) { emit_changed(get_edited_property(), picker->get_pick_color(), "", false); } } @@ -2682,6 +2688,10 @@ void EditorPropertyColor::setup(bool p_show_alpha) { picker->set_edit_alpha(p_show_alpha); } +void EditorPropertyColor::set_live_changes_enabled(bool p_enabled) { + live_changes_enabled = p_enabled; +} + EditorPropertyColor::EditorPropertyColor() { picker = memnew(ColorPickerButton); add_child(picker); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index fa759d5d19..ce164733fe 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -621,10 +621,10 @@ class EditorPropertyColor : public EditorProperty { ColorPickerButton *picker = nullptr; void _color_changed(const Color &p_color); void _popup_closed(); - void _picker_created(); void _picker_opening(); Color last_color; + bool live_changes_enabled = true; protected: virtual void _set_read_only(bool p_read_only) override; @@ -633,6 +633,7 @@ protected: public: virtual void update_property() override; void setup(bool p_show_alpha); + void set_live_changes_enabled(bool p_enabled); EditorPropertyColor(); }; diff --git a/editor/editor_translation.cpp b/editor/editor_translation.cpp index 302a81669d..194d78326d 100644 --- a/editor/editor_translation.cpp +++ b/editor/editor_translation.cpp @@ -160,20 +160,22 @@ List<StringName> get_extractable_message_list() { ExtractableTranslationList *etl = _extractable_translations; List<StringName> msgids; while (etl->data) { - Vector<uint8_t> data; - data.resize(etl->uncomp_size); - int ret = Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE); - ERR_FAIL_COND_V_MSG(ret == -1, msgids, "Compressed file is corrupt."); + if (!strcmp(etl->lang, "source")) { + Vector<uint8_t> data; + data.resize(etl->uncomp_size); + int ret = Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE); + ERR_FAIL_COND_V_MSG(ret == -1, msgids, "Compressed file is corrupt."); - Ref<FileAccessMemory> fa; - fa.instantiate(); - fa->open_custom(data.ptr(), data.size()); + Ref<FileAccessMemory> fa; + fa.instantiate(); + fa->open_custom(data.ptr(), data.size()); - Ref<Translation> tr = TranslationLoaderPO::load_translation(fa); + Ref<Translation> tr = TranslationLoaderPO::load_translation(fa); - if (tr.is_valid()) { - tr->get_message_list(&msgids); - break; + if (tr.is_valid()) { + tr->get_message_list(&msgids); + break; + } } etl++; diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index 70911ea364..be7ff6ba3e 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -716,7 +716,7 @@ void EditorPropertyOTFeatures::update_property() { } for (int i = 0; i < FGRP_MAX; i++) { if (have_sub[i]) { - menu->add_submenu_node_item(RTR(group_names[i]), menu_sub[i]); + menu->add_submenu_node_item(TTRGET(group_names[i]), menu_sub[i]); } } @@ -848,15 +848,15 @@ EditorPropertyOTFeatures::EditorPropertyOTFeatures() { menu_sub[i]->connect("id_pressed", callable_mp(this, &EditorPropertyOTFeatures::_add_feature)); } - group_names[FGRP_STYLISTIC_SET] = "Stylistic Sets"; - group_names[FGRP_CHARACTER_VARIANT] = "Character Variants"; - group_names[FGRP_CAPITLS] = "Capitals"; - group_names[FGRP_LIGATURES] = "Ligatures"; - group_names[FGRP_ALTERNATES] = "Alternates"; - group_names[FGRP_EAL] = "East Asian Language"; - group_names[FGRP_EAW] = "East Asian Widths"; - group_names[FGRP_NUMAL] = "Numeral Alignment"; - group_names[FGRP_CUSTOM] = "Custom"; + group_names[FGRP_STYLISTIC_SET] = TTRC("Stylistic Sets"); + group_names[FGRP_CHARACTER_VARIANT] = TTRC("Character Variants"); + group_names[FGRP_CAPITLS] = TTRC("Capitals"); + group_names[FGRP_LIGATURES] = TTRC("Ligatures"); + group_names[FGRP_ALTERNATES] = TTRC("Alternates"); + group_names[FGRP_EAL] = TTRC("East Asian Language"); + group_names[FGRP_EAW] = TTRC("East Asian Widths"); + group_names[FGRP_NUMAL] = TTRC("Numeral Alignment"); + group_names[FGRP_CUSTOM] = TTRC("Custom"); } /*************************************************************************/ diff --git a/editor/plugins/packed_scene_translation_parser_plugin.cpp b/editor/plugins/packed_scene_translation_parser_plugin.cpp index 86df57c469..e266a3241b 100644 --- a/editor/plugins/packed_scene_translation_parser_plugin.cpp +++ b/editor/plugins/packed_scene_translation_parser_plugin.cpp @@ -136,6 +136,10 @@ Error PackedSceneEditorTranslationParserPlugin::parse_file(const String &p_path, if (property_name == "script" && property_value.get_type() == Variant::OBJECT && !property_value.is_null()) { // Parse built-in script. Ref<Script> s = Object::cast_to<Script>(property_value); + if (!s->is_built_in()) { + continue; + } + String extension = s->get_language()->get_extension(); if (EditorTranslationParser::get_singleton()->can_parse(extension)) { Vector<String> temp; diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index c093f556ea..640c755ccf 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1164,11 +1164,22 @@ void ScriptTextEditor::_update_connected_methods() { // Add override icons to methods. methods_found.clear(); for (int i = 0; i < functions.size(); i++) { - StringName name = StringName(functions[i].get_slice(":", 0)); + String raw_name = functions[i].get_slice(":", 0); + StringName name = StringName(raw_name); if (methods_found.has(name)) { continue; } + // Account for inner classes + if (raw_name.contains(".")) { + // Strip inner class name from the method, and start from the right since + // our inner class might be inside another inner class + int pos = raw_name.rfind("."); + if (pos != -1) { + name = raw_name.substr(pos + 1); + } + } + String found_base_class; StringName base_class = script->get_instance_base_type(); Ref<Script> inherited_script = script->get_base_script(); @@ -1217,7 +1228,7 @@ void ScriptTextEditor::_update_connected_methods() { text_edit->set_line_gutter_icon(line, connection_gutter, get_parent_control()->get_editor_theme_icon(SNAME("MethodOverrideAndSlot"))); } - methods_found.insert(name); + methods_found.insert(StringName(raw_name)); } } } diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 964558ee78..c83c47577d 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -6922,6 +6922,8 @@ Control *VisualShaderNodePluginDefault::create_editor(const Ref<Resource> &p_par } else if (Object::cast_to<EditorPropertyEnum>(prop)) { prop->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); Object::cast_to<EditorPropertyEnum>(prop)->set_option_button_clip(false); + } else if (Object::cast_to<EditorPropertyColor>(prop)) { + Object::cast_to<EditorPropertyColor>(prop)->set_live_changes_enabled(false); } editors.push_back(prop); diff --git a/platform/linuxbsd/wayland/wayland_thread.cpp b/platform/linuxbsd/wayland/wayland_thread.cpp index 4057587db7..7f9008e952 100644 --- a/platform/linuxbsd/wayland/wayland_thread.cpp +++ b/platform/linuxbsd/wayland/wayland_thread.cpp @@ -1563,7 +1563,7 @@ void WaylandThread::_wl_pointer_on_frame(void *data, struct wl_pointer *wl_point } if (old_pd.pressed_button_mask != pd.pressed_button_mask) { - BitField<MouseButtonMask> pressed_mask_delta = BitField<MouseButtonMask>((uint32_t)old_pd.pressed_button_mask ^ (uint32_t)pd.pressed_button_mask); + BitField<MouseButtonMask> pressed_mask_delta = old_pd.pressed_button_mask ^ pd.pressed_button_mask; const MouseButton buttons_to_test[] = { MouseButton::LEFT, diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index ee2122f269..3b62f6c23d 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -714,6 +714,10 @@ Color ColorPicker::get_pick_color() const { return color; } +Color ColorPicker::get_old_color() const { + return old_color; +} + void ColorPicker::set_picker_shape(PickerShapeType p_shape) { ERR_FAIL_INDEX(p_shape, SHAPE_MAX); if (p_shape == current_shape) { @@ -1514,7 +1518,7 @@ void ColorPicker::_pick_finished() { return; } - if (Input::get_singleton()->is_key_pressed(Key::ESCAPE)) { + if (Input::get_singleton()->is_action_just_pressed(SNAME("ui_cancel"))) { set_pick_color(old_color); } else { emit_signal(SNAME("color_changed"), color); @@ -1627,7 +1631,12 @@ void ColorPicker::_html_focus_exit() { if (c_text->is_menu_visible()) { return; } - _html_submitted(c_text->get_text()); + + if (is_visible_in_tree()) { + _html_submitted(c_text->get_text()); + } else { + _update_text_value(); + } } void ColorPicker::set_can_add_swatches(bool p_enabled) { @@ -2026,6 +2035,15 @@ ColorPicker::~ColorPicker() { ///////////////// +void ColorPickerPopupPanel::_input_from_window(const Ref<InputEvent> &p_event) { + if (p_event->is_action_pressed(SNAME("ui_accept"), false, true)) { + _close_pressed(); + } + PopupPanel::_input_from_window(p_event); +} + +///////////////// + void ColorPickerButton::_about_to_popup() { set_pressed(true); if (picker) { @@ -2040,6 +2058,10 @@ void ColorPickerButton::_color_changed(const Color &p_color) { } void ColorPickerButton::_modal_closed() { + if (Input::get_singleton()->is_action_just_pressed(SNAME("ui_cancel"))) { + set_pick_color(picker->get_old_color()); + emit_signal(SNAME("color_changed"), color); + } emit_signal(SNAME("popup_closed")); set_pressed(false); } @@ -2137,7 +2159,7 @@ PopupPanel *ColorPickerButton::get_popup() { void ColorPickerButton::_update_picker() { if (!picker) { - popup = memnew(PopupPanel); + popup = memnew(ColorPickerPopupPanel); popup->set_wrap_controls(true); picker = memnew(ColorPicker); picker->set_anchors_and_offsets_preset(PRESET_FULL_RECT); diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h index 282926d1ff..ad028584b1 100644 --- a/scene/gui/color_picker.h +++ b/scene/gui/color_picker.h @@ -317,12 +317,11 @@ public: void set_edit_alpha(bool p_show); bool is_editing_alpha() const; - int get_preset_size(); - void _set_pick_color(const Color &p_color, bool p_update_sliders); void set_pick_color(const Color &p_color); Color get_pick_color() const; void set_old_color(const Color &p_color); + Color get_old_color() const; void set_display_old_color(bool p_enabled); bool is_displaying_old_color() const; @@ -375,6 +374,10 @@ public: ~ColorPicker(); }; +class ColorPickerPopupPanel : public PopupPanel { + virtual void _input_from_window(const Ref<InputEvent> &p_event) override; +}; + class ColorPickerButton : public Button { GDCLASS(ColorPickerButton, Button); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 29e4956588..a7cd18e1a8 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1113,7 +1113,7 @@ void TextEdit::_notification(int p_what) { Vector<Vector2> sel = TS->shaped_text_get_selection(rid, sel_from, sel_to); // Show selection at the end of line. - if (line < get_selection_to_line(c)) { + if (line_wrap_index == line_wrap_amount && line < get_selection_to_line(c)) { if (rtl) { sel.push_back(Vector2(-char_w, 0)); } else { @@ -1123,7 +1123,7 @@ void TextEdit::_notification(int p_what) { } for (int j = 0; j < sel.size(); j++) { - Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y, Math::ceil(sel[j].y - sel[j].x), row_height); + Rect2 rect = Rect2(sel[j].x + char_margin + ofs_x, ofs_y, Math::ceil(sel[j].y) - sel[j].x, row_height); if (rect.position.x + rect.size.x <= xmargin_beg || rect.position.x > xmargin_end) { continue; } diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index 33bb5459f2..d78f3ba05b 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -546,6 +546,8 @@ void RenderForwardClustered::_render_list(RenderingDevice::DrawListID p_draw_lis VALID_FLAG_COMBINATION(COLOR_PASS_FLAG_MULTIVIEW); VALID_FLAG_COMBINATION(COLOR_PASS_FLAG_MULTIVIEW | COLOR_PASS_FLAG_MOTION_VECTORS); VALID_FLAG_COMBINATION(COLOR_PASS_FLAG_MOTION_VECTORS); + VALID_FLAG_COMBINATION(COLOR_PASS_FLAG_SEPARATE_SPECULAR | COLOR_PASS_FLAG_MULTIVIEW | COLOR_PASS_FLAG_MOTION_VECTORS); + VALID_FLAG_COMBINATION(COLOR_PASS_FLAG_TRANSPARENT | COLOR_PASS_FLAG_MULTIVIEW | COLOR_PASS_FLAG_MOTION_VECTORS); default: { ERR_FAIL_MSG("Invalid color pass flag combination " + itos(p_params->color_pass_flags)); } |