Changeset View
Changeset View
Standalone View
Standalone View
add_mesh_BoltFactory/Boltfactory.py
| Context not available. | |||||
| (context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \ | (context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \ | ||||
| (self.change == True): | (self.change == True): | ||||
| obj = context.active_object | 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) | mesh = createMesh.Create_New_Mesh(self, context) | ||||
| # Modify existing mesh data object by replacing geometry (but leaving materials etc) | # Modify existing mesh data object by replacing geometry (but leaving materials etc) | ||||
| Context not available. | |||||
| bm.to_mesh(obj.data) | bm.to_mesh(obj.data) | ||||
| bm.free() | 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) | bpy.data.meshes.remove(mesh) | ||||
| try: | try: | ||||
| Context not available. | |||||