Operating system or device - Godot version:
Godot 3.0 alpha1
Issue description:
I cannot inherit a inner class in other script files.
The file named ItemListEnhanced.gd with a inner class ListItemProvider as below:
tool
extends ItemList
class ListItemProvider:
func sort(p_item, p_item):
return true
func item_fit_filter(p_item, p_filter):
return true
func get_item_text(p_item):
return str(p_item)
func get_item_color(p_item):
return Color(0, 0, 0, 0)
The editor complains Parser Error: Unknown class 'ListItemProvider' with the script code below
extends 'ItemListEnhanced.gd'
class MyItemProvider extends ListItemProvider:
func get_item_text(p_item):
return p_item.name
May #4472 related?
ListItemProvider exists in the scope of the file ItemListEnhanced.gd, so you'll have to reference it like this:
class MyItemProvider extends 'ItemListEnhanced.gd'.ListItemProvider:
This grammar is really strange.
Just like a string with a member ListItemProvider
@eska014 I think that the problem in this issue is that the script in the question
extends 'ItemListEnhanced.gd', and thus should have inherited the other scripts's scope as well.
Fixed by #12507.
Most helpful comment
@eska014 I think that the problem in this issue is that the script in the question
extends 'ItemListEnhanced.gd', and thus should have inherited the other scripts's scope as well.