Skip to content

Commit

Permalink
fixed tests for Blender 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarcontar committed Sep 27, 2024
1 parent 1c3bf35 commit 0dc90d2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: [ ubuntu-latest ]
strategy:
matrix:
blender-version: [ '2.93', '3.6', '4.0' ]
blender-version: [ '2.93', '3.6', '4.0', '4.2' ]
include:
- blender-version: '2.93'
blender-version-suffix: '13'
Expand All @@ -26,6 +26,9 @@ jobs:
- blender-version: '4.0'
blender-version-suffix: '0'
python-version: '3.10.9'
- blender-version: '4.2'
blender-version-suffix: '0'
python-version: '3.10.9'

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Version History

## v0.7.2 (28.09.24)
* adapt to API changes in Blender 4.2+

## v0.7.1 (29.01.24)
* adapt to API changes in Blender 4.0+

Expand Down
3 changes: 2 additions & 1 deletion io_mesh_w3d/common/utils/mesh_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def create_mesh(context, mesh_struct, coll):
context.warning("Mesh name automatically fixed due to duplication, new name: " + actual_mesh_name)

mesh.normals_split_custom_set_from_vertices(mesh_struct.normals)
mesh.use_auto_smooth = True
if bpy.app.version < (4, 2, 0):
mesh.use_auto_smooth = True

mesh.object_type = 'MESH'
mesh.userText = mesh_struct.user_text
Expand Down
14 changes: 11 additions & 3 deletions tests/common/cases/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,22 @@ def test_roundtrip_only_needed_keyframes(self):
self.filepath = self.outpath() + 'output'
create_data(self, [], None, hierarchy, [], None, animation)

time_codes = [TimeCodedDatum(time_code=0, value=3.0),
TimeCodedDatum(time_code=4, value=3.0)]

if bpy.app.version >= (4, 2, 0):
time_codes = [TimeCodedDatum(time_code=0, value=3.0)]

channel = TimeCodedAnimationChannel(
num_time_codes=2,
num_time_codes=len(time_codes),
vector_len=1,
pivot=1,
type=1,
time_codes=[TimeCodedDatum(time_code=0, value=3.0),
TimeCodedDatum(time_code=4, value=3.0)])
time_codes=time_codes)

# animation.time_coded_channels = [channel, channel_q]

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

self.compare_data([], None, None, [], None, animation)
Expand Down
4 changes: 2 additions & 2 deletions tests/common/helpers/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def compare_animation_channels(self, expected, actual):


def get_animation_bit_channel(pivot=0, xml=False):
data = [0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0]
data = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
if xml:
data = [0.0, 1.0, 1.0, 1.0, 0.0, 0.57, 0.33, 1.0, 1.0, 1.0]
return AnimationBitChannel(
Expand Down Expand Up @@ -95,7 +95,7 @@ def compare_animation_bit_channels(self, expected, actual):

self.assertEqual(len(expected.data), len(actual.data))
for i, datum in enumerate(expected.data):
self.assertEqual(datum, actual.data[i])
self.assertAlmostEqual(datum, actual.data[i], 4)


def get_animation(hierarchy_name='TestHierarchy', xml=False):
Expand Down
2 changes: 2 additions & 0 deletions tests/w3d/cases/test_import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def test_only_needed_keyframe_creation(self):
meshes = [get_mesh(name='MESH_Obj')]

expected_frames = [0, 4]
if bpy.app.version >= (4, 2, 0):
expected_frames = [0]
expected = [3.0, 3.0]

self.filepath = self.outpath() + 'output'
Expand Down

0 comments on commit 0dc90d2

Please sign in to comment.