Blender Git Commit Log

Git Commits -> Revision ae440c8

June 8, 2016, 15:23 (GMT)
BMesh clnor: Change py API.

After some talking with Campbell, this is now accessible through BMesh's CustomData system:

- clnor data is now exposed in BMesh (same way as for UVs etc.).
- You can now get/set **raw** values (pair of factors) of each loop independently.
This is not so useful in itself (though it allows nice 'relative' normal edition, given what
those two factors represent), getting/setting 'real' normals there is for later.
- You can now set all custom normals at once using the new 'from_array' method of BMLayerItem.
This is supposed to be generic setter, but for now it's only implemented for clnor data.

Some notes/reflections, also for future developments:
- About from_array:
* Do we accept that rather 'flexible' way of handling given array of data? think we do not have much choice
if we want to keep generic BMLayerItem (else we'll have to define sub-classes of this for every type of data :/ ).
* Currently clnor's from_array returns values actually set as a new array, not sure we want to keep this, or instead
add another 'to_array' method (in this case, how do we control type of returned data?).
- About clnors in BMesh in general:
* Think ultimately we'll want to have own struct of clnors in BMesh,
caching clnor spaces, encoded normal, real normal, etc.
* We'll then need to add lots of stuff to handle edition, in particular a system to rebuild clnor spaces
of affected loops each time we add/remove/modify geometry...

Latest point is important, since it means current BMesh py API will **not** be stable for now, and will
most certainly break when full support of custom normals is added to BMesh.

Commit Details:

Full Hash: ae440c84fd4ed50988c7665bc118daee6f4c47ba
Parent Commit: 399b56a
Lines Changed: +302, -135

5 Modified Paths:

/source/blender/blenkernel/intern/mesh_evaluate.c (+0, -11) (Diff)
/source/blender/blenlib/BLI_math_base.h (+4, -0) (Diff)
/source/blender/blenlib/intern/math_base_inline.c (+12, -0) (Diff)
/source/blender/python/bmesh/bmesh_py_types_customdata.c (+286, -1) (Diff)
/source/blender/python/bmesh/bmesh_py_utils.c (+0, -123) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021