Plugin Registration Changes
- Re-wrote how the plugin registers itself. - No longer need @register_wrapper classes get auto detected and added. - The new Auto loader is much better then the old way, no longer need "if "bpy" not in locals():" this was an old way of doing things and wasn't really efficient. using auto_load.py provides several advantages: - It automatically discovers and loads all modules in the addon. - It handles dependencies between classes correctly through topological sorting. - It manages registration order automatically. - It properly handles unregistration in the correct order. This approach is much less error prone and I not had any issues so far. However it still needs testing fully. I have also start to re-organise files into folders as well, this is going to be needed so we don't have a long list of files as Avatar Toolkit is getting larger then i originally planned.
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
import bpy
|
||||
from bpy.types import Operator
|
||||
from bpy_extras.io_utils import ImportHelper
|
||||
from ..core.register import register_wrap
|
||||
from ..core.importer import imports, import_types
|
||||
from ..core.importers.importer import imports, import_types
|
||||
from ..core.common import remove_default_objects
|
||||
from ..functions.translations import t
|
||||
from ..core.translations import t
|
||||
import pathlib
|
||||
import os
|
||||
|
||||
VRM_IMPORTER_URL = "https://github.com/saturday06/VRM_Addon_for_Blender"
|
||||
|
||||
@register_wrap
|
||||
|
||||
class AvatarToolKit_OT_ImportAnyModel(Operator, ImportHelper):
|
||||
bl_idname = 'avatar_toolkit.import_any_model'
|
||||
bl_label = t('Tools.import_any_model.label')
|
||||
@@ -67,7 +66,7 @@ class AvatarToolKit_OT_ImportAnyModel(Operator, ImportHelper):
|
||||
self.report({'INFO'}, t('Quick_Access.import_success'))
|
||||
return {'FINISHED'}
|
||||
|
||||
@register_wrap
|
||||
|
||||
class VRMImporterPopup(Operator):
|
||||
bl_idname = "wm.vrm_importer_popup"
|
||||
bl_label = "VRM Importer Not Installed"
|
||||
@@ -87,7 +86,7 @@ class VRMImporterPopup(Operator):
|
||||
#TODO: This needs to be done with our own MMD importer.
|
||||
"""
|
||||
#stolen from cats. Oh wait I made this code riiiiiiight - @989onan
|
||||
@register_wrap
|
||||
|
||||
class ImportMMDAnimation(bpy.types.Operator, ImportHelper):
|
||||
bl_idname = 'avatar_toolkit.import_mmd_animation'
|
||||
bl_label = t('Importer.mmd_anim_importer.label')
|
||||
|
||||
Reference in New Issue
Block a user