1.6.0.0528 - Connect IK Chains/Convert To MHX fail with body morphs/custom morphs

Issue #654 resolved
Mustard created an issue

Hi!

Firstly I would like to thank everyone here for this amazing add-on!

I’m using the new version (1.6.0.0528), and I’m trying to use Convert To MHX, but I get the following error, and the MHX rig generation fails:

Error: Python: Traceback (most recent call last):
File "C:\Users\-\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\import_daz\error.py", line 208, in execute
self.run(context)
File "C:\Users\-\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\import_daz\mhx.py", line 470, in run
self.convertMhx(context)
File "C:\Users\-\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\import_daz\mhx.py", line 664, in convertMhx
self.setupFkIk(rig)
File "C:\Users\-\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\import_daz\mhx.py", line 1196, in setupFkIk
bone = rpbs[bname+suffix]
KeyError: 'bpy_prop_collection[key]: key "toe.L" not found'

location: <unknown location>:-1

Plus, the Connect IK Chains fails to connect bones (the legs and arms bones become “point-like”).

This happens after I use Make All Bones Posable. I also merged some armatures from geografts and outfits (but I get the same errors also without this merging step), and then added some custom morphs to the main body mesh. It doesn’t seem to happen if:

  • I don’t import body morphs and custom morphs;
  • I use Merge Toe, although Connect IK Chains still fails in a similar way, and the generated MHX rig is broken.

Finally, the same morphs could be imported in the latest 1.5.1 version without generating errors during the MHX rig conversion.

As a note, I also get these warning/errors when I use Convert To MHX (several similar errors/warnings, of the following type):

ERROR (bke.fcurve): C:\Users\blender\git\blender-v293\blender.git\source\blender\blenkernel\intern\fcurve_driver.c:1035 driver_evaluate_simple_expr: Division by Zero in Driver: '(1+a)/parscale'

add_relation(Copy Rotation) - Could not find op_from (OperationKey(type: BONE, component name: 'forearmTwist.L', operation code: BONE_DONE))
add_relation(Copy Rotation) - Failed, but op_to (OperationKey(type: BONE, component name: 'lForearmTwist(fin)', operation code: BONE_CONSTRAINTS)) was ok
find_node_operation: Failed for (BONE_DONE, '')
add_relation(Copy Scale) - Could not find op_from (OperationKey(type: BONE, component name: 'forearmTwist.L', operation code: BONE_DONE))

Comments (8)

  1. Thomas Larsson repo owner

    The problem with Connect IK Chains is easy to understand. This tool really does not make sense when the arms and legs are made poseable, but at least the bones do not vanish anymore.

    Body morphs do not really work with the mhx rig, except at the tips of the bone hierarchy: fingers, toes, and pectorals. The last error messages are a symptom of that. Maybe there should be an option to select MHX-compatible morphs only when you load body morphs. Face bones are also at the tip of the hierarchy, so the face morphs work.

    The missing toe.L bone is strange. I noticed too, but cannot reproduce it anymore. The bone existed in edit mode, but disappeared immediately after swiching to object mode. Anyway, don’t import morphs that affect the individual toe bones if you intend to merge them.

  2. Mustard reporter

    Thank you for the answer!

    I will avoid using Connect IK Chains after making bones posable then. And I didn’t know about this limitation of the MHX rig, I’ll be more careful.

    For the missing “toe.L” error, for me it’s quite easy to reproduce:

    • import any armature
    • add all body morphs related to toes
    • make bones posable
    • convert to MHX

    In fact my idea was not to merge the toes, but if it’s the only way to generate a MHX rig I guess I’ll have to do this.

  3. Thomas Larsson repo owner

    I introduced a button that selects MHX-compatible body morphs. That includes the toe morphs, unless the toe bones have been merged. If you only select those morphs, MHX conversion seems to work smoothly, both if all bones are made poseable or not. No warnings in the console as far as I could see.

    For custom morphs you are on your own, though.

  4. Mustard reporter

    Thank you for your answer, I was writing the following when I saw your answer. Maybe it might help for future problems with a similar error.

    Not sure if it might help, but it seems that the toe.L/toe.R bones are deleted after going out of edit mode because they have 0 length: somehow connecting the toe bones makes the head coincides with the tail.

    In fact, commenting the use_connect part of the MHX generation fixes the problem. After the generation finishes, you can check the 0 length behaviour by manually enabling use_connect in edit mode.

  5. Thomas Larsson repo owner

    OK, I think the problems have been solved now. If the toe parents are drv bones, its the parents that are connected rather than the toes themselves, so no toes disappear.

    The MHX compatible morphs are all morphs that don’t drive upper arms, forearms, or thighs, since the bend and twist bones are constrained by the long bones in mhx. There are some warnings about invalid drivers for tweak bones, but the drivers seem fixed once the conversion has ended. Those warnings only appear if you don’t make bones poseable, and create tweak bones for mhx.

  6. Thomas Larsson repo owner

    Slight correction: the hand and foot morphs are not mhx compatible, because the hand and foot bones are driven by the corresponding fk and ik bones. So they should not be loaded.

  7. Mustard reporter

    Thank you! I can confirm the problem with the toes is solved now, I guess the issue can be marked as “Resolved”. 😊

  8. Log in to comment