Revision: 42455
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42455
Author:   campbellbarton
Date:     2011-12-06 08:07:12 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
remove double lookus in BM_GetCDf/BM_SetCDf, also remove 
bm_cdata_get_single_float which was a duplicate of BM_GetCDf.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c   
2011-12-06 07:24:52 UTC (rev 42454)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c   
2011-12-06 08:07:12 UTC (rev 42455)
@@ -936,20 +936,12 @@
 
 float BM_GetCDf(CustomData *cd, void *element, int type)
 {
-       if (CustomData_has_layer(cd, type)) {
-               float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, 
type);
-               return *f;
-       }
-
-       return 0.0;
+       float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type);
+       return f ? *f : 0.0f;
 }
 
 void BM_SetCDf(CustomData *cd, void *element, int type, float val)
 {
-       if (CustomData_has_layer(cd, type)) {
-               float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, 
type);
-               *f = val;
-       }
-
-       return;
+       float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type);
+       if (f) *f = val;
 }

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c   
2011-12-06 07:24:52 UTC (rev 42454)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_select.c   
2011-12-06 08:07:12 UTC (rev 42455)
@@ -1174,19 +1174,6 @@
        }
 }
 
-static float bm_cdata_get_single_float(BMesh *UNUSED(bm), CustomData *cdata, 
void *element, int type)
-{
-       BMHeader *ele = element;
-       float *f;
-       
-       if (!CustomData_has_layer(cdata, type))
-               return 0.0f;
-       
-       f = CustomData_bmesh_get(cdata, ele->data, type);
-       
-       return *f;
-}
-
 static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e)
 {
        switch (scene->toolsettings->edge_mode) {
@@ -1197,9 +1184,9 @@
        case EDGE_MODE_TAG_SHARP:
                return BM_TestHFlag(e, BM_SHARP);
        case EDGE_MODE_TAG_CREASE:      
-               return bm_cdata_get_single_float(em->bm, &em->bm->edata, e, 
CD_CREASE) ? 1 : 0;
+               return BM_GetCDf(&em->bm->edata, e, CD_CREASE) ? 1 : 0;
        case EDGE_MODE_TAG_BEVEL:
-               return bm_cdata_get_single_float(em->bm, &em->bm->edata, e, 
CD_BWEIGHT) ? 1 : 0;
+               return BM_GetCDf(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0;
        }
        return 0;
 }

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c    
2011-12-06 07:24:52 UTC (rev 42454)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c    
2011-12-06 08:07:12 UTC (rev 42455)
@@ -4492,11 +4492,9 @@
                
                df *= 2.0;
        }
-       
-       for (i=0; i<BLI_array_count(w); i++) {
-               w[i] /= ftot;
-       }
 
+       mul_vn_fl(w, BLI_array_count(w), 1.0f / (float)ftot);
+
        fac = factor;
        for (i=0; i<BLI_array_count(w); i++) {
                fac = w[BLI_array_count(w)-i-1]*factor;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to