diff --git a/io_ogre/ogre/mesh.py b/io_ogre/ogre/mesh.py index df9524f..073fa0c 100644 --- a/io_ogre/ogre/mesh.py +++ b/io_ogre/ogre/mesh.py @@ -234,7 +234,8 @@ def dot_mesh(ob, path, force_name=None, ignore_shape_animation=False, normals=Tr mesh.calc_tangents(uvmap=mesh.uv_layers.active.name) else: # calc_tangents() already calculates split normals for us - mesh.calc_normals_split() + if bpy.app.version < (4, 1, 0): + mesh.calc_normals_split() progressbar = util.ProgressBar("Faces", len(mesh.polygons)) @@ -247,7 +248,10 @@ def dot_mesh(ob, path, force_name=None, ignore_shape_animation=False, normals=Tr for loop_idx, idx in zip(F.loop_indices, tri): v = mesh.vertices[ idx ] - nx,ny,nz = swap( mesh.loops[ loop_idx ].normal ) + if bpy.app.version < (3, 6, 0): + nx,ny,nz = swap( mesh.loops[ loop_idx ].normal ) + else: + nx,ny,nz = swap( mesh.corner_normals[ loop_idx ].vector ) if tangents != 0: tx,ty,tz = swap( mesh.loops[ loop_idx ].tangent ) diff --git a/io_ogre/ogre/ogre_import.py b/io_ogre/ogre/ogre_import.py index 845abd2..0acf248 100644 --- a/io_ogre/ogre/ogre_import.py +++ b/io_ogre/ogre/ogre_import.py @@ -1200,7 +1200,6 @@ def bCreateSubMeshes(meshData, meshName): me.vertices.foreach_set("co", unpack_list(verts)) if hasNormals: - me.create_normals_split() me.vertices.foreach_set("normal", unpack_list(normals)) me.polygons.foreach_set("loop_start", [i for i in range(0, FaceLength * 3, 3)]) @@ -1349,9 +1348,9 @@ def bCreateSubMeshes(meshData, meshName): # Try to set custom normals if hasNormals: - me.polygons.foreach_set("use_smooth", [True] * len(me.polygons)) + if bpy.app.version < (4, 1, 0): + me.use_auto_smooth = True me.normals_split_custom_set_from_vertices(normals) - me.use_auto_smooth = True Report.orig_vertices = len( me.vertices ) Report.faces += len( me.polygons )