Skip to content

Commit ba19972

Browse files
Tarcontarfeliwir
authored andcommitted
fixed tests for Blender 4.2
1 parent 1c3bf35 commit ba19972

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: [ ubuntu-latest ]
1616
strategy:
1717
matrix:
18-
blender-version: [ '2.93', '3.6', '4.0' ]
18+
blender-version: [ '2.93', '3.6', '4.0', '4.2' ]
1919
include:
2020
- blender-version: '2.93'
2121
blender-version-suffix: '13'
@@ -26,6 +26,9 @@ jobs:
2626
- blender-version: '4.0'
2727
blender-version-suffix: '0'
2828
python-version: '3.10.9'
29+
- blender-version: '4.2'
30+
blender-version-suffix: '0'
31+
python-version: '3.10.9'
2932

3033
steps:
3134
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Version History
22

3+
## v0.7.2 (28.09.24)
4+
* adapt to API changes in Blender 4.2+
5+
36
## v0.7.1 (29.01.24)
47
* adapt to API changes in Blender 4.0+
58

io_mesh_w3d/common/utils/mesh_import.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def create_mesh(context, mesh_struct, coll):
2323
context.warning("Mesh name automatically fixed due to duplication, new name: " + actual_mesh_name)
2424

2525
mesh.normals_split_custom_set_from_vertices(mesh_struct.normals)
26-
mesh.use_auto_smooth = True
26+
if bpy.app.version < (4, 2, 0):
27+
mesh.use_auto_smooth = True
2728

2829
mesh.object_type = 'MESH'
2930
mesh.userText = mesh_struct.user_text

tests/common/cases/test_utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,14 +701,22 @@ def test_roundtrip_only_needed_keyframes(self):
701701
self.filepath = self.outpath() + 'output'
702702
create_data(self, [], None, hierarchy, [], None, animation)
703703

704+
time_codes = [TimeCodedDatum(time_code=0, value=3.0),
705+
TimeCodedDatum(time_code=4, value=3.0)]
706+
707+
if bpy.app.version >= (4, 2, 0):
708+
time_codes = [TimeCodedDatum(time_code=0, value=3.0)]
709+
704710
channel = TimeCodedAnimationChannel(
705-
num_time_codes=2,
711+
num_time_codes=len(time_codes),
706712
vector_len=1,
707713
pivot=1,
708714
type=1,
709-
time_codes=[TimeCodedDatum(time_code=0, value=3.0),
710-
TimeCodedDatum(time_code=4, value=3.0)])
715+
time_codes=time_codes)
716+
717+
# animation.time_coded_channels = [channel, channel_q]
711718

719+
# if bpy.app.version >= (4, 2, 0):
712720
animation.time_coded_channels = [channel, channel_q]
713721

714722
self.compare_data([], None, None, [], None, animation)

tests/common/helpers/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def compare_animation_channels(self, expected, actual):
6363

6464

6565
def get_animation_bit_channel(pivot=0, xml=False):
66-
data = [0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0]
66+
data = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
6767
if xml:
6868
data = [0.0, 1.0, 1.0, 1.0, 0.0, 0.57, 0.33, 1.0, 1.0, 1.0]
6969
return AnimationBitChannel(
@@ -95,7 +95,7 @@ def compare_animation_bit_channels(self, expected, actual):
9595

9696
self.assertEqual(len(expected.data), len(actual.data))
9797
for i, datum in enumerate(expected.data):
98-
self.assertEqual(datum, actual.data[i])
98+
self.assertAlmostEqual(datum, actual.data[i], 4)
9999

100100

101101
def get_animation(hierarchy_name='TestHierarchy', xml=False):

tests/w3d/cases/test_import_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def test_only_needed_keyframe_creation(self):
8888
meshes = [get_mesh(name='MESH_Obj')]
8989

9090
expected_frames = [0, 4]
91+
if bpy.app.version >= (4, 2, 0):
92+
expected_frames = [0]
9193
expected = [3.0, 3.0]
9294

9395
self.filepath = self.outpath() + 'output'

0 commit comments

Comments
 (0)