diff options
author | Myron Carey <myroncarey> | 2022-09-14 16:25:31 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2022-09-14 16:26:11 +0300 |
commit | 22bf5ba4d1526c9e942a2dbd6f25e3932e9d71f2 (patch) | |
tree | a2b3cd6b63000493a7e9e3d2dc7bd5f9554a344a /source/blender/io/collada/DocumentImporter.cpp | |
parent | 8aca0da9521a7a4570f21bc71872f69b4e78d83b (diff) |
Fix T49814: Collada Import Ignores Vertex Normals
We now import and apply custom normals using a similar strategy
to the STL importer. We store custom normal data for each loop
as we read each MPoly and then apply it to the mesh after
`BKE_mesh_calc_edges()` is called.
The new behavior is optional and may be disabled in the Collada import
UI. When disabled, we use the old behavior of only using normals
to determine whether or not to smooth shade an MPoly.
----
Patch as requested in {T49814}.
The Collada import UI now has an additional checkbox, similar to the glTF and FBX import UIs:
{F13428264}
Here is a test Collada file with a simple test cube with flipped custom normals:
{F13428260}
{F13428282}
And a sphere where the two halves are disconnected geometry, but has custom normals that make the halves appear to be connected:
{F13436363}
{F13436368}
I've tested it on a number of my own meshes, and the custom normals appear to be imported
correctly. I'm not too sure about how I've plumbed the option down, though, or whether this
is the most proper way to apply custom normals.
Reviewed By: gaiaclary
Differential Revision: https://developer.blender.org/D15804
Diffstat (limited to 'source/blender/io/collada/DocumentImporter.cpp')
-rw-r--r-- | source/blender/io/collada/DocumentImporter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 1ffe412b3ed..7ac70864f82 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -90,8 +90,12 @@ DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_set CTX_data_scene(C), view_layer, import_settings), - mesh_importer( - &unit_converter, &armature_importer, CTX_data_main(C), CTX_data_scene(C), view_layer), + mesh_importer(&unit_converter, + import_settings->custom_normals, + &armature_importer, + CTX_data_main(C), + CTX_data_scene(C), + view_layer), anim_importer(C, &unit_converter, &armature_importer, CTX_data_scene(C)) { } |