Skip to content

Commit

Permalink
1.03_β05
Browse files Browse the repository at this point in the history
MotionSupporter_1.03_β05 (2021/05/22)
・足FKtoIK
 ・初期足首水平化チェック追加
  ・チェックを入れると、初期値(X=0, Y=0, Z=0)が設定されている足首ボーンの角度を地面と水平の角度に調整する
 ・かかと・つま先Y=0チェック追加
  ・チェックを入れると、左右のかか・とつま先の4点のうちもっとも低いY値をY=0にセンターを調整する
 ・接地固定指定追加
  ・指定すると、指定されたキーフレ範囲の軸足を、Y=0になるようセンターの高さを調節し、かつセンターXZを固定します。
 ※いずれも未指定の場合は調整はせずにそのまま足FKをIKに変換する
  • Loading branch information
miu200521358 committed May 22, 2021
1 parent 9379d4e commit 47ee970
Show file tree
Hide file tree
Showing 10 changed files with 628 additions and 30 deletions.
2 changes: 1 addition & 1 deletion motion_supporter64.spec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ exe = EXE(pyz,
a.zipfiles,
a.datas,
[],
name='MotionSupporter_1.03_β04_64bit',
name='MotionSupporter_1.03_β05_64bit',
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down
2 changes: 1 addition & 1 deletion src/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from utils import MFileUtils
from utils.MException import SizingException

VERSION_NAME = "1.03_β04"
VERSION_NAME = "1.03_β05"

# 指数表記なし、有効小数点桁数6、30を超えると省略あり、一行の文字数200
np.set_printoptions(suppress=True, precision=6, threshold=30, linewidth=200)
Expand Down
287 changes: 286 additions & 1 deletion src/form/panel/LegFKtoIKPanel.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/form/worker/LegFKtoIKWorkerThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def thread_event(self):
logging_level=self.frame.logging_level, \
motion=self.frame.leg_fk2ik_panel_ctrl.leg_fk2ik_vmd_file_ctrl.data.copy(), \
model=self.frame.leg_fk2ik_panel_ctrl.leg_fk2ik_model_file_ctrl.data, \
target_legs=self.frame.leg_fk2ik_panel_ctrl.leg_ground_dialog.get_leg_list(), \
ground_leg_flg=self.frame.leg_fk2ik_panel_ctrl.ground_leg_flg_ctrl.GetValue(), \
ankle_horizonal_flg=self.frame.leg_fk2ik_panel_ctrl.ankle_horizonal_flg_ctrl.GetValue(), \
output_path=self.frame.leg_fk2ik_panel_ctrl.output_leg_fk2ik_vmd_file_ctrl.file_ctrl.GetPath(), \
remove_unnecessary_flg=self.frame.leg_fk2ik_panel_ctrl.remove_unnecessary_flg_ctrl.GetValue(), \
monitor=self.frame.leg_fk2ik_panel_ctrl.console_ctrl, \
Expand Down
72 changes: 48 additions & 24 deletions src/mmd/PmxReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,30 +338,6 @@ def read_data(self):
pmx.bones[head_top_bone.name] = head_top_bone
pmx.bone_indexes[head_top_bone.index] = head_top_bone.name

if "右足IK" in pmx.bones or "右つま先IK" in pmx.bones:
# 右つま先ボーン
right_toe_vertex = pmx.get_toe_vertex("右")
if right_toe_vertex:
pmx.right_toe_vertex = right_toe_vertex
right_toe_pos = right_toe_vertex.position.copy()
right_toe_pos.setY(0)
right_toe_bone = Bone("右つま先実体", "right toe entity", right_toe_pos, -1, 0, 0)
right_toe_bone.index = len(pmx.bones.keys())
pmx.bones[right_toe_bone.name] = right_toe_bone
pmx.bone_indexes[right_toe_bone.index] = right_toe_bone.name

if "左足IK" in pmx.bones or "左つま先IK" in pmx.bones:
# 左つま先ボーン
left_toe_vertex = pmx.get_toe_vertex("左")
if left_toe_vertex:
pmx.left_toe_vertex = left_toe_vertex
left_toe_pos = left_toe_vertex.position.copy()
left_toe_pos.setY(0)
left_toe_bone = Bone("左つま先実体", "left toe entity", left_toe_pos, -1, 0, 0)
left_toe_bone.index = len(pmx.bones.keys())
pmx.bones[left_toe_bone.name] = left_toe_bone
pmx.bone_indexes[left_toe_bone.index] = left_toe_bone.name

if "右足先EX" in pmx.bones or "右足IK" in pmx.bones:
# 右足底実体ボーン
right_sole_vertex = None
Expand All @@ -374,6 +350,12 @@ def read_data(self):
pmx.right_sole_vertex = right_sole_vertex
right_sole_bone = Bone("右足底実体", "right sole entity", right_sole_vertex.position.copy(), -1, 0, 0)
right_sole_bone.index = len(pmx.bones.keys())

if "右足先EX" in pmx.bones:
right_sole_bone.parent_index = pmx.bones["右足先EX"].index
else:
right_sole_bone.parent_index = pmx.bones["右足首"].index

pmx.bones[right_sole_bone.name] = right_sole_bone
pmx.bone_indexes[right_sole_bone.index] = right_sole_bone.name

Expand All @@ -389,9 +371,51 @@ def read_data(self):
pmx.left_sole_vertex = left_sole_vertex
left_sole_bone = Bone("左足底実体", "left sole entity", left_sole_vertex.position.copy(), -1, 0, 0)
left_sole_bone.index = len(pmx.bones.keys())

if "左足先EX" in pmx.bones:
left_sole_bone.parent_index = pmx.bones["左足先EX"].index
else:
left_sole_bone.parent_index = pmx.bones["左足首"].index

pmx.bones[left_sole_bone.name] = left_sole_bone
pmx.bone_indexes[left_sole_bone.index] = left_sole_bone.name

if "右足IK" in pmx.bones or "右つま先IK" in pmx.bones:
# 右つま先ボーン
right_toe_vertex = pmx.get_toe_vertex("右")
if right_toe_vertex:
pmx.right_toe_vertex = right_toe_vertex
right_toe_pos = right_toe_vertex.position.copy()
right_toe_pos.setY(0)
right_toe_bone = Bone("右つま先実体", "right toe entity", right_toe_pos, -1, 0, 0)
right_toe_bone.index = len(pmx.bones.keys())

if "右足底実体" in pmx.bones:
right_toe_bone.parent_index = pmx.bones["右足底実体"].index
else:
right_toe_bone.parent_index = pmx.bones["右足首"].index

pmx.bones[right_toe_bone.name] = right_toe_bone
pmx.bone_indexes[right_toe_bone.index] = right_toe_bone.name

if "左足IK" in pmx.bones or "左つま先IK" in pmx.bones:
# 左つま先ボーン
left_toe_vertex = pmx.get_toe_vertex("左")
if left_toe_vertex:
pmx.left_toe_vertex = left_toe_vertex
left_toe_pos = left_toe_vertex.position.copy()
left_toe_pos.setY(0)
left_toe_bone = Bone("左つま先実体", "left toe entity", left_toe_pos, -1, 0, 0)
left_toe_bone.index = len(pmx.bones.keys())

if "左足底実体" in pmx.bones:
left_toe_bone.parent_index = pmx.bones["左足底実体"].index
else:
left_toe_bone.parent_index = pmx.bones["左足首"].index

pmx.bones[left_toe_bone.name] = left_toe_bone
pmx.bone_indexes[left_toe_bone.index] = left_toe_bone.name

if "右足IK" in pmx.bones:
# 右足IK底実体ボーン
right_ik_sole_vertex = Vertex(-1, MVector3D(pmx.bones["右足IK"].position.x(), 0, pmx.bones["右足IK"].position.z()), MVector3D(), [], [], Bdef1(-1), -1)
Expand Down
3 changes: 3 additions & 0 deletions src/module/MOptions.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ cdef class MLegFKtoIKOptions:
cdef public int logging_level
cdef public VmdMotion motion
cdef public PmxModel model
cdef public list target_legs
cdef public bint ground_leg_flg
cdef public bint ankle_horizonal_flg
cdef public str output_path
cdef public bint remove_unnecessary_flg
cdef public object monitor
Expand Down
7 changes: 5 additions & 2 deletions src/module/MOptions.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,15 @@ cdef class MMultiJoinOptions:

cdef class MLegFKtoIKOptions:

def __init__(self, str version_name, int logging_level, int max_workers, VmdMotion motion, PmxModel model, str output_path, \
bint remove_unnecessary_flg, object monitor, bint is_file, str outout_datetime):
def __init__(self, str version_name, int logging_level, int max_workers, VmdMotion motion, PmxModel model, list target_legs, bint ground_leg_flg, \
bint ankle_horizonal_flg, str output_path, bint remove_unnecessary_flg, object monitor, bint is_file, str outout_datetime):
self.version_name = version_name
self.logging_level = logging_level
self.motion = motion
self.model = model
self.target_legs = target_legs
self.ground_leg_flg = ground_leg_flg
self.ankle_horizonal_flg = ankle_horizonal_flg
self.output_path = output_path
self.remove_unnecessary_flg = remove_unnecessary_flg
self.monitor = monitor
Expand Down
Loading

0 comments on commit 47ee970

Please sign in to comment.