Fixes and Improvements
- Improved typing in some areas. - Improved code readability in some areas. - Delete bone constraints would error out if the user is in edit mode, we now start in Object mode first. - Fixed Eye tracking Ajust string not being in the translation files. - There is now a selection box to select the mesh in the current active armature for viseme creation instead of the user having to select it in the 3D scene. - Viseme preview mode won't allow you to start it if your in a other mode, you need to be in Object mode now. - Combine Materials won't allow you to start it if your in a other mode, you need to be in Object mode now. - Added Japanese and Korean UI Languages.
This commit is contained in:
+27
-12
@@ -1,6 +1,8 @@
|
||||
from bpy.types import Panel, Context, UILayout
|
||||
import bpy
|
||||
from bpy.types import Panel, Context, UILayout, Object, ShapeKey
|
||||
from ..core.translations import t
|
||||
from .main_panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
||||
from ..core.common import get_active_armature
|
||||
|
||||
class AvatarToolKit_PT_VisemesPanel(Panel):
|
||||
"""Panel containing viseme creation and preview tools"""
|
||||
@@ -11,26 +13,39 @@ class AvatarToolKit_PT_VisemesPanel(Panel):
|
||||
bl_category: str = CATEGORY_NAME
|
||||
bl_parent_id: str = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname
|
||||
bl_order: int = 5
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_options: set[str] = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context: Context) -> None:
|
||||
"""Draw the visemes panel interface"""
|
||||
"""Draw the visemes panel interface with shape key selection and preview controls"""
|
||||
layout: UILayout = self.layout
|
||||
props = context.scene.avatar_toolkit
|
||||
|
||||
# Check for valid mesh with shape keys
|
||||
if not context.active_object or context.active_object.type != 'MESH' or not context.active_object.data.shape_keys:
|
||||
|
||||
# Mesh Selection Box
|
||||
mesh_box: UILayout = layout.box()
|
||||
col: UILayout = mesh_box.column(align=True)
|
||||
col.label(text=t("Visemes.mesh_select"), icon='OUTLINER_OB_MESH')
|
||||
col.separator(factor=0.5)
|
||||
|
||||
armature = get_active_armature(context)
|
||||
if armature:
|
||||
col.prop_search(props, "viseme_mesh", bpy.data, "objects", text="")
|
||||
else:
|
||||
col.label(text=t("Visemes.no_armature"), icon='ERROR')
|
||||
|
||||
# Get selected mesh
|
||||
mesh_obj = bpy.data.objects.get(props.viseme_mesh)
|
||||
if not mesh_obj or not mesh_obj.data.shape_keys:
|
||||
layout.label(text=t("Visemes.no_shapekeys"))
|
||||
return
|
||||
|
||||
# Shape Key Selection Box
|
||||
|
||||
# Shape Key Selection Box
|
||||
shape_box: UILayout = layout.box()
|
||||
col: UILayout = shape_box.column(align=True)
|
||||
col.label(text=t("Visemes.shape_selection"), icon='SHAPEKEY_DATA')
|
||||
col.separator(factor=0.5)
|
||||
|
||||
# Shape key selection with valid data
|
||||
shape_keys = context.active_object.data.shape_keys
|
||||
shape_keys: ShapeKey = mesh_obj.data.shape_keys
|
||||
col.prop_search(props, "mouth_a", shape_keys, "key_blocks", text=t("Visemes.mouth_a"))
|
||||
col.prop_search(props, "mouth_o", shape_keys, "key_blocks", text=t("Visemes.mouth_o"))
|
||||
col.prop_search(props, "mouth_ch", shape_keys, "key_blocks", text=t("Visemes.mouth_ch"))
|
||||
@@ -41,7 +56,7 @@ class AvatarToolKit_PT_VisemesPanel(Panel):
|
||||
|
||||
# Preview Box
|
||||
preview_box: UILayout = layout.box()
|
||||
col = preview_box.column(align=True)
|
||||
col: UILayout = preview_box.column(align=True)
|
||||
col.label(text=t("Visemes.preview_label"), icon='HIDE_OFF')
|
||||
col.separator(factor=0.5)
|
||||
|
||||
@@ -49,12 +64,12 @@ class AvatarToolKit_PT_VisemesPanel(Panel):
|
||||
col.prop(props, "viseme_preview_selection", text="")
|
||||
col.separator()
|
||||
|
||||
preview_text = t("Visemes.stop_preview") if props.viseme_preview_mode else t("Visemes.start_preview")
|
||||
preview_text: str = t("Visemes.stop_preview") if props.viseme_preview_mode else t("Visemes.start_preview")
|
||||
col.operator("avatar_toolkit.preview_visemes", text=preview_text, icon='HIDE_OFF')
|
||||
|
||||
# Create Box
|
||||
create_box: UILayout = layout.box()
|
||||
col = create_box.column(align=True)
|
||||
col: UILayout = create_box.column(align=True)
|
||||
col.label(text=t("Visemes.create_label"), icon='ADD')
|
||||
col.separator(factor=0.5)
|
||||
col.operator("avatar_toolkit.create_visemes", icon='ADD')
|
||||
|
||||
Reference in New Issue
Block a user