Skip to content

Commit

Permalink
chore: tweak shape key validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Jul 15, 2024
1 parent 388c689 commit d885a19
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 32 deletions.
51 changes: 31 additions & 20 deletions src/io_scene_vrm/editor/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,37 +782,48 @@ def detect_errors(
).vrm0.blend_shape_master
for blend_shape_group in blend_shape_master.blend_shape_groups:
for bind in blend_shape_group.binds:
mesh_object = context.blend_data.objects.get(
bind.mesh.mesh_object_name
)
if not mesh_object:
continue
mesh_data = mesh_object.data
if not isinstance(mesh_data, Mesh):
mesh_object_name = bind.mesh.mesh_object_name
if not bind.index or not mesh_object_name:
continue
shape_keys = mesh_data.shape_keys
if not shape_keys:
mesh_object = next(
iter(
obj
for obj in export_objects
if obj.name == mesh_object_name
),
None,
)
if (
not mesh_object
and mesh_object_name in context.blend_data.objects
):
info_messages.append(
pgettext(
'mesh "{mesh_name}" doesn\'t have shape key. '
+ 'But blend shape group needs "{shape_key_name}"'
+ " in its shape key."
'A mesh named "{mesh_name}" is assigned to a blend'
+ ' shape group named "{blend_shape_group_name}" but'
+ " the mesh will not be exported"
).format(
mesh_name=bind.mesh.name,
shape_key_name=bind.index,
blend_shape_group_name=blend_shape_group.name,
mesh_name=mesh_object_name,
)
)
if not mesh_object:
continue

if bind.index not in shape_keys.key_blocks:
mesh_data = mesh_object.data
if not isinstance(mesh_data, Mesh):
continue
shape_keys = mesh_data.shape_keys
if not shape_keys or bind.index not in shape_keys.key_blocks:
info_messages.append(
pgettext(
'mesh "{mesh_name}" doesn\'t have '
+ '"{shape_key_name}" shape key. '
+ "But blend shape group needs it."
'A shape key named "{shape_key_name}" in a mesh'
+ ' named "{mesh_name}" is assigned to a blend shape'
+ ' group named "{blend_shape_group_name}" but the'
+ " shape key doesn't exist."
).format(
mesh_name=bind.mesh.name,
mesh_name=mesh_object.name,
shape_key_name=bind.index,
blend_shape_group_name=blend_shape_group.name,
)
)

Expand Down
26 changes: 14 additions & 12 deletions src/io_scene_vrm/locale/ja_jp.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,20 @@
+ "代わりにfirstPersonBoneとしてVRMヒューマンボーン「head」を自動で設定します。",
(
"*",
'mesh "{mesh_name}" doesn\'t have shape key. '
+ 'But blend shape group needs "{shape_key_name}"'
+ " in its shape key.",
): "blend shape groupが参照しているメッシュ「{mesh_name}」の"
+ "シェイプキー「{shape_key_name}」が存在しません。",
(
"*",
'mesh "{mesh_name}" doesn\'t have '
+ '"{shape_key_name}" shape key. '
+ "But blend shape group needs it.",
): "メッシュ「{mesh_name}」にはシェイプキー「{shape_key_name}」が存在しません。"
+ "しかし blend shape group の設定はそれを必要としています。",
'A mesh named "{mesh_name}" is assigned to a blend'
+ ' shape group named "{blend_shape_group_name}" but'
+ " the mesh will not be exported",
): "Blend Shape Group「{blend_shape_group_name}」にメッシュ「{mesh_name}」が"
+ "割り当てられていますが、そのメッシュはエクスポートされません",
(
"*",
'A shape key named "{shape_key_name}" in a mesh'
+ ' named "{mesh_name}" is assigned to a blend shape'
+ ' group named "{blend_shape_group_name}" but the'
+ " shape key doesn't exist.",
): "Blend Shape Group「{blend_shape_group_name}」にメッシュ"
+ "「{mesh_name}」のシェイプキー「{shape_key_name}」が割り当てられていますが、"
+ "そのようなシェイプキーは存在しません",
(
"*",
'need "{expect_node_type}" input' + ' in "{shader_val}" of "{material_name}"',
Expand Down

0 comments on commit d885a19

Please sign in to comment.