Armature Validation P2
- 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.
This commit is contained in:
@@ -84,7 +84,7 @@ class AvatarToolKit_PT_QuickAccessPanel(Panel):
|
||||
# Armature Validation
|
||||
active_armature: Optional[Object] = get_active_armature(context)
|
||||
if active_armature:
|
||||
is_valid, messages, is_acceptable = validate_armature(active_armature)
|
||||
is_valid, messages, is_acceptable, hierarchy_messages, scale_messages, non_standard_messages = validate_armature(active_armature, detailed_messages=True)
|
||||
|
||||
info_box = col.box()
|
||||
|
||||
@@ -121,23 +121,70 @@ class AvatarToolKit_PT_QuickAccessPanel(Panel):
|
||||
validation_box = info_box.box()
|
||||
row = validation_box.row()
|
||||
row.alert = True
|
||||
row.prop(props, "show_non_standard", text=t("Validation.section.non_standard"), icon='TRIA_DOWN' if props.show_non_standard else 'TRIA_RIGHT', emboss=False)
|
||||
row.prop(props, "show_non_standard", text=t("Validation.section.non_standard"),
|
||||
icon='TRIA_DOWN' if props.show_non_standard else 'TRIA_RIGHT', emboss=False)
|
||||
if props.show_non_standard:
|
||||
for line in messages[1].split('\n'):
|
||||
if non_standard_messages:
|
||||
for message in non_standard_messages:
|
||||
for line in message.split('\n'):
|
||||
sub_row = validation_box.row()
|
||||
sub_row.alert = True
|
||||
sub_row.label(text=line)
|
||||
else:
|
||||
sub_row = validation_box.row()
|
||||
sub_row.alert = True
|
||||
sub_row.label(text=line)
|
||||
sub_row.label(text=t("Validation.no_non_standard_issues"))
|
||||
|
||||
# Hierarchy Issues section
|
||||
validation_box = info_box.box()
|
||||
row = validation_box.row()
|
||||
row.alert = True
|
||||
row.prop(props, "show_hierarchy", text=t("Validation.section.hierarchy"), icon='TRIA_DOWN' if props.show_hierarchy else 'TRIA_RIGHT', emboss=False)
|
||||
row.prop(props, "show_hierarchy", text=t("Validation.section.hierarchy"),
|
||||
icon='TRIA_DOWN' if props.show_hierarchy else 'TRIA_RIGHT', emboss=False)
|
||||
if props.show_hierarchy:
|
||||
for message in messages[2:]:
|
||||
if hierarchy_messages:
|
||||
for message in hierarchy_messages:
|
||||
sub_row = validation_box.row()
|
||||
sub_row.alert = True
|
||||
sub_row.label(text=message)
|
||||
else:
|
||||
sub_row = validation_box.row()
|
||||
sub_row.alert = True
|
||||
sub_row.label(text=message)
|
||||
sub_row.label(text=t("Validation.no_hierarchy_issues"))
|
||||
|
||||
# Scale Issues section
|
||||
validation_box = info_box.box()
|
||||
row = validation_box.row()
|
||||
row.alert = True
|
||||
row.prop(props, "show_scale_issues", text=t("Validation.section.scale_issues"),
|
||||
icon='TRIA_DOWN' if props.show_scale_issues else 'TRIA_RIGHT', emboss=False)
|
||||
if props.show_scale_issues:
|
||||
if scale_messages:
|
||||
for scale_msg in scale_messages:
|
||||
sub_row = validation_box.row()
|
||||
sub_row.alert = True
|
||||
sub_row.label(text=scale_msg)
|
||||
else:
|
||||
sub_row = validation_box.row()
|
||||
sub_row.label(text=t("Validation.no_scale_issues"))
|
||||
|
||||
pose_box = layout.box()
|
||||
col = pose_box.column(align=True)
|
||||
col.label(text=t("Validation.tpose.label"), icon='ARMATURE_DATA')
|
||||
col.separator(factor=0.5)
|
||||
col.operator("avatar_toolkit.validate_tpose", icon='CHECKMARK')
|
||||
|
||||
if props.show_tpose_validation:
|
||||
validation_box = col.box()
|
||||
if props.tpose_validation_result:
|
||||
validation_box.label(text=t("Validation.tpose.valid"), icon='CHECKMARK')
|
||||
else:
|
||||
row = validation_box.row()
|
||||
row.alert = True
|
||||
row.label(text=t("Validation.tpose.warning"), icon='ERROR')
|
||||
|
||||
for msg in props.tpose_validation_messages:
|
||||
row = validation_box.row()
|
||||
row.alert = True
|
||||
row.label(text=msg.name)
|
||||
else:
|
||||
# If no specific issues, show acceptable message
|
||||
info_box.label(text=messages[0], icon='INFO')
|
||||
|
||||
+20
-6
@@ -42,6 +42,7 @@ class AvatarToolKit_PT_SettingsPanel(Panel):
|
||||
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()
|
||||
@@ -50,7 +51,7 @@ class AvatarToolKit_PT_SettingsPanel(Panel):
|
||||
row.scale_y = 1.2
|
||||
row.label(text=t("Settings.language"), icon='WORLD')
|
||||
col.separator()
|
||||
col.prop(context.scene.avatar_toolkit, "language", text="")
|
||||
col.prop(props, "language", text="")
|
||||
|
||||
# Validation Settings
|
||||
val_box: UILayout = layout.box()
|
||||
@@ -59,18 +60,31 @@ class AvatarToolKit_PT_SettingsPanel(Panel):
|
||||
row.scale_y = 1.2
|
||||
row.label(text=t("Settings.validation_mode"), icon='CHECKMARK')
|
||||
col.separator()
|
||||
col.prop(context.scene.avatar_toolkit, "validation_mode", text="")
|
||||
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(context.scene.avatar_toolkit, "debug_expand",
|
||||
icon="TRIA_DOWN" if context.scene.avatar_toolkit.debug_expand
|
||||
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 context.scene.avatar_toolkit.debug_expand:
|
||||
if props.debug_expand:
|
||||
col = debug_box.column(align=True)
|
||||
col.prop(context.scene.avatar_toolkit, "enable_logging")
|
||||
col.prop(props, "enable_logging")
|
||||
|
||||
Reference in New Issue
Block a user