Blender Git Loki

Git Commits -> Revision 924ee69

Revision 924ee69 by Bastien Montagne (mesh-transfer-data)
October 3, 2014, 20:46 (GMT)
Mesh Transfer Data
**********

WARNING - fully non-functional commit (not even compilable!).

Mesh transfer data (data here being either real CD layers, like e.g. skinning weights, UVs, etc., or 'fake' ones, like e.g. vgroups, shapekeys, but also edge crease, smooth/sharp/seam flags, etc.) is subdivided in several sub-modules:
* Mapping between mesh elements (verts, edges, polys or loops), in BKE's `mesh_mapping`.
* Mapping between data layers (for non-singleton data types), mostly handled in `ED_object` and BKE's `customdata` areas.
* Transfer of single data layer, mostly handled in BKE's `customdata` area.

Additional possibilities (only relevant for a subset of data types) are barely sketched up currently:
* A way to filter which elements of destination we actually want to affect (currently, all, also the possibility to only affect those below a given threshold - could also add e.g. vgroup-based selection, etc.).
* A way to alter destination elements' data in other ways than mere replace (add/sub/mul/div/etc.).

All this is designed to be both easy to setup (code-wise) for simple types, and yet flexible enough to be usable by complex/weird data types like vgroups and shapekeys. For now, it is only expected to work in Object/modifier contexts, not quite sure whether having this in BMesh would be that much useful?

Mesh Elements Mapping
-----
This part is rather independent. Vertices and edges mappings are implemented (but not really tested yet, think will have to write some gtests for that anyway). Polygons are also finished, but not tested at all. Loops are mostly written, but not yet finished nor compilable (the most complex ones, since we have to take islands in consideration here).

Note mapping supports a distance threshold, to prevent geometry to far away from each other to match.

Data Layers Mapping
-----
This is handled by a struct defined in BKE_customdata, but filled in ED_object code. Each instance of DataTransferLayerMapping contains all data needed to execute the data transfer for each element of the mesh mapping.

`object_transfer_data.c` handles the generation of those data layers mapping instance for basic types (usual CDLayers, but also bitflags and simple data like edge crease), complex types like vgroups and shapekeys are handled by dedicated helpers in there own files - trying to keep code well ordered.

Transfer of Single Data Layer
-----
This is a low-level simple func in BKE_customdata, that executes the data transfer itself, including weighted interpolation if needed. It expects pre-computed inputs (mesh elements' and data layers' mappings).

High Level
-----
`ED_data_transfer` is the high-level interface to all this, used by the `OBJECT_OT_data_transfer` operator. Once again, not all features are implemented yet, by far.

Commit Details:

Full Hash: 924ee6922a8ab8a1b16798beb2ad42109d7e3096
Parent Commit: f0b601c
Lines Changed: +3158, -229

1 Added Path:

/source/blender/editors/object/object_transfer_data.c (+822, -0) (View)

13 Modified Paths:

/release/scripts/startup/bl_ui/space_view3d.py (+1, -0) (Diff)
/source/blender/blenkernel/BKE_bvhutils.h (+18, -25) (Diff)
/source/blender/blenkernel/BKE_customdata.h (+61, -2) (Diff)
/source/blender/blenkernel/BKE_mesh_mapping.h (+150, -0) (Diff)
/source/blender/blenkernel/BKE_modifier.h (+1, -0) (Diff)
/source/blender/blenkernel/intern/bvhutils.c (+295, -190) (Diff)
/source/blender/blenkernel/intern/customdata.c (+192, -4) (Diff)
/source/blender/blenkernel/intern/mesh_mapping.c (+1349, -8) (Diff)
/source/blender/editors/include/ED_object.h (+57, -0) (Diff)
/source/blender/editors/object/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/object/object_intern.h (+19, -0) (Diff)
/source/blender/editors/object/object_ops.c (+4, -0) (Diff)
/source/blender/editors/object/object_vgroup.c (+188, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021