Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r--source/blender/blenkernel/intern/mesh.c92
1 files changed, 46 insertions, 46 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 770d482b33b..4fabf9ebdf8 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -106,7 +106,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
const float thresh_sq = thresh * thresh;
CustomDataLayer *l1, *l2;
int i, i1 = 0, i2 = 0, tot, j;
-
+
for (i = 0; i < c1->totlayer; i++) {
if (ELEM(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
@@ -125,7 +125,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
if (i1 != i2)
return MESHCMP_CDLAYERS_MISMATCH;
-
+
l1 = c1->layers; l2 = c2->layers;
tot = i1;
i1 = 0; i2 = 0;
@@ -143,52 +143,52 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
i2++;
l2++;
}
-
+
if (l1->type == CD_MVERT) {
MVert *v1 = l1->data;
MVert *v2 = l2->data;
int vtot = m1->totvert;
-
+
for (j = 0; j < vtot; j++, v1++, v2++) {
if (len_squared_v3v3(v1->co, v2->co) > thresh_sq)
return MESHCMP_VERTCOMISMATCH;
/* I don't care about normals, let's just do coodinates */
}
}
-
+
/*we're order-agnostic for edges here*/
if (l1->type == CD_MEDGE) {
MEdge *e1 = l1->data;
MEdge *e2 = l2->data;
int etot = m1->totedge;
EdgeHash *eh = BLI_edgehash_new_ex(__func__, etot);
-
+
for (j = 0; j < etot; j++, e1++) {
BLI_edgehash_insert(eh, e1->v1, e1->v2, e1);
}
-
+
for (j = 0; j < etot; j++, e2++) {
if (!BLI_edgehash_lookup(eh, e2->v1, e2->v2))
return MESHCMP_EDGEUNKNOWN;
}
BLI_edgehash_free(eh, NULL);
}
-
+
if (l1->type == CD_MPOLY) {
MPoly *p1 = l1->data;
MPoly *p2 = l2->data;
int ptot = m1->totpoly;
-
+
for (j = 0; j < ptot; j++, p1++, p2++) {
MLoop *lp1, *lp2;
int k;
-
+
if (p1->totloop != p2->totloop)
return MESHCMP_POLYMISMATCH;
-
+
lp1 = m1->mloop + p1->loopstart;
lp2 = m2->mloop + p2->loopstart;
-
+
for (k = 0; k < p1->totloop; k++, lp1++, lp2++) {
if (lp1->v != lp2->v)
return MESHCMP_POLYVERTMISMATCH;
@@ -199,7 +199,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MLoop *lp1 = l1->data;
MLoop *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
if (lp1->v != lp2->v)
return MESHCMP_LOOPMISMATCH;
@@ -209,22 +209,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MLoopUV *lp1 = l1->data;
MLoopUV *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
if (len_squared_v2v2(lp1->uv, lp2->uv) > thresh_sq)
return MESHCMP_LOOPUVMISMATCH;
}
}
-
+
if (l1->type == CD_MLOOPCOL) {
MLoopCol *lp1 = l1->data;
MLoopCol *lp2 = l2->data;
int ltot = m1->totloop;
-
+
for (j = 0; j < ltot; j++, lp1++, lp2++) {
- if (ABS(lp1->r - lp2->r) > thresh ||
- ABS(lp1->g - lp2->g) > thresh ||
- ABS(lp1->b - lp2->b) > thresh ||
+ if (ABS(lp1->r - lp2->r) > thresh ||
+ ABS(lp1->g - lp2->g) > thresh ||
+ ABS(lp1->b - lp2->b) > thresh ||
ABS(lp1->a - lp2->a) > thresh)
{
return MESHCMP_LOOPCOLMISMATCH;
@@ -236,14 +236,14 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
MDeformVert *dv1 = l1->data;
MDeformVert *dv2 = l2->data;
int dvtot = m1->totvert;
-
+
for (j = 0; j < dvtot; j++, dv1++, dv2++) {
int k;
MDeformWeight *dw1 = dv1->dw, *dw2 = dv2->dw;
-
+
if (dv1->totweight != dv2->totweight)
return MESHCMP_DVERT_TOTGROUPMISMATCH;
-
+
for (k = 0; k < dv1->totweight; k++, dw1++, dw2++) {
if (dw1->def_nr != dw2->def_nr)
return MESHCMP_DVERT_GROUPMISMATCH;
@@ -253,7 +253,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
}
}
}
-
+
return 0;
}
@@ -266,22 +266,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
{
int c;
-
+
if (!me1 || !me2)
return "Requires two input meshes";
-
- if (me1->totvert != me2->totvert)
+
+ if (me1->totvert != me2->totvert)
return "Number of verts don't match";
-
+
if (me1->totedge != me2->totedge)
return "Number of edges don't match";
-
+
if (me1->totpoly != me2->totpoly)
return "Number of faces don't match";
-
+
if (me1->totloop != me2->totloop)
return "Number of loops don't match";
-
+
if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh)))
return cmpcode_to_str(c);
@@ -293,7 +293,7 @@ const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh)))
return cmpcode_to_str(c);
-
+
return NULL;
}
@@ -400,7 +400,7 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd)
me->mface = CustomData_get_layer(&me->fdata, CD_MFACE);
me->mcol = CustomData_get_layer(&me->fdata, CD_MCOL);
me->mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
-
+
me->mpoly = CustomData_get_layer(&me->pdata, CD_MPOLY);
me->mloop = CustomData_get_layer(&me->ldata, CD_MLOOP);
@@ -673,13 +673,13 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
BoundBox *bb;
float min[3], max[3];
float mloc[3], msize[3];
-
+
if (me->bb == NULL) me->bb = MEM_callocN(sizeof(BoundBox), "boundbox");
bb = me->bb;
if (!r_loc) r_loc = mloc;
if (!r_size) r_size = msize;
-
+
INIT_MINMAX(min, max);
if (!BKE_mesh_minmax(me, min, max)) {
min[0] = min[1] = min[2] = -1.0f;
@@ -687,11 +687,11 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
}
mid_v3_v3v3(r_loc, min, max);
-
+
r_size[0] = (max[0] - min[0]) / 2.0f;
r_size[1] = (max[1] - min[1]) / 2.0f;
r_size[2] = (max[2] - min[2]) / 2.0f;
-
+
BKE_boundbox_init_from_minmax(bb, min, max);
bb->flag &= ~BOUNDBOX_DIRTY;
@@ -874,7 +874,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
Mesh *BKE_mesh_from_object(Object *ob)
{
-
+
if (ob == NULL) return NULL;
if (ob->type == OB_MESH) return ob->data;
else return NULL;
@@ -885,9 +885,9 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
Mesh *old = NULL;
multires_force_update(ob);
-
+
if (ob == NULL) return;
-
+
if (ob->type == OB_MESH) {
old = ob->data;
if (old)
@@ -895,7 +895,7 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
ob->data = me;
id_us_plus((ID *)me);
}
-
+
test_object_materials(bmain, ob, (ID *)me);
test_object_modifiers(ob);
@@ -966,7 +966,7 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r
}
-void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
+void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
{
Mesh *me = meshOb->data;
int i;
@@ -981,7 +981,7 @@ void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth)
mp->flag &= ~ME_SMOOTH;
}
}
-
+
for (i = 0; i < me->totface; i++) {
MFace *mf = &me->mface[i];
@@ -1023,7 +1023,7 @@ int poly_find_loop_from_vert(
if (loopstart->v == vert)
return j;
}
-
+
return -1;
}
@@ -1040,7 +1040,7 @@ int poly_get_adj_loops_from_vert(
int corner = poly_find_loop_from_vert(poly,
&mloop[poly->loopstart],
vert);
-
+
if (corner != -1) {
#if 0 /* unused - this loop */
const MLoop *ml = &mloop[poly->loopstart + corner];
@@ -1076,7 +1076,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3])
for (mvert = me->mvert; i--; mvert++) {
minmax_v3v3_v3(r_min, r_max, mvert->co);
}
-
+
return (me->totvert != 0);
}
@@ -1119,7 +1119,7 @@ void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
for (mvert = me->mvert; i--; mvert++) {
add_v3_v3(mvert->co, offset);
}
-
+
if (do_keys && me->key) {
KeyBlock *kb;
for (kb = me->key->block.first; kb; kb = kb->next) {