Skip to content

Commit 29bef8c

Browse files
committed
category_factory: Fix static Callable use in Godot 4.2.1
In Godot 4.2.1, a static function used as a Callable from a static function fails to be resolved. This causes the following error in our case: ``` res://addons/block_code/ui/picker/categories/category_factory.gd:109 - Invalid get index '_category_cmp' (on base: 'Nil') ``` See godotengine/godot#86032 for details. This can be worked around by using the fully qualified class method name. Fixes: #94
1 parent ef620ce commit 29bef8c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

addons/block_code/ui/picker/categories/category_factory.gd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ static func get_categories(blocks: Array[Block], extra_categories: Array[BlockCa
150150
# convert an array type besides Array.assign().
151151
var cats: Array[BlockCategory] = []
152152
cats.assign(cat_map.values())
153-
cats.sort_custom(_category_cmp)
153+
# Accessing a static Callable from a static function fails in 4.2.1.
154+
# Use the fully qualified name.
155+
# https://github.com/godotengine/godot/issues/86032
156+
cats.sort_custom(CategoryFactory._category_cmp)
154157
return cats
155158

156159

0 commit comments

Comments
 (0)