Hardcoded spa1_prop_door amims test
This commit is contained in:
48
addons/io_scene_swbf_msh/msh_anim_gather.py
Normal file
48
addons/io_scene_swbf_msh/msh_anim_gather.py
Normal file
@@ -0,0 +1,48 @@
|
||||
""" Gathers the Blender objects from the current scene and returns them as a list of
|
||||
Model objects. """
|
||||
|
||||
import bpy
|
||||
import math
|
||||
from enum import Enum
|
||||
from typing import List, Set, Dict, Tuple
|
||||
from itertools import zip_longest
|
||||
from .msh_model import *
|
||||
from .msh_model_utilities import *
|
||||
from .msh_utilities import *
|
||||
from .msh_model_gather import *
|
||||
|
||||
|
||||
def gather_animdata(armature: bpy.types.Armature) -> List[Animation]:
|
||||
|
||||
anim_data = Animation();
|
||||
|
||||
action = armature.animation_data.action
|
||||
|
||||
framerange = action.frame_range
|
||||
increment = (framerange.y - framerange.x) / 20.0
|
||||
offset = framerange.x;
|
||||
|
||||
anim_data.bone_transforms[armature.parent.name] = []
|
||||
for bone in armature.data.bones:
|
||||
anim_data.bone_transforms[bone.name] = []
|
||||
|
||||
for frame in range(21):
|
||||
frame_time = offset + frame * increment
|
||||
bpy.context.scene.frame_set(frame_time)
|
||||
|
||||
anim_data.bone_transforms[armature.parent.name].append(ModelTransform()) #for testing
|
||||
|
||||
for bone in armature.pose.bones:
|
||||
xform = ModelTransform()
|
||||
xform.translation = convert_vector_space(bone.location)
|
||||
xform.rotation = convert_rotation_space(bone.rotation_quaternion)
|
||||
|
||||
anim_data.bone_transforms[bone.name].append(xform)
|
||||
|
||||
return [anim_data]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user