MB-Lab
MB-Lab copied to clipboard
Loading poses deletes keyframes and loads pose incorrectly
Describe the bug I want to use Blender to create video material from several angles. This video material is supposed to show human characters switching poses, which are held for a few frames, and I want to create these videos like so:
- create pose
- set it as keyframe for several frames
- jump ahead some frames
- create next pose
- set it as keyframe for several frames
- jump ahead some frames
- create next pose
- etc.
While posing the character(s) works, loading a pose from a .json file will:
- delete keyframes
- fail to reproduce the original pose
To Reproduce Tested on Windows 10, Blender 4.1.0 and MB-Lab 1.8.0; these steps reproduce both problems on my end:
- open Blender
- pick MB-Lab from the sidebar
- create any character, leaving the settings at default
- I tested this with
Afro female (F_AF01) (AGPL3)
andCaucasian male (M_CA01) (AGPL3)
, will most likely work with any character, I think
- I tested this with
- toggle off the option
Save Images and backup character
- finalizing the character with this left toggled on a) leads to the error described in #405 and b) doesn't actually finalize the character; instead, it leaves an
xyz_skeleton
object in the Outliner
- finalizing the character with this left toggled on a) leads to the error described in #405 and b) doesn't actually finalize the character; instead, it leaves an
- click
Finalize
- select the
MBlab_sk1713274885.0335867
character in the Outliner - switch to
Pose Mode
- optional: select all bones via the
A
key
- optional: select all bones via the
- add keyframe to the Timeline via the
I
key - click
Save Pose
and save the pose to an arbitrary .json file - click
Load Pose
and load the pose from the .json file
The character will now lean forwards a bit and the Timeline will contain 0 keyframes.
Expected behavior That the MB-Lab character takes the pose that was saved in the .json file, without changes to the Timeline.
Screenshots -
Additional context, Problem Nr. 1 - deletion of keyframes My knee-jerk reaction to this problem was to say:
- well alright, the problem occurs when I load the pose
- the button says "Load pose", so somewhere in the code has to be
"Load pose"
or'Load pose'
- looked that up and it lead to the
LoadPose
class in__init__.py
- this lead to the
load_pose
function inanimationengine.py
Line 1349 of animationengine.py
is: self.clear_animation(target_armature)
, so I'll just comment that line and done, right? Well not really, because while commenting that line no longer deletes all keyframes when loading a pose, it also adds this pose as keyframe for ~250 frames.
Additional context, Problem Nr. 2 - loading a pose creates the incorrect pose
Actually, you don't even need to pose the character in the first place, it's enough to take the default character, save it's default pose and load it. On loading this pose, the character will lean forwards a bit, with different characters seemingly leaning forward to different extents. e.g. during testing, I found that the Afro female (F_AF01) (AGPL3)
character leans forwards less than the Caucasian male (M_CA01) (AGPL3)
character.
On top of that, "actual poses" like e.g. a "finger pistol" gesture will sometimes get applied incorrectly when loaded from a .json file; however, I don't seem to be able to reproduce this reliably. Still, this .json file below was saved from one of these "finger pistol" gestures, but when loading the pose, the middle02_R
and pinky02_R
bones don't get rotated correctly. Note that this pose requires "Humanoid Rotations" to be toggled on.
Additionally, just before submitting this issue, I realized that the finger positions are incorrect when loaded with the Caucasian male (M_CA01) (AGPL3)
character, but with the Afro female (F_AF01) (AGPL3)
character, they're correct:
.json file that should contain transformations for a "finger pistol" gesture
{ "root": [1.0, 0.0, 0.0, 0.0], "pelvis": [1.0, 0.0, 0.0, 0.0], "thigh_R": [1.0, 0.0, 0.0, 0.0], "calf_R": [1.0, 0.0, 0.0, 0.0], "foot_R": [1.0, 0.0, 0.0, 0.0], "toes_R": [1.0, 0.0, 0.0, 0.0], "calf_twist_R": [1.0, 0.0, 0.0, 0.0], "thigh_twist_R": [1.0, 0.0, 0.0, 0.0], "thigh_L": [1.0, 0.0, 0.0, 0.0], "calf_L": [1.0, 0.0, 0.0, 0.0], "foot_L": [1.0, 0.0, 0.0, 0.0], "toes_L": [1.0, 0.0, 0.0, 0.0], "calf_twist_L": [1.0, 0.0, 0.0, 0.0], "thigh_twist_L": [1.0, 0.0, 0.0, 0.0], "spine01": [1.0, 0.0, 0.0, 0.0], "spine02": [1.0, 0.0, 0.0, 0.0], "spine03": [1.0, 0.0, 0.0, 0.0], "clavicle_L": [1.0, 0.0, 0.0, 0.0], "upperarm_L": [1.0, 0.0, 0.0, 0.0], "lowerarm_L": [1.0, 0.0, 0.0, 0.0], "hand_L": [1.0, 0.0, 0.0, 0.0], "thumb01_L": [1.0, 0.0, 0.0, 0.0], "thumb02_L": [1.0, 0.0, 0.0, 0.0], "thumb03_L": [1.0, 0.0, 0.0, 0.0], "index00_L": [1.0, 0.0, 0.0, 0.0], "index01_L": [1.0, 0.0, 0.0, 0.0], "index02_L": [1.0, 0.0, 0.0, 0.0], "index03_L": [1.0, 0.0, 0.0, 0.0], "middle00_L": [1.0, 0.0, 0.0, 0.0], "middle01_L": [1.0, 0.0, 0.0, 0.0], "middle02_L": [1.0, 0.0, 0.0, 0.0], "middle03_L": [1.0, 0.0, 0.0, 0.0], "ring00_L": [1.0, 0.0, 0.0, 0.0], "ring01_L": [1.0, 0.0, 0.0, 0.0], "ring02_L": [1.0, 0.0, 0.0, 0.0], "ring03_L": [1.0, 0.0, 0.0, 0.0], "pinky00_L": [1.0, 0.0, 0.0, 0.0], "pinky01_L": [1.0, 0.0, 0.0, 0.0], "pinky02_L": [1.0, 0.0, 0.0, 0.0], "pinky03_L": [1.0, 0.0, 0.0, 0.0], "lowerarm_twist_L": [1.0, 0.0, 0.0, 0.0], "upperarm_twist_L": [1.0, 0.0, 0.0, 0.0], "clavicle_R": [1.0, 0.0, 0.0, 0.0], "upperarm_R": [1.0, 0.0, 0.0, 0.0], "lowerarm_R": [1.0, 0.0, 0.0, 0.0], "hand_R": [1.0, 0.0, 0.0, 0.0], "thumb01_R": [1.0, 0.0, 0.0, 0.0], "thumb02_R": [1.0, 0.0, 0.0, 0.0], "thumb03_R": [1.0, 0.0, 0.0, 0.0], "index00_R": [1.0, 0.0, 0.0, 0.0], "index01_R": [1.0, 0.0, 0.0, 0.0], "index02_R": [1.0, 0.0, 0.0, 0.0], "index03_R": [1.0, 0.0, 0.0, 0.0], "middle00_R": [1.0, 0.0, 0.0, 0.0], "middle01_R": [0.07063079625368118, -0.9937297105789185, 0.0760635957121849, -0.041553087532520294], "middle02_R": [0.030899666249752045, -0.9953107237815857, 0.029087865725159645, -0.08692479133605957], "middle03_R": [0.28058451414108276, -0.9537116885185242, 0.02234797179698944, 0.10586297512054443], "ring00_R": [1.0, 0.0, 0.0, 0.0], "ring01_R": [0.07063073664903641, -0.9956420063972473, 0.03221076726913452, -0.05167892202734947], "ring02_R": [0.030899502336978912, -0.9965260028839111, 0.06928499788045883, -0.03436359763145447], "ring03_R": [0.2801874577999115, -0.9592933058738708, 0.025903552770614624, -0.02409059926867485], "pinky00_R": [1.0, 0.0, 0.0, 0.0], "pinky01_R": [0.07063082605600357, -0.9936221837997437, 0.03891700506210327, -0.07881472259759903], "pinky02_R": [0.030899589881300926, -0.9963005781173706, 0.07540517300367355, -0.02728854864835739], "pinky03_R": [0.2801790237426758, -0.9561894536018372, 0.05400267615914345, -0.06546157598495483], "lowerarm_twist_R": [1.0, 0.0, 0.0, 0.0], "upperarm_twist_R": [1.0, 0.0, 0.0, 0.0], "neck": [1.0, 0.0, 0.0, 0.0], "head": [1.0, 0.0, 0.0, 0.0], "breast_L": [1.0, 0.0, 0.0, 0.0], "breast_R": [1.0, 0.0, 0.0, 0.0] }
I have looked into this and yes you are correct that the way things are programmed that using the MB-Lab pose system completely erase the keyframes in the method you are trying to achieve. I am not sure Manuel's intent on programming it this way, even with all the modifications we've done that is something nobody has touched.
I will try to see what I can do but no promises.
As for the incorrect poses, that is something I have noticed as well in the past. I am not sure where the translation is getting messed up.