animate1978 / MB-Lab

MB-Lab is a character creation tool for Blender 4.0 and above, based off ManuelBastioniLAB
Other
1.86k stars 314 forks source link

BVH animation import bug #120

Closed animate1978 closed 5 years ago

animate1978 commented 5 years ago

Describe the bug

When loading a BVH animation into MB-Lab it causes an error AND creates a new HUGE rig in the world.

To Reproduce Steps to reproduce the behavior:

Create a new FINALIZED character Load BVH animation

Expected behavior

The above NOT to happen

Screenshots

bvh_error_bigrig_01

Additional context Add any other context about the problem here.

Logs

Info: Total files 9 | Changed 9 | Failed 0
        parsing bvh 'C:\\Users\\farishta\\Documents\\07_05.bvh'...      zero len
gth node found: Hips
0.2700
        importing to blender... zero length bone found: Chest2
        zero length bone found: LeftWrist
        zero length bone found: RightWrist
Done in 0.8100

All retarget methods failed for RBREAST.
All retarget methods failed for LBREAST.
The chain ['RThumb'] of mocap file has less bones than the chain in the lab
All retarget methods failed for RTHUMB02.
The chain ['RThumb'] of mocap file has less bones than the chain in the lab
All retarget methods failed for RTHUMB01.
The chain ['LThumb'] of mocap file has less bones than the chain in the lab
All retarget methods failed for LTHUMB02.
The chain ['LThumb'] of mocap file has less bones than the chain in the lab
All retarget methods failed for LTHUMB01.
All retarget methods failed for RUPPERARM_TWIST.
All retarget methods failed for LUPPERARM_TWIST.
All retarget methods failed for RFOREARM_TWIST.
All retarget methods failed for LFOREARM_TWIST.
All retarget methods failed for RUPPERLEG_TWIST.
All retarget methods failed for LUPPERLEG_TWIST.
All retarget methods failed for RCALF_TWIST.
All retarget methods failed for LCALF_TWIST.
Traceback (most recent call last):
  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\__init__.py", line 1741, in execute
    mblab_retarget.load_animation(self.filepath)
  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\animationengine.py", line 1359, in load_animation
    self.retarget(target_armature, source_armature, True)
  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\animationengine.py", line 1385, in retarget
    self.align_skeleton(target_armature, source_armature)
  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\animationengine.py", line 1110, in align_skeleton
    self.calculate_skeleton_rotations(target_armat, source_armat, "ALIGN_SPINE")

  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\animationengine.py", line 1125, in calculate_skeleton_rotations
    self.rotate_skeleton(source_armat, rot)
  File "C:\Users\farishta\AppData\Roaming\Blender Foundation\Blender\2.80\script
s\addons\MB-Lab\animationengine.py", line 1136, in rotate_skeleton
    bpy.context.scene.update()
AttributeError: 'Scene' object has no attribute 'update'

location: <unknown location>:-1

location: <unknown location>:-1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'label'
NumesSanguis commented 5 years ago

Can you upload the BVH file that creates this error somewhere, so that people can recreate this error?

animate1978 commented 5 years ago

I am just using BVH files from here - https://github.com/blaisefaint/CMU-Mo-Cap-Pose-Library

ophiocus commented 5 years ago

The huge rig in the world happens when MB-Lab aborts the bvh import, the steps bvh takes are

Currently its it failing at 'Scene' object has no attribute 'update' But that s not the end of the story, mb-labs seems to be missing bones and complaining about that so this fail is actually while its trying to roll back the import attempt. looking around there is an API update to scene, which became view_layer So that s why you are seeing the Goliath bvh, that s what normally happens when importing bvh files

??? scene.update -bpy.context.scene.update() +bpy.context.view_layer.update()

(taken from here ) Mixamo files turned into BVH import just fine.

I am going to try to see if i can find the occurrences of where scene.update is used in the MB-Lab code

ophiocus commented 5 years ago

The repo you are pointing to only has blender files?

The files he is working with (which are imported wrong imho) are originally found here

From that zip I will try to import 07_05.bvh

Working with the original files I cant replicate your error

animate1978 commented 5 years ago

Figured out we have to zip files to share, this is 07_05.bvh

07_05.zip

animate1978 commented 5 years ago

Also just found this out, which I think relates to this bug as well.

https://github.com/CGCookie/blender-addon-updater/issues/53#issuecomment-496014075

In this comment it is mentioned that Blender has replaced the scene update handler with other options, like dependency graph refreshes or explicit timers, so since this breaks at bpy.context.scene.update() this makes sense.

Problem is I don't know what to do to fix this

animate1978 commented 5 years ago

HA!!!!!!!!!

I fixed it!

Went to that link https://blenderartists.org/t/2-80-cheat-sheet-for-updating-add-ons/1148974

Replaced bpy.context.scene.update() with bpy.context.view_layer.update()

Committing the code now