@@ -157,20 +157,28 @@ def __init__(
157157
158158 # First convert the relative joint angles to global joint angles in rotation matrix form.
159159 if self .smpl_layer .model_type != "flame" :
160- global_oris = local_to_global (
161- torch .cat ([self .poses_root , self .poses_body ], dim = - 1 ),
162- self .skeleton [:, 0 ],
163- output_format = "rotmat" ,
164- )
160+ if self .smpl_layer .model_type != "mano" :
161+ global_oris = local_to_global (
162+ torch .cat ([self .poses_root , self .poses_body , self .poses_left_hand , self .poses_right_hand ], dim = - 1 ),
163+ self .skeleton [:, 0 ],
164+ output_format = "rotmat" ,
165+ )
166+ else :
167+ global_oris = local_to_global (
168+ torch .cat ([self .poses_root , self .poses_body ], dim = - 1 ),
169+ self .skeleton [:, 0 ],
170+ output_format = "rotmat" ,
171+ )
165172 global_oris = c2c (global_oris .reshape ((self .n_frames , - 1 , 3 , 3 )))
166173 else :
167174 global_oris = np .tile (np .eye (3 ), self .joints .shape [:- 1 ])[np .newaxis ]
168175
169176 if self ._z_up and not C .z_up :
170177 self .rotation = np .matmul (np .array ([[1 , 0 , 0 ], [0 , 0 , 1 ], [0 , - 1 , 0 ]]), self .rotation )
171178
172- self .rbs = RigidBodies (self .joints , global_oris , length = 0.1 , gui_affine = False , name = "Joint Angles" )
173- self ._add_node (self .rbs , enabled = self ._show_joint_angles )
179+ if self .smpl_layer .model_type != "mano" :
180+ self .rbs = RigidBodies (self .joints , global_oris , length = 0.1 , gui_affine = False , name = "Joint Angles" )
181+ self ._add_node (self .rbs , enabled = self ._show_joint_angles )
174182
175183 self .mesh_seq = Meshes (
176184 self .vertices ,
@@ -397,20 +405,33 @@ def fk(self, current_frame_only=False):
397405 trans = self .trans
398406 betas = self .betas
399407
400- verts , joints = self .smpl_layer (
401- poses_root = poses_root ,
402- poses_body = poses_body ,
403- poses_left_hand = poses_left_hand ,
404- poses_right_hand = poses_right_hand ,
405- betas = betas ,
406- trans = trans ,
407- )
408+ if self .smpl_layer .model_type == "mano" :
409+ verts , joints = self .smpl_layer (
410+ hand_pose = poses_body ,
411+ betas = betas ,
412+ global_orient = poses_root ,
413+ trans = trans ,
414+ mano = True ,
415+ )
416+ else :
417+ verts , joints = self .smpl_layer (
418+ poses_root = poses_root ,
419+ poses_body = poses_body ,
420+ poses_left_hand = poses_left_hand ,
421+ poses_right_hand = poses_right_hand ,
422+ betas = betas ,
423+ trans = trans ,
424+ )
408425
409426 # Apply post_fk_func if specified.
410427 if self .post_fk_func :
411428 verts , joints = self .post_fk_func (self , verts , joints , current_frame_only )
412429
413- skeleton = self .smpl_layer .skeletons ()["body" ].T
430+ skeleton = (
431+ self .smpl_layer .skeletons ()["body" ].T
432+ if not self .smpl_layer .model_type == "mano"
433+ else self .smpl_layer .skeletons ()["all" ].T
434+ )
414435 faces = self .smpl_layer .bm .faces .astype (np .int64 )
415436 joints = joints [:, : skeleton .shape [0 ]]
416437
0 commit comments