Skip to content

Commit

Permalink
[merge] Update from staging
Browse files Browse the repository at this point in the history
  • Loading branch information
IceflowRE committed Oct 4, 2023
2 parents e8e9d41 + 5e24cdc commit aa94f5f
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 26 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -449,3 +450,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
4 changes: 2 additions & 2 deletions addons/icons_patcher/tool_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions addons/licenses/internal/utils.gd
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion addons/licenses/plugin.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[plugin]

name="Licenses"
name="License Manager"
description="MIT License"
author="Iceflower S"
version="1.5.0"
Expand Down
2 changes: 1 addition & 1 deletion addons/qr_code/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="QR Code"
description="QR Code generator. - MIT License"
author="Iceflower S"
version="0.3.1"
version="1.0.0"
script="plugin.gd"
1 change: 0 additions & 1 deletion addons/qr_code/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions addons/qr_code/qr_code.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions addons/qr_code/qr_code_rect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 []
Expand Down
2 changes: 1 addition & 1 deletion addons/qr_code/shift_jis.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""

Expand Down
2 changes: 1 addition & 1 deletion addons/texture_button_colored/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 8 additions & 7 deletions addons/texture_button_colored/texture_button_colored.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
8 changes: 8 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit aa94f5f

Please sign in to comment.