diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index eb673ee4056ef826399a9606d84786a890182ff7..501043d12f736d246bf0582027cd92d7f754eee1 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -416,6 +416,9 @@ class add_mesh_bolt(Operator, AddObjectHelper): (context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \ (self.change == True): obj = context.active_object + use_auto_smooth = bool(obj.data.use_auto_smooth) # Copy value, do not take a reference + use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference + mesh = createMesh.Create_New_Mesh(self, context) # Modify existing mesh data object by replacing geometry (but leaving materials etc) @@ -424,6 +427,11 @@ class add_mesh_bolt(Operator, AddObjectHelper): bm.to_mesh(obj.data) bm.free() + # Preserve flat/smooth choice. New mesh is flat by default + obj.data.use_auto_smooth = use_auto_smooth + if use_smooth: + bpy.ops.object.shade_smooth() + bpy.data.meshes.remove(mesh) try: