@@ -360,7 +360,7 @@ for uobject in ue.get_selected_assets():
360360 elif uobject.is_a(AnimSequence):
361361 root_motion_fixer.split_hips(uobject)
362362 else :
363- raise DialogException(' Only Skeletal Meshes and Skeletons are supported' )
363+ raise DialogException(' Only Skeletal Meshes and Anim Sequences are supported' )
364364```
365365
366366Select an animation from the content browser and run the script.
@@ -380,22 +380,34 @@ class RootMotionFixer:
380380
381381 ...
382382 def run_tasks (self , selected_assets ):
383+ # asset_data is an FAssetData instance.It is not a UObject !
383384 for asset_data in selected_assets:
384385 if asset_data.asset_class == ' SkeletalMesh' :
385386 self .add_root_to_skeleton(asset_data.get_asset())
386387 elif asset_data.asset_class == ' AnimSequence' :
387388 self .split_hips(asset_data.get_asset())
388389 else :
389- raise DialogException(' Only Skeletal Meshes are supported' )
390+ raise DialogException(' Only Skeletal Meshes and Anim Sequences are supported' )
390391
391392 def __call__ (self , menu , selected_assets ):
392393 menu.begin_section(' mixamo' , ' mixamo' )
393394 menu.add_menu_entry(' fix root motion' , ' fix root motion' , self .run_tasks, selected_assets)
394395 menu.end_section()
395-
396+
397+
396398# add a context menu
397399ue.add_asset_view_context_menu_extension(RootMotionFixer())
398400ue.log(' Mixamo Root Motion Fixer registered' )
399401```
400402
403+ (remember to remove the ue.get_selected_assets() loop and the RootMotionFixer() instance from the previous code !)
404+
405+ The ` __call__ ` method will be called whenever the user right-click the asset in the content browser and will generate the menu
406+
407+ To automatically register the mixamo module at editor startup, just import it in /Game/Scripts/ue_site.py (create it if it does not exist):
408+
409+ ``` python
410+ import mixamo
411+ ```
412+
401413## Final Notes
0 commit comments