While trying to use the "Convert Single" option of the Mixamo Rootbaker addon in Blender to bake root motion from a single existing action in my .blend file (NOT using "Batch Convert"), I kept getting the following message: "Error: 'NoneType' object has no attribute 'frame_range'". However, I want to thank the Lord Jesus Christ for showing me a great solution for this issue, which I will share below, along with some helpful tips to fix another major error you might encounter when baking root motion for export to Unreal Engine!
Prerequisite Step 1:
First, if you are using Blender 3.1 - 3.3 or newer, make sure you are using the NEW fork of Mixamo Converter by "brkeejp" on Github (available here), otherwise the addon will give you a different error message: "NLA_OT_bake.frame_start expected an int type, not float". However, the older Mixamo converter by "enziop" will still work fine up to Blender 3.0.1 only (01-26-2022 release).
Prerequisite Step 2:
(If you are NOT using a dual-rig system, you can ignore Prerequisite Step 2.)
If you are working with a dual rig system (control rig and a game rig as described in CG Dive's YouTube tutorials) keep in mind that Mixamo Rootbaker addon will clear your constraints, which is NOT desirable for this setup.
To avoid this, be sure to do all your root motion conversion in a COPY of your main .blend file. Then you can "Append" the newly created actions later into your main .blend file which still has the constraints active.
Steps to fix:
The 'frame_range' error is caused by trying to bake rootmotion on a NLA strip, instead of a raw Action. First, deselect all NLA strips on your armature from the Non-Linear Animation editor.
Next, open the Dope Sheet and switch to the Action Editor. Click on the "Browse Action to be linked" button (beside the "+ New" button) and select your action containing root motion (if you have lots of Actions, you can start typing its name into the search field to find it quicker).
VERY IMPORTANT: Hit the number shown beside your action's name in the Action Editor to make a single user copy. We do NOT want to override our existing action! Rename this new action to something like "RootMotion-SOURCE".
Now open the Mixamo Rootbaker properties (hit "N" in the 3D view and select the "Mixamo" tab). Deselect "Use Z" and "Transfer Rotation" (unless your particular animation requires this, such as for curved walking or jumping).
Click "Advanced Properties" and if you want to preserve your existing bone names, uncheck "Remove Namespaces". Also uncheck "Fix Bind" and "Apply Rotation". TIP: If the root motion only occurs in one axis (such as moving forward), you can use the "Limit X" or "Limit Y" options to constrain motion to that one axis only.
Now scroll back up and click "Convert Single". After a few seconds your action will be converted to have true root motion. Note that your armature will be renamed to "root" with a small "r".
Now you can "Push Down" that new action to the NLA editor. Compare it to the original animation (before conversion) on a track below it.
BONUS STEPS: You may notice a slight shift in one of the axes, where the armature's location in the new converted action does not match the original. You can verify this by selecting your armature in Object Mode and viewing the Transform properties. If it does not show 0,0,0 for X,Y,Z then an incorrect offset was added. You can fix it like this:
Make sure only the original, non-converted action's NLA strip is active. Now in Object Mode, select your armature, and hit "Alt-G" to clear its location (its Object coordinates were messed up when we toggled on/off the converted action Mixamo Rootbaker created, but it will now reset to 0,0,0 in X,y,Z).
Again, make sure only the original, non-converted action's NLA strip is active. Now enter Pose mode and select the Hips bone, and hit Shift-S > Cursor to Selected. VERY IMPORTANT: Be careful to NOT accidentally move the cursor from this point on, or you will have to go back and redo steps 8 and 9 again.
Now mute that original NLA strip and activate the new "RootMotion-SOURCE" strip.
Finally, click "New" in the Action Editor and name this action something like RootMotion-FIX.
Select the temporary track for this new Action at the top of your NLA editor (it is highlighted in orange). Hit "N" to bring up the properties panel in the NLA editor and in the "Blending" drop-down, select, "Combine".
Now we need to apply a two-fold correction. First, in Object mode, select your armature and hit Alt-G to clear its location. Now hit "I" to insert a keyframe and choose "Location". This fixes the object-level shift.
Next, enter Pose Mode, select the Hips bone and hit Shift-S > Selection to Cursor, and hit "I" to insert a keyframe and choose "Location". This fixes the pose-level shift.
"Push Down" this new Action and make sure the track is above the track containing your converted root motion action (use the Page Down/Up keys to reposition the track).
Since this "RootMotion-FIX" strip is only 1 frame long, in the properties panel, under "Action Clip", set the End to match the end frame of your "RootMotion-SOURCE" strip.
If you toggle the track with this new "RootMotion-FIX" NLA strip on/off, you can see that it appears to shift the origin point while keeping all the bones stationary. (CAUTION: Do not toggle other tracks on/off because you may mess up all the resets you did up to this point and have to start from Step 8 again.) We now want to bake both these actions into ONE action again for exporting to Unreal Engine.
With BOTH the "RootMotion-SOURCE" NLA strip AND the "RootMotion-FIX" NLA strip active in the NLA editor, enter Pose Mode on your armature.
19.Hit "A" to select all bones (it's not necessary to select non-deforming bones unless you have those bones driving custom shapekeys in this particular action). Now hit "F3" to bring up the search field and type "bake". Select "Pose > Animation > Bake Action".
- Make sure your Start and End frames are correct, your Frame Step is 1, and select "Only Selected Bones" and "Visual Keying". Leave everything else unselected. VERY IMPORTANT: Under "Bake Data", select "Pose" and Shift-select "Object" so BOTH are selected. (We need to make sure that "Object" is also selected, otherwise the root motion data (along with our object-level fix) will not transfer to the new baked action). Now press "OK".
- A new action will be created in the Action Editor. Name this new action something like, "RootMotion-EXPORT". "Push Down" this action and compare it to your Original source action. They should now match perfectly in terms of location-- but now you can see the difference between root motion and no root motion! (With root motion, the armature's origin will move WITH the character's motion, but without root motion, the origin will remain at 0,0,0 while the character continues to move beyond it.)
Now with only this new "RootMotion-EXPORT" strip active, you can export it to Unreal Engine using the following recommended Blender to Unreal Engine export settings.
PLEASE NOTE: If the "RootMotion-SOURCE" OR the "RootMotion-FIX" strips are active at any time, they will affect the Object coordinates of your armature, even in unrelated actions. It is very important to double-check that your armature's Object coordinates are at 0,0,0 before attempting to export any other NLA strips to Unreal Engine. (If they're not, just hit Alt-G to clear the armature's location and reset its coordinates to the world origin. It's also probably wise to mute or delete these two pesky NLA strips once you have baked them, so you don't accidentally mess up the origin point of any of your other animations.) I hope this info helps!