diff options
-rw-r--r-- | doc/classes/RichTextLabel.xml | 4 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_ios/export_options.plist | 4 | ||||
-rwxr-xr-x | misc/dist/osx_template.app/Contents/Info.plist | 2 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.cpp | 4 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 8 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 10 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 33 | ||||
-rw-r--r-- | scene/gui/rich_text_label.h | 7 |
9 files changed, 56 insertions, 20 deletions
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index db036d7d88..d4eba77ffa 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -294,6 +294,10 @@ The currently installed custom effects. This is an array of [RichTextEffect]s. To add a custom effect, it's more convenient to use [method install_effect]. </member> + <member name="fit_content_height" type="bool" setter="set_fit_content_height" getter="is_fit_content_height_enabled" default="false"> + If [code]true[/code], the label's height will be automatically updated to fit its content. + [b]Note:[/b] This property is used as a workaround to fix issues with [RichTextLabel] in [Container]s, but it's unreliable in some cases and will be removed in future versions. + </member> <member name="meta_underlined" type="bool" setter="set_meta_underline" getter="is_meta_underlined" default="true"> If [code]true[/code], the label underlines meta tags such as [code][url]{text}[/url][/code]. </member> diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 4b2870b67a..d21e78ccea 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -433,7 +433,7 @@ "$(inherited)", "$(PROJECT_DIR)", ); - PRODUCT_BUNDLE_IDENTIFIER = $identifier; + PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -459,7 +459,7 @@ "$(inherited)", "$(PROJECT_DIR)", ); - PRODUCT_BUNDLE_IDENTIFIER = $identifier; + PRODUCT_BUNDLE_IDENTIFIER = $bundle_identifier; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "$provisioning_profile_uuid_release"; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/misc/dist/ios_xcode/godot_ios/export_options.plist b/misc/dist/ios_xcode/godot_ios/export_options.plist index 3878a4dbe6..71073d9a07 100644 --- a/misc/dist/ios_xcode/godot_ios/export_options.plist +++ b/misc/dist/ios_xcode/godot_ios/export_options.plist @@ -10,11 +10,11 @@ <key>provisioningProfiles</key> <dict> - <key>$identifier</key> + <key>$bundle_identifier</key> <string>$provisioning_profile_uuid</string> </dict> <key>compileBitcode</key> <false/> </dict> -</plist>
\ No newline at end of file +</plist> diff --git a/misc/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist index 3b765e6bb8..aaee42aa5f 100755 --- a/misc/dist/osx_template.app/Contents/Info.plist +++ b/misc/dist/osx_template.app/Contents/Info.plist @@ -13,7 +13,7 @@ <key>CFBundleIconFile</key> <string>icon.icns</string> <key>CFBundleIdentifier</key> - <string>$identifier</string> + <string>$bundle_identifier</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 085062261d..158742846b 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -624,8 +624,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return BOX_BOOLEAN(val); } case Variant::INT: { - int32_t val = p_var->operator signed int(); - return BOX_INT32(val); + int64_t val = p_var->operator int64_t(); + return BOX_INT64(val); } case Variant::FLOAT: { #ifdef REAL_T_IS_DOUBLE diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 63c3cb8c23..aadc60175b 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -217,7 +217,7 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); @@ -293,8 +293,8 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_ strnew += lines[i].replace("$name", p_config.pkg_name) + "\n"; } else if (lines[i].find("$info") != -1) { strnew += lines[i].replace("$info", p_preset->get("application/info")) + "\n"; - } else if (lines[i].find("$identifier") != -1) { - strnew += lines[i].replace("$identifier", p_preset->get("application/identifier")) + "\n"; + } else if (lines[i].find("$bundle_identifier") != -1) { + strnew += lines[i].replace("$bundle_identifier", p_preset->get("application/bundle_identifier")) + "\n"; } else if (lines[i].find("$short_version") != -1) { strnew += lines[i].replace("$short_version", p_preset->get("application/short_version")) + "\n"; } else if (lines[i].find("$version") != -1) { @@ -1346,7 +1346,7 @@ bool EditorExportPlatformIOS::can_export(const Ref<EditorExportPreset> &p_preset valid = false; } - String identifier = p_preset->get("application/identifier"); + String identifier = p_preset->get("application/bundle_identifier"); String pn_err; if (!is_package_name_valid(identifier, &pn_err)) { err += TTR("Invalid Identifier:") + " " + pn_err + "\n"; diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index c9b01ebbb4..8905950020 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -145,7 +145,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/bundle_identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); @@ -354,8 +354,8 @@ void EditorExportPlatformOSX::_fix_plist(const Ref<EditorExportPreset> &p_preset strnew += lines[i].replace("$name", p_binary) + "\n"; } else if (lines[i].find("$info") != -1) { strnew += lines[i].replace("$info", p_preset->get("application/info")) + "\n"; - } else if (lines[i].find("$identifier") != -1) { - strnew += lines[i].replace("$identifier", p_preset->get("application/identifier")) + "\n"; + } else if (lines[i].find("$bundle_identifier") != -1) { + strnew += lines[i].replace("$bundle_identifier", p_preset->get("application/bundle_identifier")) + "\n"; } else if (lines[i].find("$short_version") != -1) { strnew += lines[i].replace("$short_version", p_preset->get("application/short_version")) + "\n"; } else if (lines[i].find("$version") != -1) { @@ -399,7 +399,7 @@ Error EditorExportPlatformOSX::_notarize(const Ref<EditorExportPreset> &p_preset args.push_back("--notarize-app"); args.push_back("--primary-bundle-id"); - args.push_back(p_preset->get("application/identifier")); + args.push_back(p_preset->get("application/bundle_identifier")); args.push_back("--username"); args.push_back(p_preset->get("notarization/apple_id_name")); @@ -885,7 +885,7 @@ bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset valid = dvalid || rvalid; r_missing_templates = !valid; - String identifier = p_preset->get("application/identifier"); + String identifier = p_preset->get("application/bundle_identifier"); String pn_err; if (!is_package_name_valid(identifier, &pn_err)) { err += TTR("Invalid bundle identifier:") + " " + pn_err + "\n"; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 92508f7fd2..5ae27081ea 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1570,6 +1570,10 @@ void RichTextLabel::_validate_line_caches(ItemFrame *p_frame) { } updating_scroll = false; + + if (fit_content_height) { + minimum_size_changed(); + } } void RichTextLabel::_invalidate_current_line(ItemFrame *p_frame) { @@ -1989,6 +1993,17 @@ int RichTextLabel::get_tab_size() const { return tab_size; } +void RichTextLabel::set_fit_content_height(bool p_enabled) { + if (p_enabled != fit_content_height) { + fit_content_height = p_enabled; + minimum_size_changed(); + } +} + +bool RichTextLabel::is_fit_content_height_enabled() const { + return fit_content_height; +} + void RichTextLabel::set_meta_underline(bool p_underline) { underline_meta = p_underline; update(); @@ -2646,7 +2661,7 @@ void RichTextLabel::install_effect(const Variant effect) { } } -int RichTextLabel::get_content_height() { +int RichTextLabel::get_content_height() const { int total_height = 0; if (main->lines.size()) { total_height = main->lines[main->lines.size() - 1].height_accum_cache + get_theme_stylebox("normal")->get_minimum_size().height; @@ -2701,6 +2716,9 @@ void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_tab_size", "spaces"), &RichTextLabel::set_tab_size); ClassDB::bind_method(D_METHOD("get_tab_size"), &RichTextLabel::get_tab_size); + ClassDB::bind_method(D_METHOD("set_fit_content_height", "enabled"), &RichTextLabel::set_fit_content_height); + ClassDB::bind_method(D_METHOD("is_fit_content_height_enabled"), &RichTextLabel::is_fit_content_height_enabled); + ClassDB::bind_method(D_METHOD("set_selection_enabled", "enabled"), &RichTextLabel::set_selection_enabled); ClassDB::bind_method(D_METHOD("is_selection_enabled"), &RichTextLabel::is_selection_enabled); @@ -2743,6 +2761,8 @@ void RichTextLabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "tab_size", PROPERTY_HINT_RANGE, "0,24,1"), "set_tab_size", "get_tab_size"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fit_content_height"), "set_fit_content_height", "is_fit_content_height_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_active"), "set_scroll_active", "is_scroll_active"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scroll_following"), "set_scroll_follow", "is_scroll_following"); @@ -2809,12 +2829,17 @@ void RichTextLabel::set_fixed_size_to_width(int p_width) { } Size2 RichTextLabel::get_minimum_size() const { + Size2 size(0, 0); if (fixed_width != -1) { + size.x = fixed_width; + } + + if (fixed_width != -1 || fit_content_height) { const_cast<RichTextLabel *>(this)->_validate_line_caches(main); - return Size2(fixed_width, const_cast<RichTextLabel *>(this)->get_content_height()); + size.y = get_content_height(); } - return Size2(); + return size; } Ref<RichTextEffect> RichTextLabel::_get_custom_effect_by_code(String p_bbcode_identifier) { @@ -2934,6 +2959,8 @@ RichTextLabel::RichTextLabel() { visible_line_count = 0; fixed_width = -1; + fit_content_height = false; + set_clip_contents(true); } diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 4cec435568..7eeb071cb5 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -403,6 +403,8 @@ private: int fixed_width; + bool fit_content_height; + protected: void _notification(int p_what); @@ -456,13 +458,16 @@ public: void set_tab_size(int p_spaces); int get_tab_size() const; + void set_fit_content_height(bool p_enabled); + bool is_fit_content_height_enabled() const; + bool search(const String &p_string, bool p_from_selection = false, bool p_search_previous = false); void scroll_to_line(int p_line); int get_line_count() const; int get_visible_line_count() const; - int get_content_height(); + int get_content_height() const; VScrollBar *get_v_scroll() { return vscroll; } |