From dac25e0dc090a89b5821cf0a2b96145bb962c8d9 Mon Sep 17 00:00:00 2001 From: Yusarina Date: Sun, 23 Mar 2025 13:38:18 +0000 Subject: [PATCH] Bug Fixes - Fixes issue where some tools would not be displayed, fixes: #120 - Fixes issue with the resonite utils throwing errors. - Fixes issue with visemes panel throwing errors. - Fixes issue where the viseme mesh selector was showing all objects (Armature and etc) it now just shows meshes. --- core/properties.py | 15 ++++++++++++++- core/resonite_utils.py | 2 +- ui/visemes_panel.py | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/properties.py b/core/properties.py index 38a42a9..1119758 100644 --- a/core/properties.py +++ b/core/properties.py @@ -42,6 +42,12 @@ def update_shape_intensity(self: PropertyGroup, context: Context) -> None: if self.viseme_preview_mode: VisemePreview.update_preview(context) +def get_mesh_objects(self, context): + meshes = [(obj.name, obj.name, "") for obj in bpy.data.objects if obj.type == 'MESH'] + if not meshes: + return [('NONE', t("Visemes.no_meshes"), '')] + return meshes + class AvatarToolkitSceneProperties(PropertyGroup): """Property group containing Avatar Toolkit scene-level settings and properties""" @@ -128,6 +134,12 @@ class AvatarToolkitSceneProperties(PropertyGroup): items=get_texture_node_list ) + list_only_mode: BoolProperty( + name=t("Tools.list_only_mode"), + description=t("Tools.list_only_mode_desc"), + default=False + ) + Material.include_in_atlas = BoolProperty( name=t("TextureAtlas.include_in_atlas"), description=t("TextureAtlas.include_in_atlas_desc"), @@ -269,9 +281,10 @@ class AvatarToolkitSceneProperties(PropertyGroup): description=t("Visemes.mouth_ch_desc") ) - viseme_mesh: StringProperty( + viseme_mesh: EnumProperty( name=t("Visemes.mesh_select"), description=t("Visemes.mesh_select_desc"), + items=get_mesh_objects ) shape_intensity: FloatProperty( diff --git a/core/resonite_utils.py b/core/resonite_utils.py index e9e530e..998e7ff 100644 --- a/core/resonite_utils.py +++ b/core/resonite_utils.py @@ -51,7 +51,7 @@ class AvatarToolkit_OT_ConvertResonite(Operator): armature = get_active_armature(context) if not armature: return False - is_valid, _ = validate_armature(armature) + is_valid, _, _ = validate_armature(armature) return is_valid def execute(self, context: Context) -> Set[str]: diff --git a/ui/visemes_panel.py b/ui/visemes_panel.py index 5de266f..0ebb472 100644 --- a/ui/visemes_panel.py +++ b/ui/visemes_panel.py @@ -28,13 +28,13 @@ class AvatarToolKit_PT_VisemesPanel(Panel): armature = get_active_armature(context) if armature: - col.prop_search(props, "viseme_mesh", bpy.data, "objects", text="") + col.prop(props, "viseme_mesh", 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: + if not mesh_obj or not mesh_obj.data or not mesh_obj.data.shape_keys: layout.label(text=t("Visemes.no_shapekeys")) return