Open nagadomi opened 8 years ago
Interesting..., i can confirm it, it seems blender copies&pastes the "name_j" and "name_e" as well.
If i select left side bones, copy pose, paste pose(flip), then the "name_j" and "name_e" of right side bones will be the same with left side bones. :sob:
I need more time to debug it, hopefully solve it. :smile:
If i select left side bones, copy pose, paste pose(flip), then the "name_j" and "name_e" of right side bones will be the same with left side bones. :sob:
I found this issue when model's left arm is stuck. After I've debug this issue, I noticed that mmd_bone.name_j
of both arms are "右腕(right arm)". :sob:
I noticed that it copies & pastes many values, also affects manually added custom properties. The same behavior can be confirmed in order blender versions as well.
I can sovle it by changing bpy.types.PoseBone
to bpy.types.Bone
here, and do a lot of related fixes. It is a disaster. :sweat: Not sure if there is any other way to solve it ? I would like to wait for the opinions. :thought_balloon:
For now, please do not use that feature... :disappointed:
In my situation(a problem of VMD importer), it can solve by fixing utils.makePmxBoneMap
. So I think it's not a serious problem for me.
But it's a quick fix, and this issue maybe deeply related to the exporter. (I am not using the export feature)
Wishing you the best :smile:
diff --git a/mmd_tools/utils.py b/mmd_tools/utils.py
index 88cabe6..4ee80a3 100644
--- a/mmd_tools/utils.py
+++ b/mmd_tools/utils.py
@@ -76,6 +76,19 @@ def convertNameToLR(name):
name = m.group(1) + m.group(2) + '.R'
return name
+## Revert blender style name to original japanese name
+## This is not a perfect fix. because 右/左 are not a prefix in some cases.
+__REVERT_NAME_TO_L_REGEXP = re.compile('^(.*).L$')
+__REVERT_NAME_TO_R_REGEXP = re.compile('^(.*).R$')
+def revertNameToLR(name):
+ m = __REVERT_NAME_TO_L_REGEXP.match(name)
+ if m:
+ name = '左' + m.group(1)
+ m = __REVERT_NAME_TO_R_REGEXP.match(name)
+ if m:
+ name = '右' + m.group(1)
+ return name
+
## src_vertex_groupのWeightをdest_vertex_groupにaddする
def mergeVertexGroup(meshObj, src_vertex_group_name, dest_vertex_group_name):
mesh = meshObj.data
@@ -136,7 +149,8 @@ def makePmxBoneMap(armObj):
# Maintain backward compatibility with mmd_tools v0.4.x or older.
name = i.get('mmd_bone_name_j', i.get('name_j', None))
if name is None:
- name = i.mmd_bone.name_j or i.name
+ name = revertNameToLR(i.name)
+ # print(name, i.mmd_bone.name_j, i.name)
boneMap[name] = i
return boneMap
I think your problem of VMD importer should be solved now. (The bone name conversion should be more natural in my solution, thanks for the hint of your patch.) :smile:
When import motions, you can choose the bone mapper 'Renamed bones'
if you import the armature with the option 'Rename bones'
, so motion data will be imported properly even if mmd_bone.name_j
is broken. :smile:
But the true bug is not solved yet, i'm struggling whether I should change bpy.types.PoseBone
to bpy.types.Bone
or not... :sweat:
Thanks
Sometimes,
mmd_bone.name_j
is broken, and VMD importer fails to import a motion. This problem is caused bypose.paste(flipped=True)
.Reproducing:
Bone tab
->MMD Bone Tools
-> Name(or Name eng). "右(right)" and "左(left)" are reversed.I don't know whether this is my fault or unexpected issues.