Skip to content

Commit ea6bcb7

Browse files
authored
Merge pull request #15 from miu200521358/develop
ver2.01.06 (2023/10/22)
2 parents 70fcf26 + 3716e5f commit ea6bcb7

File tree

10 files changed

+137
-28
lines changed

10 files changed

+137
-28
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,4 @@ history.json
126126
src/example.py
127127
test/resources/サンプルモデル.pmx
128128
test/resources/サンプルモーション.vmd
129+
配布/

archive/Readme.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ https://github.com/miu200521358/vroid2pmx
208208
���@����
209209
----------------------------------------------------------------
210210

211+
ver2.01.06 (2023/10/22)
212+
�Evrm1.0�ŏo�͂����ꍇ�̃G���[�n���h�����O�lj�
213+
�E�}�e���A���팸�ŏo�͂����ꍇ�̃n���h�����O�lj�
214+
�@�E�}�e���A����2���܂łɍ팸�����Ǝ��s���܂�
215+
�@�E�{�[�����K�؂Ɋ��蓖�Ă��ĂȂ��ꍇ�APmxTailor�p�ݒ�C���|�[�gJSON������Ȃ��ꍇ������܂�
216+
�EVRoid Studio�x�[�^�łŃG�N�X�|�[�g����vrm���x�������ŏo�͂ł���悤����
217+
�@�Evrm�̃��[�t���������łƈقȂ邽�߁A�lj����[�t�̐������X���[���܂�
218+
�@�@�iVRoid Studio�Őݒ肵�����[�t�͂��̂܂܂̖��O�ŏo�͂��܂��j
219+
�@�E�`��ɂ���Ă�PmxTailor�p�ݒ�t�@�C���̏o�͂Ɏ��s����”\��������܂�
220+
211221
ver2.01.05 (2023/04/22)
212222
�EVRoid Studio 1.22.0 �ȍ~�ŁA
213223
�@PmxTailor�ݒ�p�G�N�X�|�[�g�����ōގ������Ȃ��������̃n���h�����O�lj�

archive/β版Readme.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@
5454
���@rivision
5555
----------------------------------------------------------------
5656

57+
Vroid2Pmx_2.01.06_��03 (2023/09/30)
58+
�EVRoid Studio�������łŃG�N�X�|�[�g����vrm�̕ϊ��Ɏ��s����ꍇ���������̂��C��
59+
60+
Vroid2Pmx_2.01.06_��02 (2023/09/27)
61+
�EVRoid Studio�x�[�^�łŃG�N�X�|�[�g����vrm���x�������ŏo�͂ł���悤����
62+
�@�Evrm�̃��[�t���������łƈقȂ邽�߁A�lj����[�t�̐������X���[���܂�
63+
�@�@�iVRoid Studio�Őݒ肵�����[�t�͂��̂܂܂̖��O�ŏo�͂��܂��j
64+
�@�E�`��ɂ���Ă�PmxTailor�p�ݒ�t�@�C���̏o�͂Ɏ��s����”\��������܂�
65+
66+
Vroid2Pmx_2.01.06_��01 (2023/09/26)
67+
�Evrm1.0�ŏo�͂����ꍇ�̃G���[�n���h�����O�lj�
68+
�E�}�e���A���팸�ŏo�͂����ꍇ�̃n���h�����O�lj�
69+
�@���{�[�����K�؂Ɋ��蓖�Ă��ĂȂ��ꍇ�APmxTailor�p�ݒ�C���|�[�gJSON������Ȃ��ꍇ������܂�
70+
5771
Vroid2Pmx_2.01.05_��01 (2023/04/15)
5872
�EPmxTailor�ݒ�p�G�N�X�|�[�g�����ŁA�ގ������Ȃ��������̃n���h�����O�lj�
5973

rivision.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,65 @@
11

2+
Vroid2Pmx_2.01.06_��03 (2023/09/30)
3+
4+
�EVRoid Studio�������łŃG�N�X�|�[�g����vrm�̕ϊ��Ɏ��s����ꍇ���������̂��C��<br>
5+
<br>
6+
�� ���m�|�X�g<br>
7+
(������)<br>
8+
<br>
9+
�� �z�z�ꏊ<br>
10+
https://fire.st/jVPUABu
11+
12+
13+
VRoid Studio 1.x �ō쐬����vrm�f�[�^����pmx�iMMD�p���f���j�f�[�^�ɕϊ��ł��� �uVroid2Pmx�v�x�[�^�ł��A�b�v�f�[�g���܂����I
14+
15+
v2.01.06_��02
16+
�EVRoid Studio�x�[�^�łŃG�N�X�|�[�g����vrm���x�������ŏo�͂ł���悤����
17+
�@�����[�t�lj������Ή�
18+
19+
���R�~���j�e�B�z�z
20+
https://com.nicovideo.jp/community/co5387214
21+
22+
23+
�� VRoid Studio�x�[�^�ňꕔ�Ή�
24+
25+
VRoid Studio�x�[�^�łŃG�N�X�|�[�g����vrm���A�x�������ŏo�͂܂ł͂ł���悤�ɂ��Ă݂܂����B
26+
�������A���[�t���������łƈقȂ邽�߁A�lj����[�t�̐����̓X���[����܂�
27+
�iVRoid Studio�Őݒ肵�����[�t�͂��̂܂܂̖��O�ŏo�͂��܂��j
28+
PmxTailor�p�ݒ�t�@�C�����o�͂��܂����A���܂Ɍ��ʂ��ςȂ̂ł����ӂ�������
29+
30+
31+
32+
vrm1.0�̉�͂͌��ݑΉ����Ă��Ȃ��̂ŁA�K�؂ȃ��b�Z�[�W���o�͏o����悤�n���h�����O��lj����܂���
33+
34+
�� �}�e���A���팸���̃n���h�����O�lj�
35+
36+
vrm�G�N�X�|�[�g���Ƀ}�e���A�����팸�����ꍇ�A�o�͂Ɏ��s����s��ɑΉ����܂���
37+
���ߑ��Ȃǂ̗h�ꕨ�ݒ肪�Ȃ��Ȃ��Ă���ꍇ�APmxTailor�p�ݒ�t�@�C��JSON�ɂ��ݒ肪�lj�����܂���
38+
39+
40+
41+
�� ����g�U�n�X�L�b�v�����lj�
42+
43+
����g�U�͍\���I�ɕ��G�ł��܂����Ƃ����ւ����ʂɓ�����Ȃ��ꍇ�����邽�߁A��U���O����悤�ɂ��܂���
44+
���萔�ł�������g�U����ꂽ���ꍇ�̓v���O�C���œ��꒼���Ă�������
45+
46+
47+
�� �t�@�C�������������C��
48+
49+
�t�@�C������PMX���f�����𗬗p���Ă���̂ł����A�����Ƀt�@�C�����Ƃ��ďo�͂ł��Ȃ������񂪂������ꍇ�Ƀt�@�C���p�X�����ŃG���[���������Ă����̂ŁAPMX���f��������t�@�C�����Ƃ��ďo�͂ł��Ȃ��������폜����悤�ɂ��܂���
50+
51+
52+
�� Vroid�Ή�����
53+
54+
Vroid2Pmx�o�R�i�㔼�g3�j�̃��f���Ńt�B�b�e�B���O���Y��ɂȂ�Ȃ��p�^�[�����������̂������‚��C�����Ă��܂�
55+
�ȑO����Y��Ƀt�B�b�e�B���O�ł���悤�ɂȂ��Ă���c�͂��ł���
56+
57+
58+
59+
60+
61+
62+
263
https://fire.st/RIy5ZY4
364
Vroid2Pmx_1.00.00_��01 (2021/11/21)
465
�E�V�K�쐬

src/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from utils.MLogger import MLogger
1313
from utils import MFileUtils
1414

15-
VERSION_NAME = "2.01.05"
15+
VERSION_NAME = "2.01.06"
1616

1717
# 指数表記なし、有効小数点桁数6、30を超えると省略あり、一行の文字数200
1818
np.set_printoptions(suppress=True, precision=6, threshold=30, linewidth=200)

src/locale/en_US/messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,5 +411,6 @@
411411
"-- 身体剛体準備終了": "--Completion of body rigid body preparation",
412412
"-- -- 身体剛体[%s]": "---- Body Rigid Body [ %s]",
413413
"舌関連頂点が見つからなかったため、舌分離処理をスキップします": "No tongue-related vertices found, skipping tongue separation processing",
414-
"-- Aスタンス・親指調整終了": "-- Finished A stance/thumb adjustment"
414+
"-- Aスタンス・親指調整終了": "-- Finished A stance/thumb adjustment",
415+
"出力ソフト情報がないため、処理を中断します。\nvrm1.0でエクスポートした場合、vrm0.0でエクスポートし直してください。": "The process is aborted because there is no output software information. \nIf you exported with vrm1.0, please re-export with vrm0.0."
415416
}

src/locale/ja_JP/messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,5 +411,6 @@
411411
"-- 身体剛体準備終了": "-- 身体剛体準備終了",
412412
"-- -- 身体剛体[%s]": "-- -- 身体剛体[%s]",
413413
"舌関連頂点が見つからなかったため、舌分離処理をスキップします": "舌関連頂点が見つからなかったため、舌分離処理をスキップします",
414-
"-- Aスタンス・親指調整終了": "-- Aスタンス・親指調整終了"
414+
"-- Aスタンス・親指調整終了": "-- Aスタンス・親指調整終了",
415+
"出力ソフト情報がないため、処理を中断します。\nvrm1.0でエクスポートした場合、vrm0.0でエクスポートし直してください。": "出力ソフト情報がないため、処理を中断します。\nvrm1.0でエクスポートした場合、vrm0.0でエクスポートし直してください。"
415416
}

src/locale/zh_CN/messages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,5 +414,6 @@
414414
"-- 身体剛体準備終了": "--完成刚体刚体准备",
415415
"-- -- 身体剛体[%s]": "---- Body 刚体 [%s]",
416416
"舌関連頂点が見つからなかったため、舌分離処理をスキップします": "未找到舌相关顶点,跳过舌分离处理",
417-
"-- Aスタンス・親指調整終了": "-- 完成了姿势/拇指调整"
417+
"-- Aスタンス・親指調整終了": "-- 完成了姿势/拇指调整",
418+
"出力ソフト情報がないため、処理を中断します。\nvrm1.0でエクスポートした場合、vrm0.0でエクスポートし直してください。": "由于没有输出软件信息,进程被中止。 \n如果您已使用vrm1.0 导出,请使用 vrm0.0 重新导出。"
418419
}

src/service/VroidExportService.py

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,25 @@ def execute(self):
106106
except MKilledException:
107107
return False
108108
except SizingException as se:
109-
logger.error("Vroid2Pmx処理が処理できないデータで終了しました。\n\n%s", se.message, decoration=MLogger.DECORATION_BOX)
109+
logger.error(
110+
"Vroid2Pmx処理が処理できないデータで終了しました。\n\n%s\n%s",
111+
"2.01.06",
112+
se.message,
113+
decoration=MLogger.DECORATION_BOX,
114+
)
110115
except Exception:
111116
logger.critical(
112-
"Vroid2Pmx処理が意図せぬエラーで終了しました。\n\n%s", traceback.format_exc(), decoration=MLogger.DECORATION_BOX
117+
"Vroid2Pmx処理が意図せぬエラーで終了しました。\n\n%s\n%s",
118+
"2.01.06",
119+
traceback.format_exc(),
120+
decoration=MLogger.DECORATION_BOX,
113121
)
114122
finally:
115123
logging.shutdown()
116124

117125
def vroid2pmx(self):
118126
try:
119-
model, tex_dir_path, setting_dir_path = self.create_model()
127+
model, tex_dir_path, setting_dir_path, is_vroid1 = self.create_model()
120128
if not model:
121129
return False
122130

@@ -132,7 +140,7 @@ def vroid2pmx(self):
132140
if not model:
133141
return False
134142

135-
model = self.convert_morph(model)
143+
model = self.convert_morph(model, is_vroid1)
136144
if not model:
137145
return False
138146

@@ -1032,7 +1040,7 @@ def calc_normal(self, bone_mat: MMatrix4x4, normal: MVector3D):
10321040

10331041
return MVector3D(np.sum(normal.data() * bone_invert_mat, axis=1)).normalized()
10341042

1035-
def convert_morph(self, model: PmxModel):
1043+
def convert_morph(self, model: PmxModel, is_vroid1: bool):
10361044
# グループモーフ定義
10371045
if (
10381046
"extensions" not in model.json_data
@@ -1050,8 +1058,9 @@ def convert_morph(self, model: PmxModel):
10501058
logger.info("-- -- モーフ調整準備")
10511059

10521060
face_close_dict = {}
1053-
for base_offset in target_morphs["Fcl_EYE_Close"].offsets:
1054-
face_close_dict[base_offset.vertex_index] = base_offset.position_offset.copy().data()
1061+
if is_vroid1:
1062+
for base_offset in target_morphs["Fcl_EYE_Close"].offsets:
1063+
face_close_dict[base_offset.vertex_index] = base_offset.position_offset.copy().data()
10551064

10561065
face_material_index_vertices = []
10571066
face_left_close_index_vertices = []
@@ -1949,6 +1958,7 @@ def convert_mesh(self, model: PmxModel, bone_name_dict: dict, tex_dir_path: str)
19491958
indices_by_materials = {}
19501959
materials_by_type = {}
19511960
registed_material_names = []
1961+
midx = 0
19521962

19531963
for vertex_key, vertex_dict in vertex_blocks.items():
19541964
start_vidx = vertex_dict["start"]
@@ -2154,7 +2164,7 @@ def convert_mesh(self, model: PmxModel, bone_name_dict: dict, tex_dir_path: str)
21542164
if "vectorProperties" in material_ext and "_ShadeColor" in material_ext["vectorProperties"]:
21552165
toon_sharing_flag = 0
21562166
if material_ext["textureProperties"]["_MainTex"] < len(model.json_data["images"]):
2157-
toon_img_name = f'{model.json_data["images"][material_ext["textureProperties"]["_MainTex"]]["name"]}_Toon.bmp'
2167+
toon_img_name = f'{model.json_data["images"][material_ext["textureProperties"]["_MainTex"]].get("name", f"M{midx:03d}")}_Toon.bmp'
21582168
else:
21592169
toon_img_name = f"{material_name}_Toon.bmp"
21602170

@@ -2220,6 +2230,7 @@ def convert_mesh(self, model: PmxModel, bone_name_dict: dict, tex_dir_path: str)
22202230
material.vertex_count += len(indices)
22212231

22222232
logger.info("-- 面・材質データ解析[%s-%s]", index_accessor, material_accessor)
2233+
midx += 1
22232234

22242235
# 材質を透過順に並べ替て設定
22252236
index_idx = 0
@@ -3003,25 +3014,30 @@ def create_model(self):
30033014
or "VRM" not in model.json_data["extensions"]
30043015
or "exporterVersion" not in model.json_data["extensions"]["VRM"]
30053016
):
3006-
logger.error("出力ソフト情報がないため、処理を中断します。", decoration=MLogger.DECORATION_BOX)
3007-
return None, None, None
3017+
logger.error(
3018+
"出力ソフト情報がないため、処理を中断します。\nvrm1.0でエクスポートした場合、vrm0.0でエクスポートし直してください。",
3019+
decoration=MLogger.DECORATION_BOX,
3020+
)
3021+
return None, None, None, None
30083022

30093023
if (
30103024
"extensions" not in model.json_data
30113025
or "VRM" not in model.json_data["extensions"]
30123026
or "meta" not in model.json_data["extensions"]["VRM"]
30133027
):
30143028
logger.error("メタ情報がないため、処理を中断します。", decoration=MLogger.DECORATION_BOX)
3015-
return None, None, None
3029+
return None, None, None, None
30163030

3017-
if "VRoidStudio-0." in model.json_data["extensions"]["VRM"]["exporterVersion"]:
3018-
# VRoid Studioベータ版はNG
3019-
logger.error(
3020-
"VRoid Studio ベータ版 で出力されたvrmデータではあるため、処理を中断します。\n正式版でコンバートしてから再度試してください。\n出力元: %s",
3021-
model.json_data["extensions"]["VRM"]["exporterVersion"],
3022-
decoration=MLogger.DECORATION_BOX,
3023-
)
3024-
return None, None, None
3031+
# if "VRoidStudio-0." in model.json_data["extensions"]["VRM"]["exporterVersion"]:
3032+
# # VRoid Studioベータ版はNG
3033+
# logger.error(
3034+
# "VRoid Studio ベータ版 で出力されたvrmデータではあるため、処理を中断します。\n正式版でコンバートしてから再度試してください。\n出力元: %s",
3035+
# model.json_data["extensions"]["VRM"]["exporterVersion"],
3036+
# decoration=MLogger.DECORATION_BOX,
3037+
# )
3038+
# return None, None, None
3039+
3040+
is_vroid1 = True
30253041

30263042
if "VRoid Studio-1." not in model.json_data["extensions"]["VRM"]["exporterVersion"]:
30273043
# VRoid Studio正式版じゃなくても警告だけに留める
@@ -3030,6 +3046,7 @@ def create_model(self):
30303046
model.json_data["extensions"]["VRM"]["exporterVersion"],
30313047
decoration=MLogger.DECORATION_BOX,
30323048
)
3049+
is_vroid1 = False
30333050

30343051
if "title" in model.json_data["extensions"]["VRM"]["meta"]:
30353052
model.name = model.json_data["extensions"]["VRM"]["meta"]["title"]
@@ -3091,19 +3108,22 @@ def create_model(self):
30913108

30923109
if "images" not in model.json_data:
30933110
logger.error("変換可能な画像情報がないため、処理を中断します。", decoration=MLogger.DECORATION_BOX)
3094-
return None, None, None
3111+
return None, None, None, None
30953112

30963113
# jsonデータの中に画像データの指定がある場合
30973114
image_offset = 0
3098-
for image in model.json_data["images"]:
3115+
for iidx, image in enumerate(model.json_data["images"]):
30993116
if int(image["bufferView"]) < len(model.json_data["bufferViews"]):
31003117
image_buffer = model.json_data["bufferViews"][int(image["bufferView"])]
31013118
# 画像の開始位置はオフセット分ずらす
31023119
image_start = self.offset + image_buffer["byteOffset"]
31033120
# 拡張子
31043121
ext = MIME_TYPE[image["mimeType"]]
31053122
# 画像名
3106-
image_name = f"{image['name']}.{ext}"
3123+
if "name" in image:
3124+
image_name = f"{image['name']}.{ext}"
3125+
else:
3126+
image_name = f"T{iidx:03d}.{ext}"
31073127
with open(os.path.join(glft_dir_path, image_name), "wb") as ibf:
31083128
ibf.write(self.buffer[image_start : (image_start + image_buffer["byteLength"])])
31093129
# オフセット加算
@@ -3115,7 +3135,7 @@ def create_model(self):
31153135

31163136
logger.info("-- テクスチャデータ解析終了")
31173137

3118-
return model, tex_dir_path, setting_dir_path
3138+
return model, tex_dir_path, setting_dir_path, is_vroid1
31193139

31203140
# アクセサ経由で値を取得する
31213141
# https://github.com/ft-lab/Documents_glTF/blob/master/structure.md

vroid2pmx.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exe = EXE(pyz,
5757
a.zipfiles,
5858
a.datas,
5959
[],
60-
name='Vroid2Pmx_2.01.05',
60+
name='Vroid2Pmx_2.01.06',
6161
debug=False,
6262
bootloader_ignore_signals=False,
6363
strip=False,

0 commit comments

Comments
 (0)