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/MeshImporter.h | |
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/MeshImporter.h')
-rw-r--r-- | source/blender/io/collada/MeshImporter.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/io/collada/MeshImporter.h b/source/blender/io/collada/MeshImporter.h index 1def84e8f99..a59b24d4f24 100644 --- a/source/blender/io/collada/MeshImporter.h +++ b/source/blender/io/collada/MeshImporter.h @@ -24,6 +24,7 @@ #include "collada_utils.h" #include "BLI_edgehash.h" +#include "BLI_math_vec_types.hh" #include "DNA_material_types.h" #include "DNA_mesh_types.h" @@ -63,6 +64,7 @@ class VCOLDataWrapper { class MeshImporter : public MeshImporterBase { private: UnitConverter *unitconverter; + bool use_custom_normals; Main *m_bmain; Scene *scene; @@ -156,7 +158,7 @@ class MeshImporter : public MeshImporterBase { * * TODO: import uv set names. */ - void read_polys(COLLADAFW::Mesh *mesh, Mesh *me); + void read_polys(COLLADAFW::Mesh *mesh, Mesh *me, blender::Vector<blender::float3> &loop_normals); /** * Read all loose edges. * IMPORTANT: This function assumes that all edges from existing @@ -179,6 +181,7 @@ class MeshImporter : public MeshImporterBase { public: MeshImporter(UnitConverter *unitconv, + bool use_custom_normals, ArmatureImporter *arm, Main *bmain, Scene *sce, |