Batch registering multiple classes in blender 2.8

It turns out the error was unrelated, it happened even with addons not using autoload. It randomly started working again so no idea what happened in 2.81. Error message (again not related to this) was Module not found.

Does auto registration work in blender 2.81?

Reviving this topic from dead -Just wanted to share version where Panels can be sorted using bl_order property (it is ignored by default autoload.py):

def toposort(deps_dict):
    sorted_list = []
    sorted_values = set()
    while len(deps_dict) > 0:
        unsorted = []
        sorted_list_sub = []      # helper for additional sorting by bl_order - in panels
        for value, deps in deps_dict.items():
            if len(deps) == 0:
                sorted_list_sub.append(value)
                sorted_values.add(value)
            else:
                unsorted.append(value)
        deps_dict = {value: deps_dict[value] - sorted_values for value in unsorted}
        sort_by_panel_order = sorted(sorted_list_sub, key=lambda cls: getattr(cls, 'bl_order',0))
        sorted_list.extend(sort_by_panel_order)
    return sorted_list

I hope people will find this usefull. To use - just override old toposort() function.

3 Likes

Hello everybody, I like this autoload approach, but can I set some addon preferences in each single module and then see all them together??
(So that if I share a single module it’ll just work out of the box, but when I add in the autoload-powered addon folder it will add its preferences to the others)

In other words: I’d like to have many single file add-ons, with their own Prefs (for easy sharing purpose), and then group all them into an autoload-powered add-on with all the preferences listed

Bumping my own request for @jacqueslucke attention :blush:

1 Like