[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11792] branches/soc-2007-red_fox/source/ blender/blenkernel: Fixed problem with uneven beveling
Levi Schooley
redfox at hhofministries.org
Wed Aug 22 21:30:00 CEST 2007
Revision: 11792
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11792
Author: red_fox
Date: 2007-08-22 21:30:00 +0200 (Wed, 22 Aug 2007)
Log Message:
-----------
Fixed problem with uneven beveling
Somewhere during the past few commits, multiple recursion levels were causing the bevel to inset unevenly. Also, the result wasn't "rounded" enough.
Levi
Modified Paths:
--------------
branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h
branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c
Modified: branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h 2007-08-22 18:34:47 UTC (rev 11791)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/BKE_bmesh.h 2007-08-22 19:30:00 UTC (rev 11792)
@@ -213,6 +213,7 @@
float factor; /* primary scaling factor; also accumulates number of weighted edges for beveling tool */
float weight; /* another scaling factor; used primarily for propogating vertex weights to transforms; */
/* weight is also used across recursive bevels to help with the math */
+ float maxfactor; /* the unscaled, original factor (used only by "edge verts" in recursive beveling) */
float max; /* the maximum distance this vert can be transformed; negative is infinite */
} BME_TransData;
Modified: branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c
===================================================================
--- branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c 2007-08-22 18:34:47 UTC (rev 11791)
+++ branches/soc-2007-red_fox/source/blender/blenkernel/intern/BME_tools.c 2007-08-22 19:30:00 UTC (rev 11792)
@@ -193,7 +193,7 @@
BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,
float *co, float *org, float *vec, float *loc,
- float factor, float weight, float max) {
+ float factor, float weight, float maxfactor, float max) {
BME_TransData *vtd;
int is_new = 0;
@@ -223,6 +223,7 @@
vtd->factor = factor;
vtd->weight = weight;
+ vtd->maxfactor = maxfactor;
vtd->max = max;
return vtd;
@@ -423,7 +424,7 @@
BME_Vert *sv, *v2, *v3;
BME_Loop *lv1, *lv2;
BME_Edge *ne, *e1, *e2;
- float factor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3];
+ float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3];
int is_edge, forward, is_split_vert;
if (l == NULL) {
@@ -455,7 +456,7 @@
e1 = e2;
}
sv = BME_split_edge(bm,v,e1,&ne,0);
- BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1); /* quick default */
+ BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, -1); /* quick default */
sv->tflag1 |= BME_BEVEL_BEVEL;
ne->tflag1 = BME_BEVEL_ORIG; /* mark edge as original, even though it isn't */
BME_bevel_get_vec(vec1,v1,v,td);
@@ -494,7 +495,7 @@
else {
is_split_vert = 0;
sv = BME_split_edge(bm,v,l->e,&ne,0);
- BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1); /* quick default */
+ BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, -1); /* quick default */
sv->tflag1 |= BME_BEVEL_BEVEL;
ne->tflag1 = BME_BEVEL_ORIG; /* mark edge as original, even though it isn't */
}
@@ -528,25 +529,26 @@
}
if (is_edge && vtd1->loc != NULL) {
- factor = vtd1->factor;
+ maxfactor = vtd1->maxfactor;
}
else {
- factor = scale*BME_bevel_project_vec(vec1,vec2,up_vec,forward,td);
+ maxfactor = scale*BME_bevel_project_vec(vec1,vec2,up_vec,forward,td);
+ if (vtd->maxfactor > 0 && vtd->maxfactor < maxfactor) {
+ maxfactor = vtd->maxfactor;
+ }
}
- if (vtd->factor > 0 && vtd->factor < factor) {
- factor = vtd->factor;
- }
-
dis = (v1->tflag1 & BME_BEVEL_ORIG)? len/3 : len/2;
- if (is_edge || dis > factor*value) {
- dis = factor*value;
+ if (is_edge || dis > maxfactor*value) {
+ dis = maxfactor*value;
}
VECADDFAC(sv->co,v->co,vec1,dis);
VECSUB(vec1,sv->co,vtd1->org);
dis = VecLength(vec1);
Normalize(vec1);
- BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, vtd1->max);
+ if (!(is_split_vert && dis == 0)) {
+ BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd1->max);
+ }
return sv;
}
@@ -814,7 +816,7 @@
}
else {
/* we'll use vtd->loc == NULL to mark that this vert is not moving */
- vtd = BME_assign_transdata(td, bm, v, v->co, NULL, NULL, NULL, factor, weight, -1);
+ vtd = BME_assign_transdata(td, bm, v, v->co, NULL, NULL, NULL, factor, weight, -1, -1);
}
}
@@ -865,7 +867,7 @@
else {
len = BME_cycle_length(BME_disk_getpointer(v->edge,v));
/* we'll assign a default transform data to every vert (except the loose ones) */
- vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1);
+ vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, -1);
}
/* check for non-manifold vert */
@@ -892,11 +894,11 @@
}
}
if (!dw || dw->weight == 0.0) continue;
- vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, dw->weight, -1);
+ vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, dw->weight, -1, -1);
v->tflag1 |= BME_BEVEL_BEVEL;
}
else {
- vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1);
+ vtd = BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, -1);
v->tflag1 |= BME_BEVEL_BEVEL;
}
}
More information about the Bf-blender-cvs
mailing list