[Bf-blender-cvs] [4d6c801] experimental-build: Squashed commit of mesh-transfer-data branch.

Bastien Montagne noreply at git.blender.org
Mon Dec 1 19:10:10 CET 2014


Commit: 4d6c801047e95b62b8c61fa71dbda4fa1f86b64c
Author: Bastien Montagne
Date:   Mon Dec 1 19:06:23 2014 +0100
Branches: experimental-build
https://developer.blender.org/rB4d6c801047e95b62b8c61fa71dbda4fa1f86b64c

Squashed commit of mesh-transfer-data branch.

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/BKE_bvhutils.h
M	source/blender/blenkernel/BKE_customdata.h
M	source/blender/blenkernel/BKE_deform.h
M	source/blender/blenkernel/BKE_mesh_mapping.h
A	source/blender/blenkernel/BKE_mesh_remap.h
A	source/blender/blenkernel/BKE_object_data_transfer.h
M	source/blender/blenkernel/BKE_object_deform.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/bvhutils.c
M	source/blender/blenkernel/intern/customdata.c
A	source/blender/blenkernel/intern/data_transfer_intern.h
M	source/blender/blenkernel/intern/deform.c
M	source/blender/blenkernel/intern/mesh_mapping.c
A	source/blender/blenkernel/intern/mesh_remap.c
A	source/blender/blenkernel/intern/object_data_transfer.c
A	source/blender/blenlib/BLI_astar.h
M	source/blender/blenlib/BLI_rand.h
M	source/blender/blenlib/CMakeLists.txt
A	source/blender/blenlib/intern/astar.c
M	source/blender/blenlib/intern/rand.c
M	source/blender/editors/object/CMakeLists.txt
A	source/blender/editors/object/object_data_transfer.c
M	source/blender/editors/object/object_intern.h
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_ops.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
A	source/blender/modifiers/intern/MOD_datatransfer.c
M	source/blender/modifiers/intern/MOD_util.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 7a96996..e13d007 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1225,6 +1225,121 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
         col.prop(md, "material_offset", text="Material Offset")
 
+    def DATA_TRANSFER(self, layout, ob, md):
+        row = layout.row(align=True)
+        row.prop(md, "object")
+        sub = row.row(align=True)
+        sub.active = bool(md.object)
+        sub.prop(md, "use_object_transform", text="", icon='GROUP')
+
+        layout.separator()
+
+        split = layout.split(0.333)
+        split.prop(md, "use_vert_data")
+        use_vert = md.use_vert_data
+        row = split.row()
+        row.active = use_vert
+        row.prop(md, "vert_mapping", text="")
+        if use_vert:
+            col = layout.column(align=True)
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_verts_vgroup")
+            row = split.row(align=True)
+            row.prop(md, "layers_vgroup_select_src", text="")
+            row.label(icon='RIGHTARROW_THIN')
+            row.prop(md, "layers_vgroup_select_dst", text="")
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_verts")
+
+        layout.separator()
+
+        split = layout.split(0.333)
+        split.prop(md, "use_edge_data")
+        use_edge = md.use_edge_data
+        row = split.row()
+        row.active = use_edge
+        row.prop(md, "edge_mapping", text="")
+        if use_edge:
+            col = layout.column(align=True)
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_edges")
+
+        layout.separator()
+
+        split = layout.split(0.333)
+        split.prop(md, "use_loop_data")
+        use_loop = md.use_loop_data
+        row = split.row()
+        row.active = use_loop
+        row.prop(md, "loop_mapping", text="")
+        if use_loop:
+            col = layout.column(align=True)
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_loops")
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_loops_vcol")
+            row = split.row(align=True)
+            row.prop(md, "layers_vcol_select_src", text="")
+            row.label(icon='RIGHTARROW')
+            row.prop(md, "layers_vcol_select_dst", text="")
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_loops_uv")
+            row = split.row(align=True)
+            row.prop(md, "layers_uv_select_src", text="")
+            row.label(icon='RIGHTARROW')
+            row.prop(md, "layers_uv_select_dst", text="")
+            col.prop(md, "islands_precision")
+
+        layout.separator()
+
+        split = layout.split(0.333)
+        split.prop(md, "use_poly_data")
+        use_poly = md.use_poly_data
+        row = split.row()
+        row.active = use_poly
+        row.prop(md, "poly_mapping", text="")
+        if use_poly:
+            col = layout.column(align=True)
+            split = col.split(0.333, align=True)
+            sub = split.column(align=True)
+            sub.prop(md, "data_types_polys")
+
+        layout.separator()
+
+        split = layout.split()
+        col = split.column()
+        row = col.row(align=True)
+        sub = row.row(align=True)
+        sub.active = md.use_max_distance
+        sub.prop(md, "max_distance")
+        row.prop(md, "use_max_distance", text="", icon='STYLUS_PRESSURE')
+
+        col = split.column()
+        col.prop(md, "ray_radius")
+
+        layout.separator()
+
+        split = layout.split()
+        col = split.column()
+        col.prop(md, "mix_mode")
+        col.prop(md, "mix_factor")
+
+        col = split.column()
+        row = col.row()
+        row.active = bool(md.object)
+        row.operator("object.datalayout_transfer", text="Generate Data Layers")
+        row = col.row(align=True)
+        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+        sub = row.row(align=True)
+        sub.active = bool(md.vertex_group)
+        sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
+
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 7f2ec53..0ea68fa 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1095,6 +1095,7 @@ class VIEW3D_MT_object(Menu):
         layout.separator()
 
         layout.operator("object.join")
+        layout.operator("object.data_transfer")
 
         layout.separator()
 
diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index 4bc8fc4..5a63b44 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -31,6 +31,7 @@
  *  \ingroup bke
  */
 
+#include "BLI_bitmap.h"
 #include "BLI_kdopbvh.h"
 
 /*
@@ -56,8 +57,8 @@ typedef struct BVHTreeFromMesh {
 	struct MEdge *edge;     /* only used for BVHTreeFromMeshEdges */
 	struct MFace *face;
 	bool vert_allocated;
-	bool face_allocated;
 	bool edge_allocated;
+	bool face_allocated;
 
 	/* radius for raycast */
 	float sphere_radius;
@@ -69,36 +70,28 @@ typedef struct BVHTreeFromMesh {
 } BVHTreeFromMesh;
 
 /*
- * Builds a bvh tree where nodes are the vertexs of the given mesh.
+ * Builds a bvh tree where nodes are the relevant elements of the given mesh.
  * Configures BVHTreeFromMesh.
  *
  * The tree is build in mesh space coordinates, this means special care must be made on queries
  * so that the coordinates and rays are first translated on the mesh local coordinates.
- * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becomes possible to reuse
- * a BVHTree.
+ * Reason for this is that bvh_from_mesh_* can use a cache in some cases and so it becomes possible to reuse a BVHTree.
  * 
  * free_bvhtree_from_mesh should be called when the tree is no longer needed.
  */
 BVHTree *bvhtree_from_mesh_verts(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
-
-/*
- * Builds a bvh tree where nodes are the faces of the given mesh.
- * Configures BVHTreeFromMesh.
- *
- * The tree is build in mesh space coordinates, this means special care must be made on queries
- * so that the coordinates and rays are first translated on the mesh local coordinates.
- * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becomes possible to reuse
- * a BVHTree.
- *
- * The returned value is the same as in data->tree, its only returned to make it easier to test
- * the success 
- * 
- * free_bvhtree_from_mesh should be called when the tree is no longer needed.
- */
-BVHTree *bvhtree_from_mesh_faces(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
+BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data, struct MVert *vert, const int numVerts,
+                                    const bool vert_allocated, BLI_bitmap *mask, int numVerts_active,
+                                    float epsilon, int tree_type, int axis);
 
 BVHTree *bvhtree_from_mesh_edges(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
 
+BVHTree *bvhtree_from_mesh_faces(struct BVHTreeFromMesh *data, struct DerivedMesh *mesh, float epsilon, int tree_type, int axis);
+BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data, struct MVert *vert, const bool vert_allocated,
+                                    struct MFace *face, const int numFaces, const bool face_allocated,
+                                    BLI_bitmap *mask, int numFaces_active,
+                                    float epsilon, int tree_type, int axis);
+
 /*
  * Frees data allocated by a call to bvhtree_from_mesh_*.
  */
@@ -115,11 +108,12 @@ float nearest_point_in_tri_surface_squared(const float v0[3], const float v1[3],
  */
 
 //Using local coordinates
-#define BVHTREE_FROM_FACES      0
-#define BVHTREE_FROM_VERTICES   1
-#define BVHTREE_FROM_EDGES      2
-
-#define BVHTREE_FROM_FACES_EDITMESH  3
+enum {
+	BVHTREE_FROM_VERTS           = 0,
+	BVHTREE_FROM_EDGES           = 1,
+	BVHTREE_FROM_FACES           = 2,
+	BVHTREE_FROM_FACES_EDITMESH  = 3,
+};
 
 typedef struct LinkNode *BVHCache;
 
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 30a5889..08edde1 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -41,6 +41,8 @@ extern "C" {
 #include "BLI_sys_types.h"
 #include "BLI_utildefines.h"
 
+#include "DNA_customdata_types.h"
+
 struct BMesh;
 struct ID;
 struct CustomData;
@@ -77,6 +79,9 @@ extern const CustomDataMask CD_MASK_EVERYTHING;
 
 void customData_mask_layers__print(CustomDataMask mask);
 
+typedef void (*cd_interp)(void **sources, const float *weights, const float *sub_weights, int count, void *dest);
+typedef void (*cd_copy)(const void *source, void *dest, int count);
+
 /**
  * Checks if the layer at physical offset \a layer_n (in data->layers) support math
  * the below operations.
@@ -96,6 +101,9 @@ bool CustomData_bmesh_has_free(const struct CustomData *data);
  * implemented for mloopuv/mloopcol, for now.*/
 void CustomData_data_copy_value(int type, const void *source, void *dest);
 
+/* Same as above, but doing advanced mixing. Only available for a few types of data (like colors...). */
+void CustomData_data_mix_value(int type, const void *source, void *dest, const int mixmode, const float mixfactor);
+
 /* compares if data1 is equal to data2.  type is 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list