[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45801] branches/soc-2011-tomato: Merging r45792 through r45800 from trunk into soc-2011-tomato
Sergey Sharybin
sergey.vfx at gmail.com
Fri Apr 20 11:57:03 CEST 2012
Revision: 45801
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45801
Author: nazgul
Date: 2012-04-20 09:57:03 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
Merging r45792 through r45800 from trunk into soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45792
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45800
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/bmesh/bmesh.h
branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_core.c
branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_iterators_inline.h
branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c
branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.c
branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.h
branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_inset.c
branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_rip.c
branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_tools.c
branches/soc-2011-tomato/source/blender/python/bmesh/bmesh_py_types.c
branches/soc-2011-tomato/source/tools/uncrustify.cfg
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-45791
+ /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-45800
Modified: branches/soc-2011-tomato/source/blender/bmesh/bmesh.h
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/bmesh.h 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/bmesh.h 2012-04-20 09:57:03 UTC (rev 45801)
@@ -202,7 +202,7 @@
#include "DNA_customdata_types.h" /* BMesh struct in bmesh_class.h uses */
#include <stdlib.h>
-// #include "BLI_utildefines.h"
+#include <stdio.h>
#include "bmesh_class.h"
Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_core.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_core.c 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_core.c 2012-04-20 09:57:03 UTC (rev 45801)
@@ -814,8 +814,7 @@
do {
i += BM_ELEM_API_FLAG_TEST(e, flag) ? 1 : 0;
- e = bmesh_disk_edge_next(e, v);
- } while (e != v->e);
+ } while ((e = bmesh_disk_edge_next(e, v)) != v->e);
return i;
}
Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_iterators_inline.h
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_iterators_inline.h 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_iterators_inline.h 2012-04-20 09:57:03 UTC (rev 45801)
@@ -59,14 +59,20 @@
/* inlining optimizes out this switch when called with the defined type */
switch ((BMIterType)itype) {
case BM_VERTS_OF_MESH:
+ BLI_assert(bm != NULL);
+ BLI_assert(data == NULL);
iter->begin = bmiter__vert_of_mesh_begin;
iter->step = bmiter__vert_of_mesh_step;
break;
case BM_EDGES_OF_MESH:
+ BLI_assert(bm != NULL);
+ BLI_assert(data == NULL);
iter->begin = bmiter__edge_of_mesh_begin;
iter->step = bmiter__edge_of_mesh_step;
break;
case BM_FACES_OF_MESH:
+ BLI_assert(bm != NULL);
+ BLI_assert(data == NULL);
iter->begin = bmiter__face_of_mesh_begin;
iter->step = bmiter__face_of_mesh_step;
break;
@@ -161,10 +167,14 @@
iter->edata = data;
break;
default:
+ /* should never happen */
+ BLI_assert(0);
+ return FALSE;
break;
}
+
+ iter->begin(iter);
- iter->begin(iter);
return TRUE;
}
Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_opdefines.c 2012-04-20 09:57:03 UTC (rev 45801)
@@ -1099,6 +1099,7 @@
{BMO_OP_SLOT_BOOL, "use_even_offset"},
{BMO_OP_SLOT_BOOL, "use_relative_offset"},
{BMO_OP_SLOT_FLT, "thickness"},
+ {BMO_OP_SLOT_FLT, "depth"},
{BMO_OP_SLOT_BOOL, "use_outset"},
{0} /* null-terminating sentinel */},
bmo_inset_exec,
Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.c 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.c 2012-04-20 09:57:03 UTC (rev 45801)
@@ -309,6 +309,59 @@
}
/**
+ * The function takes a vertex at the center of a fan and returns the opposite edge in the fan.
+ * All edges in the fan must be manifold, otherwise return NULL.
+ *
+ * \note This could (probably) be done more effieiently.
+ */
+BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
+{
+ BMLoop *l_a;
+ int tot = 0;
+ int i;
+
+ BLI_assert(BM_vert_in_edge(e_first, v));
+
+ l_a = e_first->l;
+ do {
+ l_a = BM_loop_other_vert_loop(l_a, v);
+ l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+ if (BM_edge_is_manifold(l_a->e)) {
+ l_a = l_a->radial_next;
+ }
+ else {
+ return NULL;
+ }
+
+ tot++;
+ } while (l_a != e_first->l);
+
+ /* we know the total, now loop half way */
+ tot /= 2;
+ i = 0;
+
+ l_a = e_first->l;
+ do {
+ if (i == tot) {
+ l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+ return l_a->e;
+ }
+
+ l_a = BM_loop_other_vert_loop(l_a, v);
+ l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+ if (BM_edge_is_manifold(l_a->e)) {
+ l_a = l_a->radial_next;
+ }
+ /* this wont have changed from the previous loop */
+
+
+ i++;
+ } while (l_a != e_first->l);
+
+ return NULL;
+}
+
+/**
* Returms edge length
*/
float BM_edge_length_calc(BMEdge *e)
@@ -867,6 +920,26 @@
}
/**
+ * \note this isn't optimal to run on an array of verts,
+ * see 'solidify_add_thickness' for a function which runs on an array.
+ */
+float BM_vert_shell_factor(BMVert *v)
+{
+ BMIter iter;
+ BMLoop *l;
+ float accum_shell = 0.0f;
+ float accum_angle = 0.0f;
+
+ BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+ const float face_angle = BM_loop_face_angle(l);
+ accum_shell += shell_angle_to_dist(angle_normalized_v3v3(v->no, l->f->no)) * face_angle;
+ accum_angle += face_angle;
+ }
+
+ return accum_shell / accum_angle;
+}
+
+/**
* Returns the edge existing between v1 and v2, or NULL if there isn't one.
*
* \note multiple edges may exist between any two vertices, and therefore
Modified: branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.h
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.h 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/intern/bmesh_queries.h 2012-04-20 09:57:03 UTC (rev 45801)
@@ -49,6 +49,7 @@
int BM_vert_edge_count(BMVert *v);
int BM_edge_face_count(BMEdge *e);
int BM_vert_face_count(BMVert *v);
+BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e);
int BM_vert_is_wire(BMVert *v);
int BM_edge_is_wire(BMEdge *e);
@@ -65,6 +66,7 @@
void BM_edge_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]);
float BM_vert_edge_angle(BMVert *v);
+float BM_vert_shell_factor(BMVert *v);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
Modified: branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_inset.c
===================================================================
--- branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_inset.c 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/bmesh/operators/bmo_inset.c 2012-04-20 09:57:03 UTC (rev 45801)
@@ -80,7 +80,23 @@
}
}
+float bm_vert_avg_tag_dist(BMVert *v)
+{
+ BMIter iter;
+ BMEdge *e;
+ int tot;
+ float length = 0.0f;
+ BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
+ BMVert *v_other = BM_edge_other_vert(e, v);
+ if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
+ length += BM_edge_length_calc(e);
+ }
+ }
+
+ return length / (float)tot;
+}
+
/**
* implementation is as follows...
*
@@ -98,7 +114,8 @@
const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
const int use_even_boundry = use_even_offset; /* could make own option */
const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
- const float thickness = BMO_slot_float_get(op, "thickness");
+ const float thickness = BMO_slot_float_get(op, "thickness");
+ const float depth = BMO_slot_float_get(op, "depth");
int edge_info_len = 0;
@@ -482,4 +499,42 @@
/* we could flag new edges/verts too, is it useful? */
BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
+
+ /* cheap feature to add depth to the inset */
+ if (depth != 0.0f) {
+ float (*varr_co)[3];
+ BMOIter oiter;
+
+ /* untag verts */
+ BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
+
+ /* tag face verts */
+ BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+ BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
+ BM_elem_flag_enable(v, BM_ELEM_TAG);
+ }
+ }
+
+ /* do in 2 passes so moving the verts doesn't feed back into face angle checks
+ * which BM_vert_shell_factor uses. */
+
+ /* over allocate */
+ varr_co = MEM_callocN(sizeof(*varr_co) * bm->totvert, __func__);
+
+ BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
+ if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+ const float fac = (depth *
+ (use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) *
+ (use_even_boundry ? BM_vert_shell_factor(v) : 1.0f));
+ madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac);
+ }
+ }
+
+ BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
+ if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+ copy_v3_v3(v->co, varr_co[i]);
+ }
+ }
+ MEM_freeN(varr_co);
+ }
}
Modified: branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_rip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_rip.c 2012-04-20 08:23:49 UTC (rev 45800)
+++ branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_rip.c 2012-04-20 09:57:03 UTC (rev 45801)
@@ -66,7 +66,7 @@
return dist_to_line_segment_v2(mvalf, vec1, vec2);
}
-static float edbm_rip_edge_side_measure(BMEdge *e,
+static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
ARegion *ar,
float projectMat[4][4], const float fmval[2])
{
@@ -80,6 +80,8 @@
BMVert *v1_other;
BMVert *v2_other;
+ BLI_assert(BM_vert_in_edge(e, e_l->v));
+
/* method for calculating distance:
*
* for each edge: calculate face center, then made a vector
@@ -88,8 +90,8 @@
/* rather then the face center, get the middle of
* both edge verts connected to this one */
- v1_other = BM_face_other_vert_loop(e->l->f, e->v2, e->v1)->v;
- v2_other = BM_face_other_vert_loop(e->l->f, e->v1, e->v2)->v;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list