From 6d815e47d676cbdd8e95564be4290247c06a7886 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Fri, 22 Sep 2023 16:30:43 +0200 Subject: [PATCH 1/9] [plugin|qr] Replace float functions with int --- addons/qr_code/plugin.cfg | 2 +- addons/qr_code/qr_code.gd | 6 +++--- addons/qr_code/qr_code_rect.gd | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/qr_code/plugin.cfg b/addons/qr_code/plugin.cfg index 6c92d9e..730ba43 100644 --- a/addons/qr_code/plugin.cfg +++ b/addons/qr_code/plugin.cfg @@ -3,5 +3,5 @@ name="QR Code" description="QR Code generator. - MIT License" author="Iceflower S" -version="0.3.1" +version="0.3.2" script="plugin.gd" diff --git a/addons/qr_code/qr_code.gd b/addons/qr_code/qr_code.gd index c220f4f..dc0c8bf 100644 --- a/addons/qr_code/qr_code.gd +++ b/addons/qr_code/qr_code.gd @@ -904,8 +904,8 @@ func _init(error_correction_: ErrorCorrection = ErrorCorrection.LOW) -> void: ## generate an QR code image func generate_image(module_px_size: int = 1, light_module_color: Color = Color.WHITE, dark_module_color: Color = Color.BLACK, quiet_zone_size: int = 4) -> Image: - module_px_size = max(1, module_px_size) - quiet_zone_size = max(0, quiet_zone_size) + module_px_size = maxi(1, module_px_size) + quiet_zone_size = maxi(0, quiet_zone_size) var qr_code: PackedByteArray = self.encode() @@ -1006,7 +1006,7 @@ func _encode_data() -> BitStream: # add terminator var required_bytes: int = self._get_data_codeword_count() - var terminator_size: int = min(8 * required_bytes - stream.size(), 4) + var terminator_size: int = mini(8 * required_bytes - stream.size(), 4) stream.append(0, terminator_size) # add bits to multiple of 8 diff --git a/addons/qr_code/qr_code_rect.gd b/addons/qr_code/qr_code_rect.gd index 29fc923..b4667c8 100644 --- a/addons/qr_code/qr_code_rect.gd +++ b/addons/qr_code/qr_code_rect.gd @@ -182,7 +182,7 @@ func set_module_px_size(new_module_px_size: int) -> void: self._update_qr() func set_quiet_zone_size(new_quiet_zone_size: int) -> void: - quiet_zone_size = max(0, new_quiet_zone_size) + quiet_zone_size = maxi(0, new_quiet_zone_size) self._update_qr() func _init() -> void: From 420d83ef00a43ebe5572751b350773e6ed063b31 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:23:10 +0200 Subject: [PATCH 2/9] [tbc] Rename get_theme_color --- README.md | 6 ++++++ addons/texture_button_colored/plugin.cfg | 2 +- .../texture_button_colored.gd | 15 ++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6e4103c..a5ad74c 100644 --- a/README.md +++ b/README.md @@ -449,3 +449,9 @@ Let you apply the icon color theme properties for the texture button. Uses `self ### Example [examples/texture_button_colored](./examples/texture_button_colored) + +### Changelog + +#### 1.2.3 + +- Rename method `get_theme_color` to `get_theme_coloring`, this function was never called by the engine anyway and should not be overridden diff --git a/addons/texture_button_colored/plugin.cfg b/addons/texture_button_colored/plugin.cfg index 1aa3b9c..6813021 100644 --- a/addons/texture_button_colored/plugin.cfg +++ b/addons/texture_button_colored/plugin.cfg @@ -3,5 +3,5 @@ name="TextureButtonColored" description="TextureButton with color theme. - MIT License" author="Iceflower S" -version="1.2.2" +version="1.2.3" script="plugin.gd" diff --git a/addons/texture_button_colored/texture_button_colored.gd b/addons/texture_button_colored/texture_button_colored.gd index 0a0c89b..066e940 100644 --- a/addons/texture_button_colored/texture_button_colored.gd +++ b/addons/texture_button_colored/texture_button_colored.gd @@ -21,7 +21,8 @@ var _theme_overrides = CustomThemeOverrides.new([ ["icon_disabled_color", Theme.DATA_TYPE_COLOR] ]) -func get_theme_color(name: StringName, theme_type: StringName = "") -> Color: +## Provides the same functionality as get_theme_color, but will also return TextureButtonColored theme properties +func get_theme_coloring(name: StringName, theme_type: StringName = "") -> Color: if self.has_theme_color(name, theme_type): return super.get_theme_color(name, theme_type) return super.get_theme_color(name, "TextureButtonColored") @@ -50,14 +51,14 @@ func _draw() -> void: func _update_layout() -> void: var draw_mode: int = self.get_draw_mode() if draw_mode == DRAW_HOVER_PRESSED || (self._is_hovered && self.button_pressed): - self.self_modulate = self.get_theme_color("icon_hover_pressed_color") + self.self_modulate = self.get_theme_coloring("icon_hover_pressed_color") elif draw_mode == DRAW_NORMAL: - self.self_modulate = self.get_theme_color("icon_normal_color") + self.self_modulate = self.get_theme_coloring("icon_normal_color") elif draw_mode == DRAW_PRESSED: - self.self_modulate = self.get_theme_color("icon_pressed_color") + self.self_modulate = self.get_theme_coloring("icon_pressed_color") elif draw_mode == DRAW_HOVER: - self.self_modulate = self.get_theme_color("icon_hover_color") + self.self_modulate = self.get_theme_coloring("icon_hover_color") elif draw_mode == DRAW_DISABLED: - self.self_modulate = self.get_theme_color("icon_disabled_color") + self.self_modulate = self.get_theme_coloring("icon_disabled_color") elif self.has_focus(): - self.self_modulate = self.get_theme_color("icon_hover_pressed_color") + self.self_modulate = self.get_theme_coloring("icon_hover_pressed_color") From c26e7396680869c5342aa815470230b02da83958 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:34:16 +0200 Subject: [PATCH 3/9] [icons_patcher] Add return type to methods --- addons/icons_patcher/tool_menu.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/icons_patcher/tool_menu.gd b/addons/icons_patcher/tool_menu.gd index 0a3ea2c..022e9e0 100644 --- a/addons/icons_patcher/tool_menu.gd +++ b/addons/icons_patcher/tool_menu.gd @@ -4,13 +4,13 @@ const Utils := preload("utils.gd") var editor_filesystem: EditorFileSystem -func _ready(): +func _ready() -> void: self.add_item("Patch Material Design Icons") self.id_pressed.connect(self._on_id_pressed) self.about_to_popup.connect(self._on_about_to_popup) -func _set_item_details(idx: int, settings_key: String, tooltip: String): +func _set_item_details(idx: int, settings_key: String, tooltip: String) -> void: var path: String = ProjectSettings.get_setting(settings_key) var can_use: bool = path != "" and DirAccess.dir_exists_absolute(path) self.set_item_disabled(idx, !can_use) From 35e77753ecc7ae07b8ef99e338c8c39c5d1d9b05 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:34:48 +0200 Subject: [PATCH 4/9] [qr] Add return type to method --- addons/qr_code/qr_code_rect.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/qr_code/qr_code_rect.gd b/addons/qr_code/qr_code_rect.gd index b4667c8..a961c5f 100644 --- a/addons/qr_code/qr_code_rect.gd +++ b/addons/qr_code/qr_code_rect.gd @@ -339,7 +339,7 @@ func _property_get_revert(property: StringName) -> Variant: _: return null -func _get_configuration_warnings(): +func _get_configuration_warnings() -> PackedStringArray: if self.auto_module_px_size && self.expand_mode == EXPAND_KEEP_SIZE: return ["Do not use auto module px size AND keep size expand mode."] return [] From 25f91e329a2631e317c36b768b37584f3c027170 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:35:09 +0200 Subject: [PATCH 5/9] [licenses] Rename visible name to License Manager --- addons/licenses/plugin.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/licenses/plugin.cfg b/addons/licenses/plugin.cfg index 8a57b55..dfbff86 100644 --- a/addons/licenses/plugin.cfg +++ b/addons/licenses/plugin.cfg @@ -1,6 +1,6 @@ [plugin] -name="Licenses" +name="License Manager" description="MIT License" author="Iceflower S" version="1.5.0" From e1c9bbce4914c08b7902b83463954f9f03b7abbd Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:35:37 +0200 Subject: [PATCH 6/9] [*] Enable more gdscript warnings --- project.godot | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/project.godot b/project.godot index 3353b1f..71431ee 100644 --- a/project.godot +++ b/project.godot @@ -19,6 +19,14 @@ config/version="1.0.0" GLogging="*res://addons/glogging/glogging.gd" +[debug] + +gdscript/warnings/exclude_addons=false +gdscript/warnings/unsafe_property_access=1 +gdscript/warnings/unsafe_method_access=1 +gdscript/warnings/unsafe_cast=1 +gdscript/warnings/unsafe_call_argument=1 + [editor_plugins] enabled=PackedStringArray("res://addons/aspect_ratio_resize_container/plugin.cfg", "res://addons/custom_theme_overrides/plugin.cfg", "res://addons/git_sha_project_setting/plugin.cfg", "res://addons/glogging/plugin.cfg", "res://addons/hide_private_properties/plugin.cfg", "res://addons/icons_patcher/plugin.cfg", "res://addons/licenses/plugin.cfg", "res://addons/qr_code/plugin.cfg", "res://addons/texture_button_colored/plugin.cfg") From f9d217d120279035d3f030c0a80e68ad14f27d9b Mon Sep 17 00:00:00 2001 From: Iceflower Date: Mon, 25 Sep 2023 20:37:21 +0200 Subject: [PATCH 7/9] [qr] Remove wrong method call --- addons/qr_code/plugin.gd | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/qr_code/plugin.gd b/addons/qr_code/plugin.gd index 80be667..fb0ef76 100644 --- a/addons/qr_code/plugin.gd +++ b/addons/qr_code/plugin.gd @@ -6,4 +6,3 @@ func _enter_tree() -> void: func _exit_tree() -> void: self.remove_custom_type("QRCodeRect") - self.get_editor_interface().get_inspector().property_toggled.disconnect(self._test) From 40810f783e2552676ddd5afc6ce74fef3a02a65c Mon Sep 17 00:00:00 2001 From: Iceflower Date: Tue, 3 Oct 2023 13:00:53 +0200 Subject: [PATCH 8/9] [doc|licenses] Document function --- addons/licenses/internal/utils.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/licenses/internal/utils.gd b/addons/licenses/internal/utils.gd index 4dabfff..1b98507 100644 --- a/addons/licenses/internal/utils.gd +++ b/addons/licenses/internal/utils.gd @@ -1,3 +1,5 @@ +## will return the property list of object +## if an entry is duplicated the last one is replacing the previous one static func get_updated_property_list(object: Object) -> Array: var properties: Array = object.get_property_list() var patched_properties: Array = object._get_property_list() From 5e24cdc42cad580e5099a7334e776d25f9b9fda7 Mon Sep 17 00:00:00 2001 From: Iceflower Date: Tue, 3 Oct 2023 13:16:24 +0200 Subject: [PATCH 9/9] [qr] Rename get_string_from_jis_2004 --- README.md | 11 ++++++----- addons/qr_code/plugin.cfg | 2 +- addons/qr_code/qr_code.gd | 2 +- addons/qr_code/qr_code_rect.gd | 2 +- addons/qr_code/shift_jis.gd | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a5ad74c..d27a7e3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Download [here](https://github.com/kenyoni-software/godot-addons/releases/tag/la Extension of `TextureButton` with color options. - [Logging](#logging) Simple logger. -- [QR Code (beta)](#qr-code) +- [QR Code](#qr-code) QRCodeRect and QR Code generation. ### Tools @@ -300,9 +300,6 @@ If not log level is set, the log level of the parent logger will be used. ## QR Code -> *This addon might change it's interface and available functions. -> Please test and report any issues.* - QR Code generation either with the included `QRCodeRect` node or use the encoding result of the `QRCode` class. ### Compatibility @@ -413,12 +410,16 @@ Shift JIS encoding utility. ### Functions - `static func to_shift_jis_2004_buffer(text: String) -> PackedByteArray` -- `static func get_string_from_jis_2004(arr: PackedByteArray) -> String` +- `static func get_string_from_shift_jis_2004(arr: PackedByteArray) -> String` - `static func to_jis_8_buffer(text: String) -> PackedByteArray` - `static func get_string_from_jis_8(arr: PackedByteArray) -> String` ### Changelog +#### 1.0.0 + +- Renamed `get_string_from_jis_2004` to `get_string_from_shift_jis_2004` + #### 0.3.1 - Improve inspector properties diff --git a/addons/qr_code/plugin.cfg b/addons/qr_code/plugin.cfg index 730ba43..9eb4f3d 100644 --- a/addons/qr_code/plugin.cfg +++ b/addons/qr_code/plugin.cfg @@ -3,5 +3,5 @@ name="QR Code" description="QR Code generator. - MIT License" author="Iceflower S" -version="0.3.2" +version="1.0.0" script="plugin.gd" diff --git a/addons/qr_code/qr_code.gd b/addons/qr_code/qr_code.gd index dc0c8bf..594997b 100644 --- a/addons/qr_code/qr_code.gd +++ b/addons/qr_code/qr_code.gd @@ -950,7 +950,7 @@ func put_kanji(data: String) -> void: if self.mode != Mode.KANJI || data != self._input_data: self._clear_cache() self.mode = Mode.KANJI - self._input_data = ShiftJIS.get_string_from_jis_2004(ShiftJIS.to_shift_jis_2004_buffer(data)) + self._input_data = ShiftJIS.get_string_from_shift_jis_2004(ShiftJIS.to_shift_jis_2004_buffer(data)) ## returns row by row ## to get row size use get_module_count diff --git a/addons/qr_code/qr_code_rect.gd b/addons/qr_code/qr_code_rect.gd index a961c5f..3d1742b 100644 --- a/addons/qr_code/qr_code_rect.gd +++ b/addons/qr_code/qr_code_rect.gd @@ -122,7 +122,7 @@ func get_data() -> Variant: QRCode.ECI.ISO_8859_1: return input_data.get_string_from_ascii() QRCode.ECI.SHIFT_JIS: - return ShiftJIS.get_string_from_jis_2004(input_data) + return ShiftJIS.get_string_from_shift_jis_2004(input_data) QRCode.ECI.UTF_8: return input_data.get_string_from_utf8() QRCode.ECI.UTF_16: diff --git a/addons/qr_code/shift_jis.gd b/addons/qr_code/shift_jis.gd index a6d20d7..cbd1f59 100644 --- a/addons/qr_code/shift_jis.gd +++ b/addons/qr_code/shift_jis.gd @@ -31,7 +31,7 @@ static func to_shift_jis_2004_buffer(text: String) -> PackedByteArray: ## requires an u16 int array, which is Shift JIS encoded ## unknown characters are skipped -static func get_string_from_jis_2004(arr: PackedByteArray) -> String: +static func get_string_from_shift_jis_2004(arr: PackedByteArray) -> String: assert(arr.size() % 2 == 0) var res: String = ""