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:
Header -> HT
Menu -> MT
Operator -> OT
Panel -> PT
UIList -> UL
Valid Examples:
OBJECT_OT_fancy_tool
SOME_HEADER_HT_my_header
PANEL123_PT_myPanel (lower case is preferred but mixed case is supported).
At the time of writing this, names that don't conform to this
convention will produce a warning on startup. Eventually we will make
this into an error, eg:
Warning: 'Oscurart Files Tools' doesn't contain 'PT' with prefix &
suffix Warning: 'Oscurart Overrides' doesn't contain 'PT' with
prefix & suffix Warning: 'Oscurart Animation Tools' doesn't contain
'PT' with prefix & suffix
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.