makehumancommunity/makehuman-plugin-for-blender

Crash during import after delete with MakeTarget settings

Hunanbean opened this issue · 8 comments

If you import a model using MPFB and the MakeTarget settings, then fully delete everything you imported (select all, delete) and attempt to import again with the same settings without restarting Blender, Blender crashes. tested with 2.83lts and 2.90 release.

Steps to reproduce:
Open Blender
Load the MakeTarget settings in the import options of MPFB
Import from MakeHuman
Select all and 'delete' (in Blender)
Click Import again
Blender will hard crash at this point

Thank you, and be well

I also can reproduce the problem (using 2.90). Getting an application crash is really bad and I could not find a suitable debugging info. That's definitely high priority.
Notice the issue does not appear with the Default and MakeClothes settings.

and I needed to install a version newer than 2.82 ... yes I am lazy :)
... but now I got the same problem as well. That means that sth. changed inbetween.

"Select all"? well as a minimum I needed to select the humanbody

with an empty collection (only humanbody deleted):

  1. one time it does not crash but an invisible human without faces was created (?!)
  2. one time it also crashed

with collection selected it always crashed.

It looks like it crashes somewhere really internal (when it should write to a GPU buffer), function is here:
https://github.com/blender/blender/blob/master/source/blender/gpu/intern/gpu_index_buffer.cc

the BLI_assert(..) lines are special code used for debugging and are normally not part of a running version.
So either we have same values, no values or a buffer overflow. I know that does not help :(

Only idea I have: doing a print after each step and watch, what is the last working command. That's the way I use, when I debug C source which crashes the same way (memory faults). Then analyse the command after the last working print. The reason could be simple but normally these problems are more complicated than a python stack trace.

I did not find it but in my version it also does crash with makeclothes settings.

I did this change and after it, the system will not crash at least

def _getCleanMcMtSettings():
    settings = _defaultSettings.copy()
    settings["MhScaleMode"] = "DECIMETER"
    settings["MhDetailedHelpers"] = True
#    settings["MhAddSimpleMaterials"] = True   <<<<<<<<
    settings["MhAdjustPosition"] = False
    settings["MhEnhancedSkin"] = False
    settings["MhEnhancedSSS"] = False
    return settings

(in mh_sync/presets.py)

Before I forget: when you test, delete .config/blender/2.90/makehuman.* before, otherwise this code will not be used ...

In some way the second material assignment does create the problem. Maybe that helps for further debugging

I found a solution and did a hotfix which makes the program more secure. But please check, if the missing groups should be there

The reason was: a vertex-group index of -1 or material index of -1 causes this hiccup :)

Thanks for debugging and providing a bug fix. This was an error in my own code :(. I did some further corrections and added a debug mode. I think the problem should fixed, but leaving the issue still open for further testing.

Thank you all for the quick reponses.
I have applied all the suggested fixes and still have the crash.
in finality, I re-installed with a nightly build of MakeHuman, the MPFB from a week ago, clearing all previous settings beforehand. Unfortunately, i still get the same crash.
but i am under the impression that after

This was an error in my own code :(. I did some further corrections and added a debug mode. I think the problem should fixed

I do not need to apply
"# settings["MhAddSimpleMaterials"] = True"
But i will go back and try this again.

Ok, perhaps i was confused as to what code was changed by Aranuvir.
Applying the "# settings["MhAddSimpleMaterials"] = True" from black-punkduck still stops the crash. I do not know what else is being changed on your teams end.

Thanks a bunch! i think i can get back to work for now

I can't say if the changes made it into latest builds of MH. Perhaps you can get the code directly from GitHub for retesting.

to be honest, i would probably create so many problems that are a result of my lack of knowledge when trying to run from straight source code, that i would end up confusing things. atleast until i understand more, it may be best for me to wait for integration to retest