Skip to content

Commit

Permalink
Fix: Meshes created by addons shaded smooth
Browse files Browse the repository at this point in the history
See https://projects.blender.org/blender/blender/commit/5876573e14

Resolves #109074
Resolves part of #109070
  • Loading branch information
HansGoudey committed Jun 20, 2023
1 parent 4940dbf commit 4c21a4e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions add_mesh_BoltFactory/Boltfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ def execute(self, context):
obj.data.use_auto_smooth = use_auto_smooth
if use_smooth:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

bpy.data.meshes.remove(mesh)

Expand Down
4 changes: 4 additions & 0 deletions ant_landscape/add_mesh_ant_landscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ def execute(self, context):

if self.smooth_mesh:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

if not self.at_cursor:
new_ob.location = (0.0, 0.0, 0.0)
Expand Down Expand Up @@ -744,6 +746,8 @@ def execute(self, context):

if self.smooth_mesh:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

if not self.at_cursor:
wobj.location = (0.0, 0.0, 0.0)
Expand Down
6 changes: 6 additions & 0 deletions ant_landscape/ant_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ def execute(self, context):

if ob['smooth_mesh']:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

# Landscape Material
if ob['land_material'] != "" and ob['land_material'] in bpy.data.materials:
Expand Down Expand Up @@ -267,6 +269,8 @@ def execute(self, context):

if ob['smooth_mesh']:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

# Water Material
if ob['water_material'] != "" and ob['water_material'] in bpy.data.materials:
Expand Down Expand Up @@ -1001,6 +1005,8 @@ def execute(self, context):

if self.smooth:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()
self.stats.time()
self.stats.memory()
if self.showmeshstats:
Expand Down
3 changes: 3 additions & 0 deletions io_scene_3ds/import_3ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ def putContextMesh(
bmesh.polygons[f].use_smooth = True
else:
bmesh.polygons[f].use_smooth = False
else:
for poly in bmesh.polygons:
poly.use_smooth = False

if contextMatrix:
if WORLD_MATRIX:
Expand Down
5 changes: 4 additions & 1 deletion mesh_tissue/tessellate_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,10 @@ def execute(self, context):
use_bmesh = not (bool_shapekeys and fill_mode == 'PATCH' and component_mode != 'OBJECT')
merge_components(new_ob, ob.tissue_tessellate, use_bmesh)

if bool_smooth: bpy.ops.object.shade_smooth()
if bool_smooth:
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_flat()

for mesh in bpy.data.meshes:
if not mesh.users: bpy.data.meshes.remove(mesh)
Expand Down

0 comments on commit 4c21a4e

Please sign in to comment.