Registering classes in 2.80

I would like to start developing in the new beta build environment. For that, I want to register classes the new way: https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons

However, I get the following error:

TypeError: 'type' object is not iterable

Also, when trying "help(bpy.utils.register_class_factory())" in the inteactive python console, I get:

AttributeError: module 'bpy.utils' has no attribute 'register_class_factory'

Some simplified code I am "working" on right now:

import bpy

class MakeProxy(bpy.types.Operator):
bl_idname = "OBJECT_OT_object_make_proxy"
bl_label = "mProxy"

"more code"

classes = (
MakeProxy
)

register, unregister = bpy.utils.register_classes_factory(classes)


What am I missing? Thank you!

import bpy

class OBJECT_OT_object_make_proxy(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.make_proxy"
bl_label = "Make Proxy"

@classmethod
def poll(cls, context):
return context.active_object is not None

def execute(self, context):
pass # More code here
return {'FINISHED'}

classes = (
OBJECT_OT_object_make_proxy,

)

register, unregister = bpy.utils.register_classes_factory(classes)

if __name__ == "__main__":
register()


This works.

I do not understand what they mean to say about the new naming conventions here. Browsing the web it seems I am not the only one.

It says:

This constraint applies to the bl_idname of each class (or the class name which uses it if no bl_idname is defined in the class).

These are: UPPER_CASE_{SEPARATOR}_mixed_case, in the case of a menu the regular expression is:

[A-Z][A-Z0-9_]*MT[A-Za-z0-9_]+

The separator for each class is listed below:

Operator -> OT
Panel -> PT
UIList -> UL

Valid Examples:

OBJECT_OT_fancy_tool
So this might mean that the bl_idname should actually be something like "object.MY_ADDON_OT_some_object_operator" It still requires a '.' to be there so object.OBJECT_OT_something_something does not seem to make much sense to me. Let's make this a new question as well, maybe someone else knows.
• The way I understand it, what was wrong in your script were two things: bl_idname requires a '.' character to be in it, and the arguement for bpy.utils.register_classes_factory() needs to be iterable, so you need a comma after the value you assign to it or to make it a list first you could do classes = list() followed by classes.append(some_single_class) if you wanted a list with a single element. If you search for what you have in bl_label while poll() returns true, you should find the operator with the search. – Martynas Žiemys Dec 2 '18 at 15:22