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:
+8
-11
@@ -1,11 +1,9 @@
|
||||
import bpy
|
||||
from ..core.register import register_wrap
|
||||
from .panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
||||
from .main_panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
||||
from ..functions.viseme import AvatarToolKit_OT_AutoVisemeButton
|
||||
from ..functions.translations import t
|
||||
from ..core.translations import t
|
||||
from ..core.common import get_selected_armature
|
||||
|
||||
@register_wrap
|
||||
class AvatarToolkitVisemePanel(bpy.types.Panel):
|
||||
bl_label = t("VisemePanel.label")
|
||||
bl_idname = "OBJECT_PT_avatar_toolkit_viseme"
|
||||
@@ -24,20 +22,20 @@ class AvatarToolkitVisemePanel(bpy.types.Panel):
|
||||
|
||||
layout.separator(factor=0.5)
|
||||
|
||||
layout.prop(context.scene, "selected_mesh", text=t("VisemePanel.select_mesh"), icon='OUTLINER_OB_MESH')
|
||||
layout.prop(context.scene.avatar_toolkit, "selected_mesh", text=t("VisemePanel.select_mesh"), icon='OUTLINER_OB_MESH')
|
||||
|
||||
mesh = bpy.data.objects.get(context.scene.selected_mesh)
|
||||
mesh = bpy.data.objects.get(context.scene.avatar_toolkit.selected_mesh)
|
||||
if mesh and mesh.type == 'MESH':
|
||||
if mesh.data.shape_keys:
|
||||
box = layout.box()
|
||||
col = box.column(align=True)
|
||||
col.prop_search(context.scene, "avatar_toolkit_mouth_a", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_a.label'), icon='SHAPEKEY_DATA')
|
||||
col.prop_search(context.scene, "avatar_toolkit_mouth_o", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_o.label'), icon='SHAPEKEY_DATA')
|
||||
col.prop_search(context.scene, "avatar_toolkit_mouth_ch", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_ch.label'), icon='SHAPEKEY_DATA')
|
||||
col.prop_search(context.scene.avatar_toolkit, "mouth_a", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_a.label'), icon='SHAPEKEY_DATA')
|
||||
col.prop_search(context.scene.avatar_toolkit, "mouth_o", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_o.label'), icon='SHAPEKEY_DATA')
|
||||
col.prop_search(context.scene.avatar_toolkit, "mouth_ch", mesh.data.shape_keys, "key_blocks", text=t('VisemePanel.mouth_ch.label'), icon='SHAPEKEY_DATA')
|
||||
|
||||
layout.separator(factor=0.5)
|
||||
|
||||
layout.prop(context.scene, 'avatar_toolkit_shape_intensity', text=t('VisemePanel.shape_intensity'), icon='FORCE_LENNARDJONES')
|
||||
layout.prop(context.scene.avatar_toolkit, 'shape_intensity', text=t('VisemePanel.shape_intensity'), icon='FORCE_LENNARDJONES')
|
||||
|
||||
layout.separator(factor=1.0)
|
||||
|
||||
@@ -53,4 +51,3 @@ class AvatarToolkitVisemePanel(bpy.types.Panel):
|
||||
|
||||
layout.separator(factor=1.0)
|
||||
layout.label(text=t('VisemePanel.info.selectMesh'), icon='HELP')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user