add fallbacks for BM_vert_calc_shell_factor() and BM_vert_calc_mean_tagged_edge_lengt...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 9 Nov 2012 08:28:14 +0000 (08:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 9 Nov 2012 08:28:14 +0000 (08:28 +0000)
also style cleanup.

source/blender/blenkernel/intern/anim.c
source/blender/blenlib/PIL_time.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/operators/bmo_bevel.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform.c
source/blender/windowmanager/intern/wm_event_system.c

index 1aed26db48d5e4998979b9214c113100c59207f1..f5c0660371bfb06201c8a06ba35a050872006ab6 100644 (file)
@@ -727,7 +727,7 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
         * goes first in the array. */
        dob->persistent_id[0] = index;
        for (i = 1; i < level; i++)
-               dob->persistent_id[i] = persistent_id[level-1-i];
+               dob->persistent_id[i] = persistent_id[level - 1 - i];
        
        /* metaballs never draw in duplis, they are instead merged into one by the basis
         * mball outside of the group. this does mean that if that mball is not in the
@@ -1647,7 +1647,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 
        /* keep track of persistent id */
        if (level > 0)
-               persistent_id[level-1] = index;
+               persistent_id[level - 1] = index;
 
        if (ob->transflag & OB_DUPLIPARTS) {
                ParticleSystem *psys = ob->particlesystem.first;
@@ -1694,7 +1694,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 
        /* clear persistent id */
        if (level > 0)
-               persistent_id[level-1] = 0;
+               persistent_id[level - 1] = 0;
 }
 
 /* Returns a list of DupliObject
index afad190ba23b5fe24d34750b713a9774d8f4ad31..c3e7e8486d91359dfcf10a1495e48d8c7f433bfe 100644 (file)
@@ -20,7 +20,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Campbell Barton
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -76,7 +76,10 @@ void    PIL_sleep_ms(int ms);
        fflush(stdout);                                                           \
 } (void)0
 
-
+/**
+ * Given some function/expression:
+ *   TIMEIT_BENCH(some_function(), some_unique_description);
+ */
 #define TIMEIT_BENCH(expr, id)                                                \
        {                                                                         \
                TIMEIT_START(id);                                                     \
index ed36a86274cafcddf42f06481cb83904c8caf01f..8eb87cf29be5b78dc9de404df5ef493a5b42ea79 100644 (file)
@@ -1024,7 +1024,12 @@ float BM_vert_calc_shell_factor(BMVert *v)
                accum_angle += face_angle;
        }
 
-       return accum_shell / accum_angle;
+       if (accum_angle != 0.0f) {
+               return accum_shell / accum_angle;
+       }
+       else {
+               return 1.0f;
+       }
 }
 
 /**
@@ -1045,7 +1050,12 @@ float BM_vert_calc_mean_tagged_edge_length(BMVert *v)
                }
        }
 
-       return length / (float)tot;
+       if (tot) {
+               return length / (float)tot;
+       }
+       else {
+               return 0.0f;
+       }
 }
 
 
index 8ced18d6d9070ce092a785e6ed18f4cbc2bccf7a..50d3598dba203058e9d1167668b9562072b576eb 100644 (file)
@@ -1155,8 +1155,7 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMOperator *op, BMV
        /* Gather input selected edges.
         * Only bevel selected edges that have exactly two incident faces. */
        BMO_ITER (bme, &siter, bm, op, "geom", BM_EDGE) {
-               if ((bme->v1 == v) || (BM_edge_other_vert(bme, bme->v1) == v))
-               {
+               if ((bme->v1 == v) || (BM_edge_other_vert(bme, bme->v1) == v)) {
                        if (BM_edge_face_count(bme) == 2) {
                                BMO_elem_flag_enable(bm, bme, EDGE_SELECTED);
                                nsel++;
index 60cf9a3c4c4a5eda6da9269462552bc9ca3303d3..db74179b569c1a03e73e08f2699ef60f2ccfdc6a 100644 (file)
@@ -1214,7 +1214,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 
                        hmargin = 0.1f  * (x2 - x1);
                        vmargin = 0.05f * (y2 - y1);
-                       uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1+vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
+                       uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
 
                        hmargin = 0.035f * (x2 - x1);
                        vmargin = 0.035f * (y2 - y1);
index 961e5c49ab205ee37f626c7eb333092ccc39e5ad..1334db63865efa383077b3440dd915814391f149 100644 (file)
@@ -1223,7 +1223,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                break;
                        case LEFTALTKEY:
                        case RIGHTALTKEY:
-                               if (ELEM(t->spacetype ,SPACE_SEQ, SPACE_VIEW3D)) {
+                               if (ELEM(t->spacetypeSPACE_SEQ, SPACE_VIEW3D)) {
                                        t->flag |= T_ALT_TRANSFORM;
                                        t->redraw |= TREDRAW_HARD;
                                }
index 236ab264f8cac5aa9b89725c60543bd2b096979e..14244de00f61f6ddf814a976d844cb8d3e54df94 100644 (file)
@@ -2979,9 +2979,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
                                event.keymodifier = 0;
                        
                        /* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */
-                       if (event.type == ESCKEY && event.val == KM_PRESS && 
-                               event.shift == 0 && event.ctrl == 0 && event.alt == 0)
-                                       G.is_break = TRUE;
+                       if ((event.type == ESCKEY && event.val == KM_PRESS) &&
+                           /* check other modifiers because ms-windows uses these to bring up the task manager */
+                           (event.shift == 0 && event.ctrl == 0 && event.alt == 0))
+                       {
+                               G.is_break = TRUE;
+                       }
                        
                        /* double click test - only for press */
                        if (event.val == KM_PRESS) {