There seem nothing that could help the script able to set an action to the armature from different actions.
I did a round about way but I end up breaking up the other objects that has the animations in their actions. Trying to deal with the exporting a object with the animation. There was something like this before in the 2.49b.
Here the code. Blender 2.50
import bpy
import mathutils
import operator
class VIEW3D_PT_ASLT(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_label = "ASLT"
def poll(self, context):
return context.active_object
def draw(self, context):
layout = self.layout
#layout.label(text="Unreal Tools")
rd = context.scene
layout.operator("object.BASLT")
class OBJECT_OT_BASLT(bpy.types.Operator):
global exportmessage
bl_idname = "OBJECT_OT_BASLT"
bl_label = "BASLT"
__doc__ = ""
def invoke(self, context, event):
print("Init Export Script:")
for action in bpy.data.actions:#list of the actions
for obj in bpy.data.objects:#list current object in the scene
if obj.name == "Armature":#if Amature name is found execute
print("Current:",(obj.animation_data.action.name))#get current action name from armature object.
obj.animation_data.action = action #set armature animation to action current loop in the list
print("set action:",(obj.animation_data.action.name))#see what we set for the action
break
#print(dir(bpy.data))
return{'FINISHED'}
def register():
bpy.types.register(VIEW3D_PT_ASLT)
bpy.types.register(OBJECT_OT_BASLT)
def unregister():
bpy.types.unregister(VIEW3D_PT_ASLT)
bpy.types.unregister(OBJECT_OT_BASLT)
if __name__ == "__main__":
register()
It part of the code I tested. Not sure there a correctly way to set the action in the scene when it ready export. Any ideas?