[Bf-blender-cvs] [dffe702d782] blender-v2.81-release: Fix T69182: Auto-Smooth does not work on Alembic meshes without normals

Sybren A. Stüvel noreply at git.blender.org
Thu Oct 17 11:26:57 CEST 2019


Commit: dffe702d782990b2b6fd36767254d35ab47f25eb
Author: Sybren A. Stüvel
Date:   Thu Oct 17 11:18:46 2019 +0200
Branches: blender-v2.81-release
https://developer.blender.org/rBdffe702d782990b2b6fd36767254d35ab47f25eb

Fix T69182: Auto-Smooth does not work on Alembic meshes without normals

The auto-smoothing flag can now be used by artists when the Alembic file
does not contain custom loop normals.

- Auto-smoothing disabled: mesh is flat-shaded.
- Auto-smoothing enabled: works as usual; set angle to 180° to ensure
  a 100% smoothed mesh.

===================================================================

M	source/blender/alembic/intern/abc_mesh.cc

===================================================================

diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 12c59964a8c..651f32e6ab0 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -885,7 +885,8 @@ static void process_normals(CDStreamConfig &config, const AbcMeshData &mesh_data
 
   if (!mesh_data.loop_normals) {
     BKE_mesh_calc_normals(config.mesh);
-    config.mesh->flag &= ~ME_AUTOSMOOTH;
+    /* Don't touch the ME_AUTOSMOOTH flag in this case. It can be used by artists to toggle between
+     * flat/smooth shaded when the Alembic mesh doesn't contain loop normals. */
     return;
   }
 
@@ -1018,7 +1019,10 @@ static void read_mesh_sample(const std::string &iobject_full_name,
   abc_mesh_data.face_counts = sample.getFaceCounts();
   abc_mesh_data.face_indices = sample.getFaceIndices();
   abc_mesh_data.positions = sample.getPositions();
-  abc_mesh_data.poly_flag_smooth = false;
+
+  /* The auto-smoothing flag can be used by artists when the Alembic file does not contain custom
+   * loop normals. Auto-smoothing only works when polys are marked as smooth. */
+  abc_mesh_data.poly_flag_smooth = (config.mesh->flag & ME_AUTOSMOOTH);
 
   read_normals_params(abc_mesh_data, schema.getNormalsParam(), selector);



More information about the Bf-blender-cvs mailing list