Skip to content

Commit

Permalink
Fix error importing SubD.
Browse files Browse the repository at this point in the history
Blender 4.1 removed use_auto_smooth. For 4.1 and
newer use set_sharp_from_angle instead, using 30deg
as default.

Fixes #122
  • Loading branch information
jesterKing committed Aug 15, 2024
1 parent 43d49db commit a5c71c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions import_3dm/converters/render_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import rhino3dm as r3d
from . import utils
import bpy
import bmesh

def import_render_mesh(context, ob, name, scale, options):
Expand Down Expand Up @@ -99,10 +100,13 @@ def import_render_mesh(context, ob, name, scale, options):
bm = bmesh.new()
bm.from_mesh(mesh)

bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.001)
bm.to_mesh(mesh)
bm.free()
mesh.use_auto_smooth = True
if bpy.app.version >= (4, 1):
mesh.set_sharp_from_angle(angle=0.523599) # 30deg
else:
mesh.use_auto_smooth = True
# done, now add object to blender


Expand Down

0 comments on commit a5c71c4

Please sign in to comment.