c65bed3ff4
- Added Highlight Bone System in the 3D View, can be turned off in settings. - Added more bones to the acceptable bone lists. - Fixed issue with properties registrations and unregistration, the system is more rebust now. - Added a validate t-pose system - Added a detect bone scales system. - Fixed some translation strings - Armature validation now uses logger system.
91 lines
3.3 KiB
Python
91 lines
3.3 KiB
Python
import bpy
|
|
from typing import Set, Dict, List, Optional
|
|
from bpy.types import (
|
|
Operator,
|
|
Panel,
|
|
Context,
|
|
UILayout,
|
|
WindowManager,
|
|
Event
|
|
)
|
|
from .main_panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
|
from ..core.translations import t, get_languages_list
|
|
|
|
class AvatarToolkit_OT_TranslationRestartPopup(Operator):
|
|
"""Popup dialog shown after language change to inform about restart requirement"""
|
|
bl_idname: str = "avatar_toolkit.translation_restart_popup"
|
|
bl_label: str = t("Language.changed.title")
|
|
|
|
def execute(self, context: Context) -> Set[str]:
|
|
return {'FINISHED'}
|
|
|
|
def invoke(self, context: Context, event: Event) -> Set[str]:
|
|
wm: WindowManager = context.window_manager
|
|
return wm.invoke_props_dialog(self)
|
|
|
|
def draw(self, context: Context) -> None:
|
|
layout: UILayout = self.layout
|
|
layout.label(text=t("Language.changed.success"))
|
|
layout.label(text=t("Language.changed.restart"))
|
|
|
|
class AvatarToolKit_PT_SettingsPanel(Panel):
|
|
"""Settings panel for Avatar Toolkit containing language preferences"""
|
|
bl_label: str = t("Settings.label")
|
|
bl_idname: str = "OBJECT_PT_avatar_toolkit_settings"
|
|
bl_space_type: str = 'VIEW_3D'
|
|
bl_region_type: str = 'UI'
|
|
bl_category: str = CATEGORY_NAME
|
|
bl_parent_id: str = AvatarToolKit_PT_AvatarToolkitPanel.bl_idname
|
|
bl_order: int = 7
|
|
bl_options = {'DEFAULT_CLOSED'}
|
|
|
|
def draw(self, context: Context) -> None:
|
|
"""Draw the settings panel layout with language selection"""
|
|
layout: UILayout = self.layout
|
|
props = context.scene.avatar_toolkit
|
|
|
|
# Language Settings
|
|
lang_box: UILayout = layout.box()
|
|
col: UILayout = lang_box.column(align=True)
|
|
row: UILayout = col.row()
|
|
row.scale_y = 1.2
|
|
row.label(text=t("Settings.language"), icon='WORLD')
|
|
col.separator()
|
|
col.prop(props, "language", text="")
|
|
|
|
# Validation Settings
|
|
val_box: UILayout = layout.box()
|
|
col = val_box.column(align=True)
|
|
row = col.row()
|
|
row.scale_y = 1.2
|
|
row.label(text=t("Settings.validation_mode"), icon='CHECKMARK')
|
|
col.separator()
|
|
col.prop(props, "validation_mode", text="")
|
|
|
|
# Bone Highlighting Settings
|
|
bone_box: UILayout = layout.box()
|
|
col = bone_box.column(align=True)
|
|
row = col.row()
|
|
row.scale_y = 1.2
|
|
row.label(text=t("Settings.bone_highlighting"), icon='BONE_DATA')
|
|
col.separator()
|
|
col.prop(props, "highlight_problem_bones")
|
|
if props.highlight_problem_bones:
|
|
col.operator("avatar_toolkit.highlight_problem_bones", icon='COLOR')
|
|
else:
|
|
col.operator("avatar_toolkit.clear_bone_highlighting", icon='X')
|
|
|
|
# Debug Settings
|
|
debug_box = layout.box()
|
|
col = debug_box.column()
|
|
row = col.row(align=True)
|
|
row.prop(props, "debug_expand",
|
|
icon="TRIA_DOWN" if props.debug_expand
|
|
else "TRIA_RIGHT",
|
|
icon_only=True, emboss=False)
|
|
row.label(text=t("Settings.debug"), icon='CONSOLE')
|
|
|
|
if props.debug_expand:
|
|
col = debug_box.column(align=True)
|
|
col.prop(props, "enable_logging")
|