From aaad062b416fbcff461d520bc91318b7d2f9b46c Mon Sep 17 00:00:00 2001 From: Yusarina Date: Mon, 16 Dec 2024 12:57:51 +0000 Subject: [PATCH] Finale Fixes --- core/properties.py | 9 +++++++++ core/updater.py | 2 +- functions/tools/bone_tools.py | 7 +++++++ ui/custom_avatar_panel.py | 2 +- ui/eye_tracking_panel.py | 2 +- ui/quick_access_panel.py | 5 ----- ui/settings_panel.py | 2 +- ui/visemes_panel.py | 2 +- 8 files changed, 21 insertions(+), 10 deletions(-) diff --git a/core/properties.py b/core/properties.py index bdf045b..1aa4a28 100644 --- a/core/properties.py +++ b/core/properties.py @@ -93,6 +93,15 @@ class AvatarToolkitSceneProperties(PropertyGroup): default=False ) + connect_bones_min_distance: FloatProperty( + name=t("Tools.connect_bones_min_distance"), + description=t("Tools.connect_bones_min_distance_desc"), + default=0.001, + min=0.0001, + max=0.1, + precision=4 + ) + merge_twist_bones: BoolProperty( name=t("MMD.merge_twist_bones"), description=t("MMD.merge_twist_bones_desc"), diff --git a/core/updater.py b/core/updater.py index ffab4b5..c22a4cc 100644 --- a/core/updater.py +++ b/core/updater.py @@ -76,7 +76,7 @@ class AvatarToolkit_PT_UpdaterPanel(bpy.types.Panel): bl_region_type = 'UI' bl_category = CATEGORY_NAME bl_parent_id = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname - bl_order = 4 + bl_order = 8 bl_options = {'DEFAULT_CLOSED'} def draw(self, context: bpy.types.Context) -> None: diff --git a/functions/tools/bone_tools.py b/functions/tools/bone_tools.py index 2e60524..68e395e 100644 --- a/functions/tools/bone_tools.py +++ b/functions/tools/bone_tools.py @@ -135,6 +135,12 @@ class AvatarToolKit_OT_DeleteBoneConstraints(Operator): def execute(self, context: Context) -> set[str]: """Execute the constraint removal operation""" armature = get_active_armature(context) + + # Select armature and make it active before changing mode + bpy.ops.object.select_all(action='DESELECT') + armature.select_set(True) + context.view_layer.objects.active = armature + bpy.ops.object.mode_set(mode='POSE') constraints_removed = 0 @@ -147,6 +153,7 @@ class AvatarToolKit_OT_DeleteBoneConstraints(Operator): self.report({'INFO'}, t("Tools.clean_constraints_success", count=constraints_removed)) return {'FINISHED'} + class AvatarToolKit_OT_RemoveZeroWeightBones(Operator): """Operator to remove bones with no vertex weights""" bl_idname = "avatar_toolkit.clean_weights" diff --git a/ui/custom_avatar_panel.py b/ui/custom_avatar_panel.py index ed4347c..9c2c378 100644 --- a/ui/custom_avatar_panel.py +++ b/ui/custom_avatar_panel.py @@ -106,7 +106,7 @@ class AvatarToolKit_PT_CustomPanel(Panel): bl_region_type = 'UI' bl_category = CATEGORY_NAME bl_parent_id = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname - bl_order = 3 + bl_order = 4 bl_options = {'DEFAULT_CLOSED'} def draw(self, context: Context) -> None: diff --git a/ui/eye_tracking_panel.py b/ui/eye_tracking_panel.py index 8e2c1c7..ffb59fe 100644 --- a/ui/eye_tracking_panel.py +++ b/ui/eye_tracking_panel.py @@ -26,7 +26,7 @@ class AvatarToolKit_PT_EyeTrackingPanel(Panel): bl_region_type = 'UI' bl_category = CATEGORY_NAME bl_parent_id = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname - bl_order = 3 + bl_order = 6 bl_options = {'DEFAULT_CLOSED'} def draw(self, context: Context) -> None: diff --git a/ui/quick_access_panel.py b/ui/quick_access_panel.py index 0b02111..5bfceae 100644 --- a/ui/quick_access_panel.py +++ b/ui/quick_access_panel.py @@ -75,11 +75,6 @@ class AvatarToolKit_PT_QuickAccessPanel(Panel): bl_parent_id: str = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname bl_order: int = 0 - @classmethod - def poll(cls, context: Context) -> bool: - """Only show panel in Object or Pose mode""" - return context.mode in {'OBJECT', 'POSE'} - def draw(self, context: Context) -> None: """Draw the panel layout""" layout: UILayout = self.layout diff --git a/ui/settings_panel.py b/ui/settings_panel.py index 6650698..ed32263 100644 --- a/ui/settings_panel.py +++ b/ui/settings_panel.py @@ -36,7 +36,7 @@ class AvatarToolKit_PT_SettingsPanel(Panel): bl_region_type: str = 'UI' bl_category: str = CATEGORY_NAME bl_parent_id: str = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname - bl_order: int = 5 + bl_order: int = 7 bl_options = {'DEFAULT_CLOSED'} def draw(self, context: Context) -> None: diff --git a/ui/visemes_panel.py b/ui/visemes_panel.py index 33f4d9f..d79d041 100644 --- a/ui/visemes_panel.py +++ b/ui/visemes_panel.py @@ -10,7 +10,7 @@ class AvatarToolKit_PT_VisemesPanel(Panel): bl_region_type: str = 'UI' bl_category: str = CATEGORY_NAME bl_parent_id: str = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname - bl_order: int = 4 + bl_order: int = 5 bl_options = {'DEFAULT_CLOSED'} def draw(self, context: Context) -> None: