|
@@ -267,7 +267,8 @@ TEMPLATE_MODEL_ASCII = """\
|
|
|
|
|
|
"skinWeights" : [%(weights)s],
|
|
"skinWeights" : [%(weights)s],
|
|
|
|
|
|
- "animation" : {%(animation)s}
|
|
|
|
|
|
+ "animation" : {%(animation)s},
|
|
|
|
+ "animations" : [%(animations)s]
|
|
"""
|
|
"""
|
|
|
|
|
|
TEMPLATE_VERTEX = "%g,%g,%g"
|
|
TEMPLATE_VERTEX = "%g,%g,%g"
|
|
@@ -845,14 +846,14 @@ def generate_indices_and_weights(meshes, option_skinning):
|
|
# (only the first action will exported)
|
|
# (only the first action will exported)
|
|
# ##############################################################################
|
|
# ##############################################################################
|
|
|
|
|
|
-def generate_animation(option_animation_skeletal, option_frame_step, flipyz):
|
|
|
|
|
|
+def generate_animation(option_animation_skeletal, option_frame_step, flipyz, action_index):
|
|
|
|
|
|
- if not option_animation_skeletal or len(bpy.data.actions) == 0:
|
|
|
|
|
|
+ if not option_animation_skeletal or len(bpy.data.actions) == 0 or len(bpy.data.actions) == 0:
|
|
return ""
|
|
return ""
|
|
|
|
|
|
# TODO: Add scaling influences
|
|
# TODO: Add scaling influences
|
|
|
|
|
|
- action = bpy.data.actions[0]
|
|
|
|
|
|
+ action = bpy.data.actions[action_index]
|
|
armature, armatureObject = get_armature()
|
|
armature, armatureObject = get_armature()
|
|
if armature is None or armatureObject is None:
|
|
if armature is None or armatureObject is None:
|
|
return "", 0
|
|
return "", 0
|
|
@@ -932,6 +933,15 @@ def generate_animation(option_animation_skeletal, option_frame_step, flipyz):
|
|
|
|
|
|
return animation_string
|
|
return animation_string
|
|
|
|
|
|
|
|
+def generate_all_animations(option_animation_skeletal, option_frame_step, flipyz, option_all_animations):
|
|
|
|
+ all_animations_string = ""
|
|
|
|
+ if option_all_animations:
|
|
|
|
+ for index in range(0, len(bpy.data.actions)):
|
|
|
|
+ if index != 0 :
|
|
|
|
+ all_animations_string += ", \n"
|
|
|
|
+ all_animations_string += "{" + generate_animation(option_animation_skeletal, option_frame_step, flipyz, index) + "}"
|
|
|
|
+ return all_animations_string
|
|
|
|
+
|
|
def handle_position_channel(channel, frame, position):
|
|
def handle_position_channel(channel, frame, position):
|
|
|
|
|
|
change = False
|
|
change = False
|
|
@@ -1290,6 +1300,7 @@ def generate_ascii_model(meshes, morphs,
|
|
filepath,
|
|
filepath,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step):
|
|
option_frame_step):
|
|
|
|
|
|
vertices = []
|
|
vertices = []
|
|
@@ -1390,7 +1401,8 @@ def generate_ascii_model(meshes, morphs,
|
|
"bones" : bones_string,
|
|
"bones" : bones_string,
|
|
"indices" : indices_string,
|
|
"indices" : indices_string,
|
|
"weights" : weights_string,
|
|
"weights" : weights_string,
|
|
- "animation" : generate_animation(option_animation_skeletal, option_frame_step, flipyz)
|
|
|
|
|
|
+ "animation" : generate_animation(option_animation_skeletal, option_frame_step, flipyz, 0),
|
|
|
|
+ "animations" : generate_all_animations(option_animation_skeletal, option_frame_step, flipyz, option_all_animations)
|
|
}
|
|
}
|
|
|
|
|
|
text = TEMPLATE_FILE_ASCII % {
|
|
text = TEMPLATE_FILE_ASCII % {
|
|
@@ -1473,6 +1485,7 @@ def generate_mesh_string(objects, scene,
|
|
filepath,
|
|
filepath,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step):
|
|
option_frame_step):
|
|
|
|
|
|
meshes = extract_meshes(objects, scene, export_single_model, option_scale, flipyz)
|
|
meshes = extract_meshes(objects, scene, export_single_model, option_scale, flipyz)
|
|
@@ -1537,6 +1550,7 @@ def generate_mesh_string(objects, scene,
|
|
filepath,
|
|
filepath,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step)
|
|
option_frame_step)
|
|
|
|
|
|
# remove temp meshes
|
|
# remove temp meshes
|
|
@@ -1564,6 +1578,7 @@ def export_mesh(objects,
|
|
option_copy_textures,
|
|
option_copy_textures,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step):
|
|
option_frame_step):
|
|
|
|
|
|
"""Export single mesh"""
|
|
"""Export single mesh"""
|
|
@@ -1587,6 +1602,7 @@ def export_mesh(objects,
|
|
filepath,
|
|
filepath,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step)
|
|
option_frame_step)
|
|
|
|
|
|
write_file(filepath, text)
|
|
write_file(filepath, text)
|
|
@@ -2323,6 +2339,7 @@ def save(operator, context, filepath = "",
|
|
option_copy_textures = False,
|
|
option_copy_textures = False,
|
|
option_animation_morph = False,
|
|
option_animation_morph = False,
|
|
option_animation_skeletal = False,
|
|
option_animation_skeletal = False,
|
|
|
|
+ option_all_animations = False,
|
|
option_frame_step = 1,
|
|
option_frame_step = 1,
|
|
option_all_meshes = True):
|
|
option_all_meshes = True):
|
|
|
|
|
|
@@ -2446,6 +2463,7 @@ def save(operator, context, filepath = "",
|
|
option_copy_textures,
|
|
option_copy_textures,
|
|
option_animation_morph,
|
|
option_animation_morph,
|
|
option_animation_skeletal,
|
|
option_animation_skeletal,
|
|
|
|
+ option_all_animations,
|
|
option_frame_step)
|
|
option_frame_step)
|
|
|
|
|
|
return {'FINISHED'}
|
|
return {'FINISHED'}
|