Skip to content

Commit

Permalink
Merge pull request #4 from Jeremi360:godot-4
Browse files Browse the repository at this point in the history
Last fixes for 1.0
  • Loading branch information
Jeremi360 authored Dec 17, 2024
2 parents 01873b0 + 9d3af92 commit dae03ff
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ extends RichTextLabel
@export_multiline
var text_with_icons: String:
set(value):
if !is_node_ready(): await ready
text_with_icons = value
bbcode_enabled = true
text = IconsFonts.parse_text(value)
Expand All @@ -113,11 +114,9 @@ you need add `*.json` files to include files settings:
![](.assets/export.png)

## Know Issues
- Window mode is init with empty icons render*

- Window mode is init with empty icons render
- Sometimes click on icon doesn't copy it to clipboard

To fix both of them just change back-and-forward to icon font you want to use
\**To fix just change back-and-forward to icon font you want to use.*

## Compatibility
This addon is replacing our previous to addons:
Expand Down
1 change: 1 addition & 0 deletions addons/icons-fonts/examples/rich_text_label_with_icons.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extends RichTextLabel
@export_multiline
var text_with_icons: String:
set(value):
if !is_node_ready(): await ready
text_with_icons = value
bbcode_enabled = true
text = IconsFonts.parse_text(value)
Expand Down
6 changes: 3 additions & 3 deletions addons/icons-fonts/examples/test_icons_fonts.tscn
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[gd_scene load_steps=23 format=3 uid="uid://casymgu2sqx81"]

[ext_resource type="FontFile" uid="uid://bbfeoo2kuf30n" path="res://addons/icons-fonts/icons_fonts/MaterialIcons/material_design_icons.ttf" id="1_7oe6v"]
[ext_resource type="FontFile" uid="uid://be10y8fgoiayy" path="res://addons/icons-fonts/icons_fonts/emojis/NotoColorEmoji.ttf" id="1_lglyu"]
[ext_resource type="Script" path="res://addons/icons-fonts/nodes/FontIcon.gd" id="2_fd237"]
[ext_resource type="Script" path="res://addons/icons-fonts/resources/FontIconSetting.gd" id="3_jajcj"]
[ext_resource type="Script" path="res://addons/icons-fonts/nodes/FontIconButton.gd" id="4_5ca3b"]
[ext_resource type="Script" path="res://addons/icons-fonts/nodes/FontIconCheckButton.gd" id="5_qfxwr"]
[ext_resource type="Script" path="res://addons/icons-fonts/examples/rich_text_label_with_icons.gd" id="6_3361y"]

[sub_resource type="LabelSettings" id="LabelSettings_fw4y0"]
font = ExtResource("1_7oe6v")
font_size = 128
font = ExtResource("1_lglyu")
font_size = 64
shadow_size = 0
shadow_color = Color(1, 1, 1, 1)
shadow_offset = Vector2(0, 0)
Expand Down
9 changes: 2 additions & 7 deletions addons/icons-fonts/icon_finder/icon_finder.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ func _ready():

for renderer: IconsFontsRender in icons_renderers:
renderer.tooltip_text = tooltip

func setup():
for renderer: IconsFontsRender in icons_renderers:
if !renderer.is_node_ready(): await ready
renderer.setup()
renderer.meta_clicked.connect(_on_meta)
icons_renderer = icons_renderers[0]

func update_icons_size(value: int):
Expand All @@ -52,15 +53,9 @@ func update_icons_size(value: int):
IconsFonts.preview_size = value

func on_font_changed(font_id: int):
if icons_renderer:
if icons_renderer.meta_clicked.is_connected(_on_meta):
icons_renderer.meta_clicked.disconnect(_on_meta)

icons_renderers_tabs.current_tab = font_id
icons_renderer = icons_renderers[font_id]

icons_renderer.meta_clicked.connect(_on_meta)

func update_table(filter := ""):
if not icons_renderer: return
icons_renderer.update_table(filter)
Expand Down
2 changes: 1 addition & 1 deletion addons/icons-fonts/icons_fonts.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var icon_finder_window_loaded:PackedScene
func _enter_tree():
add_autoload_singleton("IconsFonts", icons_db)
await IconsFonts.ready

icon_finder_loaded = load(icon_finder_scene)
icon_finder_window_loaded = load(icon_finder_window_scene)

Expand All @@ -54,7 +55,6 @@ func _enter_tree():
inspector_plugin = preload(inspector_plugin_path).new()
add_inspector_plugin(inspector_plugin)


func help():
# todo update when docs are ready!
# OS.shell_open("https://rakugoteam.github.io/material-icons-docs/")
Expand Down
2 changes: 0 additions & 2 deletions addons/icons-fonts/nodes/FontIcon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@icon("res://addons/icons-fonts/nodes/FontIcon.svg")

# todo add description and docs links when ready
## Don't change LabelSettings value in this node!
class_name FontIcon
extends Label

Expand All @@ -15,7 +14,6 @@ extends Label
icon_settings.emit_changed()

func _ready():
clip_text = false
_on_icon_settings_changed()

func _on_icon_settings_changed():
Expand Down
2 changes: 2 additions & 0 deletions addons/icons-fonts/nodes/FontIconButton.gd
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func _clear_box():

func _set_order(order:String):
_clear_box()
await get_tree().create_timer(0.2).timeout
_apply_layout(_crate_layout(order))

func _crate_layout(order:String) -> Array[Control]:
Expand All @@ -97,6 +98,7 @@ func _crate_layout(order:String) -> Array[Control]:

func _apply_layout(layout: Array[Control]):
for control: Control in layout:
if control.get_parent() == _box: continue
_box.add_child(control)
if control is FontIcon:
control.size_flags_horizontal\
Expand Down

0 comments on commit dae03ff

Please sign in to comment.