Auto registration addon help?

is there a small addon to list all the
operators , panel
to build the list for registering an addon ?

happy bl

Do you mean like for instead of entering by class name at the registration sections where instead of calling bpy.utils.register_class(name) for each thing to register, something that can provide the list so you can loop through for all the things the addon defines?

I used to make a mix-in class and use MixInClass.subclasses() to get the list of classes that it had been mixed in with:

class Reg:

class SOME_OT_operator(bpy.types.Operator,Reg):

def register():
    for cls in Reg.__subclasses__():

# likewise for unregister

This method may be cleaner, more pythonic, better, but for some reason I prefer a slightly different way. (I guess that since I use vim I prefer code changes to be line-oriented, and putting something inside the arguments to the class constructor seems more tedious than putting a decorator on the line before.

If you don’t mind the horribly unpythonic and are willing to abuse function argument scope:

def reg(a=None,b=[]):
    if a:
        return a
    return b

class SOME_OT_operator(bpy.types.Operator):

def register():

# likewise for unregister

edit: also there is this:

did not get any warning for new message here !

so you mean that you got to modify all the operators or panels
class to include the Reg parameter

then it will list all the classes as sort of sub class of reg?

anyway meanwhile i made a short script to list all classes and functions in text editor

at least i can copy the operators list to the list of class

and don’t have to find all the classes manually LOL
and no errors just have to copy name and paste it

i got some home made scripts with like 50 classes operators and so many functions
it is very tedious to find all the names and make that list of classes!

i don’t understand why they did not made it as before with a one command line to registers al these !

happy bl

Yes also for some reason i don’t get any notifications. There are two reply buttons so this time I used the other one. maybe it is different

Looking at the descriptions of what bpy.utils.register_classes_factory and …register_modules_factory do, in the manual, a list of classes has to be passed in, so it seems you still have to make the list yourself if you want to avoid manually typing each class. I hoped maybe they did the thing that old blender used to do

But anyway yeah so if you make a decorator function like ‘reg’ you only have to paste it to the line preceding each class you want to register or if you go the other route with a Reg mixin class, you end up with fewer lines but you have to do search and replace to a line. either way is the same list in the end. (calling ‘reg()’ without arguments versus calling ‘Reg.subclasses()’ will return the list you want.

The naive way, or silly way, in maybe some rare cases perhaps ‘a’ right way, is to first ask for a list of all the existing classes, make it as a set, set1, and then define the classes, get the list again, make it set2, now set2 minus set1 is your set you want but like I said that’s a silly way of doing it

happy blending, dude