Ok, I didn’t look into this…
I’m not sure but maybe in animation node addon there is something similar.
I’m pretty sure I’ve seen it but I don’t recall where …
At least, if what you’ve found works maybe it’s not worth to keep investigating .
TypeError: can only concatenate tuple (not "type") to tuple
anyone knows how to add the class to the tuple ?
def addModuleClasses(classes,name,prefix):
for name, obj in inspect.getmembers(sys.modules[name]):
if inspect.isclass(obj) and name.startswith(prefix):
classes=classes+(obj.__class__) <------------------ error
return classes
Another useful reference is the Help > Operator Cheat Sheet built in to Blender:
class WM_OT_operator_cheat_sheet(Operator):
"""List all the operators in a text-block, useful for scripting"""
bl_idname = "wm.operator_cheat_sheet"
bl_label = "Operator Cheat Sheet"
def execute(self, _context):
op_strings = []
tot = 0
for op_module_name in dir(bpy.ops):
op_module = getattr(bpy.ops, op_module_name)
for op_submodule_name in dir(op_module):
op = getattr(op_module, op_submodule_name)
text = repr(op)
if text.split("\n")[-1].startswith("bpy.ops."):
op_strings.append(text)
tot += 1
op_strings.append('')
textblock = bpy.data.texts.new("OperatorList.txt")
textblock.write('# %d Operators\n\n' % tot)
textblock.write('\n'.join(op_strings))
self.report({'INFO'}, "See OperatorList.txt text block")
return {'FINISHED'}
I use this in all my addons and I never have to worry about registering classes. You just have to remember to put a __init__.py file in all your package folders. Even if they’re empty files.
It’s great because it automatically takes care of dependencies when registering. (eg a panel that needs to draw an operator registers before it and it throws an error)
You can put it in __init__.py although I woudn’t recommend it since I think it’s better if it stays relatively lightweight. Or just put it at the root of your package and do
Exception in module register(): C:\Users\user\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\MyAddon\__init__.py
Traceback (most recent call last):
File "P:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\modules\addon_utils.py", line 382, in enable
mod.register()
File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\MyAddon\__init__.py", line 140, in register
auto_load.register()
File "C:\Users\user\AppData\Roaming\Blender Foundation\Blender\2.91\scripts\addons\MyAddon\auto_load.py", line 29, in register
for cls in ordered_classes:
TypeError: 'NoneType' object is not iterable
I have an issue with one of my class that usualy loads
`CollectionProperty(...): expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered)`
...
ValueError: bpy_struct "MyPreferences" registration error: materials could not register
class MaterialListItem(PropertyGroup):
"""Group of properties representing an item in the list."""
unrealMaterialReference: StringProperty(
name="Unreal Material Reference",
description="Unreal Material Reference",
default="Untitled")
blenderMaterialName: StringProperty(
name="Unreal Material Reference",
description="Unreal Material Reference",
default="Untitled")