Commit Graph

6 Commits

Author SHA1 Message Date
Bastien Montagne b80cce2053 Cleanup: names: data transfer/mesh remap: dm -> me/mesh.
That area is now officially purged from the Devil.. errr... DerivedMesh!
2018-06-21 15:33:10 +02:00
Bastien Montagne fffff5a993 Cleanup: nuke DM out of data transfer code.
This was actually rather hairy, this code is huge and complicated, easy
to make mistakes...

Good thing is, it will allow for significant simplification and more
(name) cleanup in following commits ;)
2018-06-21 15:33:10 +02:00
Bastien Montagne dd44754c5f Data Transfer: Add an option to 'auto-transform' destination mesh so that it matches best the source one.
This allows to match and transfer data between two meshes with similar shape but complete arbitrary different transform.

Note that the result will be best if the meshes (more precisely, their vertices) are exact copies of each other.
Otherwise, method used can only perform an approximated best match, which means you'll likely get better
results if you 'visually' make them match in 3D space (and use 'Object Transform') instead.
2015-07-13 18:05:38 +02:00
Campbell Barton b1d758ae6b Cleanup: redundant struct declarations 2015-03-29 03:56:39 +11:00
Bastien Montagne 0af11a1742 Make use/computation of lnors consistant.
Issue was, when requesting (building) lnors for a mesh that has
autosmooth disabled, one would expect to simply get vnors as lnors.

Until now, it wasn't the case, which was bad e.g. for normal projections
of loops in recent remap code (projecting along split loop normals
when you would expect projection along vertex normals...).

Also, removed the 'angle' parameter from RNA's `mesh.calc_normals_split`.
This should *always* use mesh settings (both autosmooth and smoothresh),
otherwise once again we'd get inconsistencies in some cases.
Will update fbx and obj addons too.
2015-01-19 15:51:20 +01:00
Bastien Montagne 58d7153c6c BKE: Add 'mesh remap' code.
This is the (big!) core of mesh transfer data, it defines a set of structures
to represent a mapping of mesh elements (verts, edges, polys of loops) between
two arbitrary meshes, and code to compute such mappings.

No similarity is required between source and destination meshes (though results
when using complete different meshes are rather unlikely to be useful!).

This code is not bound to data transfer, it is defined to be as generic as possible,
and easy to reuse or extend as needs arise.

Several methods of mapping generation are defined for each element type,
we probably will have to adjust that in future (remove useless ones, add
new ones...).

For loops, you can also define islands (for UVs e.g.) so that loops of a same
destination polygon do not 'spread' across several source islands.

Heavily reviewed and enhanced by Campbell, thanks a lot!
2015-01-09 18:35:32 +01:00