I'm following along with this tutorial and working back and forth between my own project and this project's files. One of the things you did early on was add a separate track to toggle IK to make it consistent across all the other animation actions. I did something similar but with the grip of a sword that just controlled the fingers. The idea is that if I need to adjust the grip I can do that in this one action rather than going through all my animations and updating the grip for each one (the actual finger rotations in a sword animation probably wouldn't change except during certain idle animations because it would have a constant grip).
When exporting I know you went and baked each animation and appended it back into the actual gun files. I was hoping to actually avoid this on my personal project because the sword is not actually a skeletal mesh it's just a static mesh and it seems like it would be a lot of work every time I need to update an animation to go and rebake them. I have a bit of an issue when trying to export because it seems blender can EITHER export each NLA strip as a separate animation OR combine all the strips into a single fbx animstack. The issue here is my actions under the Actions strip do not do anything with the fingers and if I check NLA strips the grip strip will be exported as a standalone animation and noto apply to the other animations so he'll have an open hand on all the other animations .
Is there not a way to have each animation share the grip action but export as (in this case) two animations?
Basically I want to end up with an FBX export that has two animstack's (HeroFP_1HSword_Pullout and HeroFP_1HSword_Idle) that contain animation data for the fingers from the Grip NLA strip.
also, no idea what that orange dotted line is that's in between two frames on HeroFP_1HSword_Pullout?
If you don't have any constraints or other fancy rig features, you definitely don't need to bake! It sounds like you might with the grip though? I'm not entirely clear on what that setup looks like, but it should be easy to test.
As for the separate strips, I actually had to go back and insert keyframes for the IK in each of the strips later on in the course. Ideally it wouldn't be necessary, but I ran into issues with how Blender updates during animation and sometimes it would get confused and freak out if it was evaluated separately.
If you do have two separate actions that you want to combine together while exporting, try turning off NLA Strips and All Actions in the export settings under animation. That will leave you with one long animation, and you can then chop it up in your game editor based on frame numbers.
Hope that helps!
Thank you for your reply. I actually just spent the day finishing up my new workflow which involved a bit of scripting...
Sharing the grip portion of the animation across different animations was scrapped. It would be a nice feature but at the end of the day its not a big deal to just go an update every animation in that way if I need to.
I was pretty keen on having a different animation file for each animation since unreal engine's importer kinda sucks and having multiple animations in a single fbx can cause problems that can only be resolved by deleting everything and starting over.
What I ended up with is a system where I'm using one scene for each animation. Each scene has its own library override of my skeleton rig from another .blend file. This is actually pretty easy to use because if I just make a new scene with the "Full Copy" option it does that all for me automatically.
The big problem I had with this method is that each library override object had to have a different name. So the second animation would be rig.001 and the third would be rig.002. Apparently Unreal's importer freaks out if the rig is not named "rig" so I had to go and write a python script that essentially detects all the rigs that I actually want to export across all my scenes and change their name to 'rig', exports them, and changes their name back to a unique identifier after the export. It's not quite finished yet since the save directory and file name are hard coded but, if you're curious.
import bpy
print('\n\n\nN_GON: RUNNING UNREAL BATCH ANIMATION EXPORT SCRIPT!')
objects = bpy.data.objects
exportList = []
print(objects[0])
#Populate exportList with all objects of type armature that's name begins with "rig"
for obj in objects:
if (obj.type == "ARMATURE"):
if obj.name.lower().startswith("rig"):
#check if the rig is part of a scene. If its not, that's because its the skeleton we're linked to which we dont export
#alternatively, it could be a lingering object that is no longer part of any scene which we also dont export...
if (len(obj.users_scene) > 0):
exportList.append(obj)
#Ensure there is only one armature named rig[...] per scene
sceneList = []
for export in exportList:
sceneList.append(export.users_scene)
if not (len(set(sceneList)) == len(sceneList)):
raise Exception("Multiple Armatures with prefix 'rig' detected per scene. Nothing was exported")
#code from forums to store export parameters from preset to 'op'
presetDirectory = bpy.utils.preset_paths('operator/export_scene.fbx/')
presetPath = presetDirectory[0] + 'UE4_Animation.py'
file = open(presetPath, 'r')
class emptyclass():
__slots__ = ('__dict__',)
op = emptyclass()
for line in file.readlines()[3::]:
exec(line, globals(), locals())
print('N_GON: EXPORTING THE FOLLOWING RIG OBJECTS...')
for export in exportList:
print(export.name)
#export!
activeScene = bpy.context.window.scene
for export in exportList:
bpy.context.window.scene = export.users_scene[0]
export.name = "rig"
op.filepath = 'C:\\Users\\Desktop\\Desktop\\New Folder\\' + 'test' + '_' + export.users_scene[0].name + '.fbx'
kwargs = op.__dict__
bpy.ops.export_scene.fbx(**kwargs)
export.name = "rig_" + export.users_scene[0].name
export.data.name = "rig_" + export.users_scene[0].name
bpy.context.window.scene = activeScene
Anyways, long story short I think I'm fairly happy with the workflow I managed to set up. Sadly it feels like Blender's animation featureset was not designed for gamedev at all but...I guess that's just how it is. I may need to modify my workflow a bit when I have to have certain weapons that have their own skeletal mesh (like a bow that might bend as the string is pulled back), but think I'm good for now.
I still have no idea what that dotted orange line was on my NLA strip. I have not seen it come back in any of my recent files/tests though.