Skip to content

Commit

Permalink
Closes #588, regression of forgetting len > 1 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tngreene committed Sep 9, 2020
1 parent ce1af69 commit d3ad30a
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
2 changes: 1 addition & 1 deletion io_xplane2blender/xplane_types/xplane_bone.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def collectAnimations(self)->None:
# - Ted, 6/24/2020
return
else:
if fcurve.keyframe_points:
if len(fcurve.keyframe_points) > 1:
if bone:
self.datarefs[dataref] = bone.xplane.datarefs[index]
else:
Expand Down
82 changes: 82 additions & 0 deletions tests/animation/fixtures/test_kf_points_1_ignored_2_used.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
I
800
OBJ

POINT_COUNTS 36 0 0 36

VT -1 0.99999994 0.99999994 0 1 -0 0.625 0.25 # 0
VT -1 0.99999994 -0.99999994 0 1 -0 0.625 0 # 1
VT 1 0.99999994 -0.99999994 0 1 -0 0.375 0 # 2
VT 1 0.99999994 0.99999994 0 1 0 0.375 0.25 # 3
VT -1 0.99999994 0.99999994 0 1 0 0.625 0.25 # 4
VT 1 0.99999994 -0.99999994 0 1 0 0.375 0 # 5
VT -1 0.99999994 0.99999994 0 0 1 0.625 0.5 # 6
VT 1 0.99999994 0.99999994 0 0 1 0.625 0.25 # 7
VT 1 -0.99999994 0.99999994 0 0 1 0.375 0.25 # 8
VT -1 -0.99999994 0.99999994 0 0 1 0.375 0.5 # 9
VT -1 0.99999994 0.99999994 0 0 1 0.625 0.5 # 10
VT 1 -0.99999994 0.99999994 0 0 1 0.375 0.25 # 11
VT -1 0.99999994 -0.99999994 -1 -0 0 0.625 0.75 # 12
VT -1 0.99999994 0.99999994 -1 -0 0 0.625 0.5 # 13
VT -1 -0.99999994 0.99999994 -1 -0 0 0.375 0.5 # 14
VT -1 -0.99999994 -0.99999994 -1 0 0 0.375 0.75 # 15
VT -1 0.99999994 -0.99999994 -1 0 0 0.625 0.75 # 16
VT -1 -0.99999994 0.99999994 -1 0 0 0.375 0.5 # 17
VT 1 -0.99999994 0.99999994 0 -1 -0 0.625 1 # 18
VT 1 -0.99999994 -0.99999994 0 -1 -0 0.625 0.75 # 19
VT -1 -0.99999994 -0.99999994 0 -1 -0 0.375 0.75 # 20
VT -1 -0.99999994 0.99999994 0 -1 -0 0.375 1 # 21
VT 1 -0.99999994 0.99999994 0 -1 -0 0.625 1 # 22
VT -1 -0.99999994 -0.99999994 0 -1 -0 0.375 0.75 # 23
VT 1 0.99999994 0.99999994 1 0 0 0.375 0.75 # 24
VT 1 0.99999994 -0.99999994 1 0 0 0.375 0.5 # 25
VT 1 -0.99999994 -0.99999994 1 0 0 0.125 0.5 # 26
VT 1 -0.99999994 0.99999994 1 0 0 0.125 0.75 # 27
VT 1 0.99999994 0.99999994 1 0 0 0.375 0.75 # 28
VT 1 -0.99999994 -0.99999994 1 0 0 0.125 0.5 # 29
VT 1 0.99999994 -0.99999994 0 0 -1 0.875 0.75 # 30
VT -1 0.99999994 -0.99999994 0 0 -1 0.875 0.5 # 31
VT -1 -0.99999994 -0.99999994 0 0 -1 0.625 0.5 # 32
VT 1 -0.99999994 -0.99999994 0 -0 -1 0.625 0.75 # 33
VT 1 0.99999994 -0.99999994 0 -0 -1 0.875 0.75 # 34
VT -1 -0.99999994 -0.99999994 0 -0 -1 0.625 0.5 # 35

IDX10 0 1 2 3 4 5 6 7 8 9
IDX10 10 11 12 13 14 15 16 17 18 19
IDX10 20 21 22 23 24 25 26 27 28 29
IDX 30
IDX 31
IDX 32
IDX 33
IDX 34
IDX 35

# 0 ROOT
# 1 Armature: Armature
# ARMATURE: Armature weight: 0
# 2 Bone: Bone
ANIM_begin
# static rotation
ANIM_rotate 1 0 0 90.00021 90.00021
# rotation keyframes
ANIM_rotate_begin 0.81882817 0.36166486 -0.44577917 2_keyframes_use_me
ANIM_rotate_key 0 30.000008
ANIM_rotate_key 1 0
ANIM_rotate_end
# 3 Mesh: Cube
ANIM_begin
# static rotation
ANIM_rotate 1 0 0 -90.00021 -90.00021
# translation keyframes
ANIM_trans_begin 2_keyframes_use_me
ANIM_trans_key 0 0 0 -0
ANIM_trans_key 1 0.24247 2.1765299 -3.2317098
ANIM_trans_end
# MESH: Cube weight: 0
# MATERIAL: Material
ATTR_shiny_rat 0.5
TRIS 0 36
ANIM_end
ANIM_end

# Build with Blender 2.80 (sub 75) (build b'f6cb5f54494e'). Exported with XPlane2Blender 4.0.0-dev.0+89.NO_BUILD_NUMBR
Binary file not shown.
25 changes: 25 additions & 0 deletions tests/animation/one_kf_point_fcurve_ignored.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import inspect

from typing import Tuple
import os
import sys

import bpy
from io_xplane2blender import xplane_config
from io_xplane2blender.tests import *
from io_xplane2blender.tests import test_creation_helpers

__dirname__ = os.path.dirname(__file__)

class OneKFPointFCurveIgnored(XPlaneTestCase):
def test_kf_points_1_ignored_2_used(self)->None:
filename = inspect.stack()[0].function

self.assertExportableRootExportEqualsFixture(
filename[5:],
os.path.join(__dirname__, "fixtures", f"{filename}.obj"),
{"ANIM"},
filename,
)

runTestCases([OneKFPointFCurveIgnored])

0 comments on commit d3ad30a

Please sign in to comment.