Skip to content

Add missing version check for use_auto_smooth #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bseq/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def update_mesh(meshio_mesh, mesh):

# set as split normal per vertex
if mesh.BSEQ.split_norm_att_name and mesh.BSEQ.split_norm_att_name == k:
# If blender version is less than 4.1.0, then dont set auto smooth.
# If blender version is greater than 4.1.0, then don't set auto smooth.
# It has been removed and normals will be used automatically if they are set.
# https://developer.blender.org/docs/release_notes/4.1/python_api/#mesh
if bpy.app.version < (4, 1, 0):
Expand All @@ -217,8 +217,9 @@ def update_mesh(meshio_mesh, mesh):

# set split normal per loop per vertex
if mesh.BSEQ.split_norm_att_name and mesh.BSEQ.split_norm_att_name == k:
# Currently hard-coded for .obj files
mesh.use_auto_smooth = True
if bpy.app.version < (4, 1, 0):
mesh.use_auto_smooth = True
# currently hard-coded for .obj files
indices = [item for sublist in meshio_mesh.cell_data["obj:vn_face_idx"][0] for item in sublist]
mesh.normals_split_custom_set([meshio_mesh.field_data["obj:vn"][i - 1] for i in indices])

Expand Down