diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-10-17 12:18:46 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-10-17 12:26:33 +0300 |
commit | dffe702d782990b2b6fd36767254d35ab47f25eb (patch) | |
tree | a6619debf46e608a982604bd82620d90c38d1053 /source/blender/alembic/intern | |
parent | 2afbd14c596746be22951e7a8cb9e1bc769a7128 (diff) |
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.
Diffstat (limited to 'source/blender/alembic/intern')
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 8 |
1 files changed, 6 insertions, 2 deletions
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); |