Skip to content

Commit

Permalink
Initial changes for to support Blender 4.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nusiq committed Jul 24, 2024
1 parent 849ea5b commit c2d22b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 5 additions & 2 deletions mcblend/operator_func/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,11 @@ def build_with_empties(
MeshType.POLY_MESH.value)

# 4. Set mesh normals and UVs
mesh.create_normals_split()
mesh.use_auto_smooth = True
# TODO -verify this code:
# Removed for Blender 4.1. May cause issues.
# https://developer.blender.org/docs/release_notes/4.1/python_api/#breaking-changes
# mesh.create_normals_split()
# mesh.use_auto_smooth = True
mesh.normals_split_custom_set(
blender_normals) # type: ignore

Expand Down
5 changes: 4 additions & 1 deletion mcblend/operator_func/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ def _scale(objprop: McblendObject) -> NumpyTable:
continue
self.cubes.append(cube)
elif cubeprop.mesh_type is MeshType.POLY_MESH:
cubeprop.obj_data.calc_normals_split()
# TODO -verify this code:
# Removed for Blender 4.1. May cause issues.
# https://developer.blender.org/docs/release_notes/4.1/python_api/#breaking-changes
# cubeprop.obj_data.calc_normals_split()
polygons = cubeprop.obj_data.polygons # loop ids and vertices
vertices = cubeprop.obj_data.vertices # crds
loops = cubeprop.obj_data.loops # normals
Expand Down
8 changes: 3 additions & 5 deletions mcblend/operator_func/pyi_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
'''
Extra types used only in the PYI files.
'''
from typing import Any, Iterator, Literal, TypeVar, Generic, Sized, Optional
from typing import Any, Iterator, TypeVar, Generic, Sized
from bpy.types import (
Object, Mesh, Image, Material, Bone, EditBone, MeshUVLoopLayer, PoseBone,
MeshUVLoop, MeshVertex, MeshEdge, MeshPolygon, TimelineMarker,
Keyframe, NlaTrack, NlaStrip, Node, NodeSocket, NodeLink, NodeTree,
NodeSocketInterface)
Mesh, Image, Material, Bone, PoseBone,
MeshUVLoop, MeshEdge, MeshPolygon)

T = TypeVar("T")

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = python3.10
envlist = python3.11
skipsdist = true

[testenv]
Expand Down

0 comments on commit c2d22b6

Please sign in to comment.