Skip to content

Commit

Permalink
[license] Fix show engine components
Browse files Browse the repository at this point in the history
Just a workaround for now.
  • Loading branch information
IceflowRE committed Dec 11, 2023
1 parent b55cfa7 commit 9df71de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ License class.

### Changelog

#### 1.6.1

- Workaround show engine components, calling static function is bugged

#### 1.6.0

- Require Godot 4.2
Expand Down
2 changes: 2 additions & 0 deletions addons/licenses/internal/toolbar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ func _on_menu_pressed() -> void:
# add liense entry based on engine entry
func _on_engine_add_id_pressed(id: int) -> void:
var component: Component = Licenses.get_engine_component(self._add_engine_menu.get_item_metadata(id))
if component == null:
return
component.readonly = false
self._components_tree.add_component(component)
self._components_tree.select_component(component)
Expand Down
14 changes: 10 additions & 4 deletions addons/licenses/licenses.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
extends RefCounted
# DO NOT USE THE CLASS NAME, it will be removed later
class_name __LicenseManager

const Component := preload("component.gd")

Expand Down Expand Up @@ -45,18 +47,22 @@ static func get_engine_components() -> Array[Component]:
var engine_components: Array[Component] = []

for info: Dictionary in Engine.get_copyright_info():
engine_components.append(get_engine_component(info["name"]))
var eg_comp: Component = get_engine_component(info["name"])
if eg_comp != null:
engine_components.append(eg_comp)

engine_components.sort_custom(compare_components_ascending)
engine_components.sort_custom(__LicenseManager.compare_components_ascending)
return engine_components

static func get_required_engine_components() -> Array[Component]:
var engine_components: Array[Component] = []

for name: String in ["Godot Engine", "ENet", "The FreeType Project", "Mbed TLS"]:
engine_components.append(get_engine_component(name))
var eg_comp: Component = get_engine_component(name)
if eg_comp != null:
engine_components.append(eg_comp)

engine_components.sort_custom(compare_components_ascending)
engine_components.sort_custom(__LicenseManager.compare_components_ascending)
return engine_components

static func save(components: Array[Component], file_path: String) -> int:
Expand Down
2 changes: 1 addition & 1 deletion addons/licenses/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name="License Manager"
description="Manage license and copyright for third party graphics, software or libraries."
author="Iceflower S"
version="1.6.0"
version="1.6.1"
script="plugin.gd"
license="MIT"
repository="https://github.com/kenyoni-software/godot-addons"
Expand Down

0 comments on commit 9df71de

Please sign in to comment.