[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53660] trunk/blender/source/blender: fix [#33797] decimate modifier bug on uv-coordinates when mesh uses vertex color
Campbell Barton
ideasman42 at gmail.com
Tue Jan 8 17:39:41 CET 2013
Revision: 53660
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53660
Author: campbellbarton
Date: 2013-01-08 16:39:36 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
fix [#33797] decimate modifier bug on uv-coordinates when mesh uses vertex color
if vertex colors had no seams - it would interpolate the UV's too, now interpolate per-layer.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_customdata.h
trunk/blender/source/blender/blenkernel/intern/customdata.c
trunk/blender/source/blender/bmesh/tools/bmesh_decimate_collapse.c
Modified: trunk/blender/source/blender/blenkernel/BKE_customdata.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_customdata.h 2013-01-08 15:34:33 UTC (rev 53659)
+++ trunk/blender/source/blender/blenkernel/BKE_customdata.h 2013-01-08 16:39:36 UTC (rev 53660)
@@ -216,6 +216,8 @@
void CustomData_interp(const struct CustomData *source, struct CustomData *dest,
int *src_indices, float *weights, float *sub_weights,
int count, int dest_index);
+void CustomData_bmesh_interp_n(struct CustomData *data, void **src_blocks, const float *weights,
+ const float *sub_weights, int count, void *dest_block, int n);
void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks,
const float *weights, const float *sub_weights, int count,
void *dest_block);
Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c 2013-01-08 15:34:33 UTC (rev 53659)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c 2013-01-08 16:39:36 UTC (rev 53660)
@@ -2629,6 +2629,19 @@
memcpy(dest, source, typeInfo->size);
}
+/**
+ * \param src_blocks must be pointers to the data, offset by layer->offset already.
+ */
+void CustomData_bmesh_interp_n(CustomData *data, void **src_blocks, const float *weights,
+ const float *sub_weights, int count, void *dest_block, int n)
+{
+ CustomDataLayer *layer = &data->layers[n];
+ const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
+
+ typeInfo->interp(src_blocks, weights, sub_weights, count,
+ (char *)dest_block + layer->offset);
+}
+
void CustomData_bmesh_interp(CustomData *data, void **src_blocks, const float *weights,
const float *sub_weights, int count, void *dest_block)
{
@@ -2651,9 +2664,7 @@
for (j = 0; j < count; ++j) {
sources[j] = (char *)src_blocks[j] + layer->offset;
}
-
- typeInfo->interp(sources, weights, sub_weights, count,
- (char *)dest_block + layer->offset);
+ CustomData_bmesh_interp_n(data, sources, weights, sub_weights, count, dest_block, i);
}
}
Modified: trunk/blender/source/blender/bmesh/tools/bmesh_decimate_collapse.c
===================================================================
--- trunk/blender/source/blender/bmesh/tools/bmesh_decimate_collapse.c 2013-01-08 15:34:33 UTC (rev 53659)
+++ trunk/blender/source/blender/bmesh/tools/bmesh_decimate_collapse.c 2013-01-08 16:39:36 UTC (rev 53660)
@@ -441,6 +441,8 @@
static void bm_edge_collapse_loop_customdata(BMesh *bm, BMLoop *l, BMVert *v_clear, BMVert *v_other,
const float customdata_fac)
{
+ /* disable seam check - the seam check would have to be done per layer, its not really that important */
+//#define USE_SEAM
/* these don't need to be updated, since they will get removed when the edge collapses */
BMLoop *l_clear, *l_other;
const int is_manifold = BM_edge_is_manifold(l->e);
@@ -464,7 +466,9 @@
/* now we have both corners of the face 'l->f' */
for (side = 0; side < 2; side++) {
+#ifdef USE_SEAM
int is_seam = FALSE;
+#endif
void *src[2];
BMFace *f_exit = is_manifold ? l->radial_next->f : NULL;
BMEdge *e_prev = l->e;
@@ -501,34 +505,40 @@
break;
}
+#ifdef USE_SEAM
/* break out unless we find a match */
is_seam = TRUE;
+#endif
/* ok. we have a loop. now be smart with it! */
for (i = 0; i < bm->ldata.totlayer; i++) {
if (CustomData_layer_has_math(&bm->ldata, i)) {
const int offset = bm->ldata.layers[i].offset;
const int type = bm->ldata.layers[i].type;
- void *cd_src, *cd_iter;
+ void *cd_src[2] = {(char *)src[0] + offset,
+ (char *)src[1] + offset};
+ void *cd_iter = (char *)l_iter->head.data + offset;;
- /* todo, make nicer macros for this */
- cd_src = (char *)src[0] + offset;
- // cd_dst = (char *)src[1] + offset; // UNUSED
- cd_iter = (char *)l_iter->head.data + offset;
-
/* detect seams */
- if (CustomData_data_equals(type, cd_src, cd_iter)) {
- CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, l_iter->head.data);
+ if (CustomData_data_equals(type, cd_src[0], cd_iter)) {
+ CustomData_bmesh_interp_n(&bm->ldata, cd_src, w, NULL, 2, l_iter->head.data, i);
+#ifdef USE_SEAM
is_seam = FALSE;
+#endif
}
}
}
+#ifdef USE_SEAM
if (is_seam) {
break;
}
+#endif
}
}
+
+//#undef USE_SEAM
+
}
#endif /* USE_CUSTOMDATA */
More information about the Bf-blender-cvs
mailing list