mpfb2 icon indicating copy to clipboard operation
mpfb2 copied to clipboard

Delete Helpers error

Open IvailoBurov opened this issue 2 years ago • 12 comments

Describe the bug After importing models made with MakeHuman that work fine in MPFB2, deleting the helpers before exporting gives the following error:

Checklist Happens with Blender 3.67 and Blender 4.02

Screenshots / logs Python: Traceback (most recent call last): File "C:\Users\admin\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\mpfb\ui\basemeshops\operators\deletehelpers.py", line 88, in execute TargetService.reapply_all_details(obj) File "C:\Users\admin\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\mpfb\services\targetservice.py", line 825, in reapply_all_details TargetService.bulk_load_targets(basemesh, target_stack, encode_target_names=False) File "C:\Users\admin\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\mpfb\services\targetservice.py", line 520, in bulk_load_targets shape_key = TargetService.target_string_to_shape_key( File "C:\Users\admin\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\mpfb\services\targetservice.py", line 347, in target_string_to_shape_key TargetService._set_shape_key_coords_from_dict(blender_object, shape_key, shape_key_info) File "C:\Users\admin\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\mpfb\services\targetservice.py", line 276, in _set_shape_key_coords_from_dict buffer[base] += x * scale_factor IndexError: list index out of range

Platform and versions

  • OS: Windows 10
  • Blender 3.67 and Blender 4.02
  • Version of MPFB:
  • http://files.makehumancommunity.org/plugins/mpfb2-blender4-latest.zip
  • http://files.makehumancommunity.org/plugins/mpfb2-latest.zip

IvailoBurov avatar Dec 31 '23 20:12 IvailoBurov

Thanks. I've pushed a fix to the blender4 branch now. It'll appear in tomorrow's nightly build.

Can you check if this solves the problem for you? Then I'll back-port it to the blender 3.6 branch.

joepal1976 avatar Jan 01 '24 15:01 joepal1976

Thanks for reply. mpfb2-blender4-20240101 build doesn't solve the problem. I have two Makehuman models imported, both have the same problem when removing the helpers in mpfb2. I'm attaching one here for testing: ivWoman.zip

IvailoBurov avatar Jan 01 '24 22:01 IvailoBurov

That's because the nightly builds are build at around five in the morning swedish time. You'll need a blender 4 build with a date from 20240102 or later for the fix to be in it.

joepal1976 avatar Jan 02 '24 08:01 joepal1976

This 20240102 build fixes the bug for Blender 4, but you need to bake the shapekeys first. Otherwise, the error occurs again. Is there a way to save shapekeys on export? With Blender 3.67 the error still persist.

IvailoBurov avatar Jan 02 '24 21:01 IvailoBurov

What I assume you are doing here is that you:

  • Model something inside makehuman
  • Import the model "from makehuman" in blender
  • Continue model it using modeling sliders in MPFB
  • Try to remove helpers

You're in a world of hurt if you do this, as results will often end up rather random. This especially if you try to modify a phenotype slider in MPFB. What you get from MakeHuman is a baked mesh without any shape keys, whereas everything in MPFB assumes you are working on a "live" basemesh with at least phenotype shape keys.

If you instead open exactly the same model from MakeHuman via "from presets" -> "import MHM" (ie, you open makehuman's save file for the model), you'll get an import which will work a lot better in MPFB. You will then also be able to remove helpers while keeping shape keys. For this to work with non-system assets, you'd need to configure the path to makehuman under the MPFB addon preferences in blender though.

I realize the distinction between these two import paths is impossible to understand for most users. I'll need to think up a way to at least warn about it within the scope of blender's rather limited UI.

At the very least, things should not crash when having picked the "wrong" import path.

joepal1976 avatar Jan 04 '24 13:01 joepal1976

Thanks for the detailed answer. What I do is:

  1. I'm importing a model from MakeHuman via MPFB's MHM import as a preset: изображение
  2. Then I try to remove the helpers without removing the key shapes: изображение And then I get the error described above. To avoid the error I have to delete the keyshapes first, but then I can't export the model with keyshapes.

IvailoBurov avatar Jan 04 '24 15:01 IvailoBurov

That's strange. I do exactly the same thing, but it works for me.

Can you paste the contents of your MHM file here? I don't think it can be attached.

joepal1976 avatar Jan 04 '24 15:01 joepal1976

For both models I get this error: ivWoman.zip Lydia.zip

IvailoBurov avatar Jan 04 '24 16:01 IvailoBurov

Ok, thanks. Yes, I can replicate the error with your MHM files.

I'm on it, but currently have no good theory on what the difference is.

joepal1976 avatar Jan 04 '24 16:01 joepal1976

Ok, the difference between your test case and mine was that I had not used a modifier which affected the helper geometry. The core of the error is that after having deleted the helper geometry, the shape keys are rebuilt. The code did not take into account that the helper geometry might not exist when rebuilding and tried to modify the then no longer existing verts on the helpers.

I've pushed a fix to the blender4 branch. If you don't want to wait for the next nightly build, you can download the changed file and use it to overwrite to corresponding file in your addons directory: https://github.com/makehumancommunity/mpfb2/blob/blender4/src/mpfb/services/targetservice.py (click the three dots in the upper right corner to download the raw file). Otherwise it will be in the blender4 build tomorrow.

I have not updated the blender 3.6 branch yet. I'll want to see if this has unintended side effects before porting the fix.

joepal1976 avatar Jan 04 '24 17:01 joepal1976

Thanks, great job! Now the problem is fixed, and it was an obstacle even when importing Mixamo animations. I close the issue.

IvailoBurov avatar Jan 04 '24 17:01 IvailoBurov

Just to remind you that the problem still exists in Blender 3.6 version.

IvailoBurov avatar Jan 08 '24 03:01 IvailoBurov

As the blender4 branch has been merged into master, this can be closed.

joepal1976 avatar May 07 '24 05:05 joepal1976