Getting all variants of a base gdscript class/resource

Godot Version

Godot 4.3

Question

Hi, I’m trying to get all resource variants that inherit from a specific resource for use in a GDscript plugin. So far I’ve come up with two solutions:

  1. use ProjectSettings.get_global_class_list()
  2. use an EditorResourcePicker

However they both feel clunky, as get_global_class_list() requires manually checking through deeper inheritance, and EditorResourcePicker is a specific layout that doesn’t really fit my use case, as I’d ideally like to construct my own ResourcePicker that is laid out in a different way.

What id really like is something akin to ClassDB.get_inheriters_from_class(), however it doesn’t seem to include classes defined in GDscript.

I’m wondering if the ways I’ve discovered are the only options, or if I’m missing something here.

Don’t have a solution, but there’s also EditorFileSystemDirectory. get_file_script_class_extends().

1 Like