Cleanup: remove unused face normals
authorCampbell Barton <ideasman42@gmail.com>
Fri, 17 Apr 2015 10:55:33 +0000 (20:55 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 17 Apr 2015 13:50:23 +0000 (23:50 +1000)
also use const

extern/rangetree/range_tree_c_api.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/paint.c
source/blender/editors/sculpt_paint/sculpt.c

index f0a2af4a29a68aed925cc21e7f6649827f61668f..6abfb6bd55e3386b85610fdb2091bbc5008a6a51 100644 (file)
@@ -14,8 +14,8 @@
    02110-1301, USA.
 */
 
    02110-1301, USA.
 */
 
-#ifndef RANGE_TREE_C_API_H
-#define RANGE_TREE_C_API_H
+#ifndef __RANGE_TREE_C_API_H__
+#define __RANGE_TREE_C_API_H__
 
 #ifdef __cplusplus
 extern "C" {
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,4 +59,4 @@ unsigned int range_tree_uint_allocation_lower_bound(const RangeTreeUInt *rt);
 }
 #endif
 
 }
 #endif
 
-#endif /* __DUALCON_H__ */
+#endif /* __RANGE_TREE_C_API_H__ */
index 53c2a82fb8e1a35d576b9aa64284cfe689bf73a1..34b645ea62cae0dc64972fc0e1944f1d3ba4eab7 100644 (file)
@@ -156,7 +156,6 @@ typedef struct SculptSession {
        struct MPoly *mpoly;
        struct MLoop *mloop;
        int totvert, totpoly;
        struct MPoly *mpoly;
        struct MLoop *mloop;
        int totvert, totpoly;
-       float (*face_normals)[3];
        struct KeyBlock *kb;
        float *vmask;
        
        struct KeyBlock *kb;
        float *vmask;
        
index fd5d14b6cfc75faf9790de522a4447354dbff9c4..3900ba8b5eacf4a62fcd28e088734728bd123d0c 100644 (file)
@@ -788,7 +788,6 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
                ss->mvert = NULL;
                ss->mpoly = NULL;
                ss->mloop = NULL;
                ss->mvert = NULL;
                ss->mpoly = NULL;
                ss->mloop = NULL;
-               ss->face_normals = NULL;
        }
        else {
                ss->totvert = me->totvert;
        }
        else {
                ss->totvert = me->totvert;
@@ -796,7 +795,6 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
                ss->mvert = me->mvert;
                ss->mpoly = me->mpoly;
                ss->mloop = me->mloop;
                ss->mvert = me->mvert;
                ss->mpoly = me->mpoly;
                ss->mloop = me->mloop;
-               ss->face_normals = NULL;
                ss->multires = NULL;
                ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
        }
                ss->multires = NULL;
                ss->vmask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
        }
index 2c76b3dee21643008381aff8edd00a28828c39a6..67d81ab75b7a63c2a3d0ce3c1e5eb63a459147c1 100644 (file)
@@ -182,8 +182,6 @@ typedef struct StrokeCache {
        ViewContext *vc;
        Brush *brush;
 
        ViewContext *vc;
        Brush *brush;
 
-       float (*face_norms)[3]; /* Copy of the mesh faces' normals */
-
        float special_rotation;
        float grab_delta[3], grab_delta_symmetry[3];
        float old_grab_location[3], orig_grab_location[3];
        float special_rotation;
        float grab_delta[3], grab_delta_symmetry[3];
        float old_grab_location[3], orig_grab_location[3];
@@ -345,9 +343,7 @@ static int sculpt_stroke_dynamic_topology(const SculptSession *ss,
 static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
 {
        SculptSession *ss = ob->sculpt;
 static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
 {
        SculptSession *ss = ob->sculpt;
-       StrokeCache *cache = ss->cache;
        const Brush *brush = BKE_paint_brush(&sd->paint);
        const Brush *brush = BKE_paint_brush(&sd->paint);
-       int i;
 
        PBVHNode **nodes;
        int n, totnode;
 
        PBVHNode **nodes;
        int n, totnode;
@@ -400,12 +396,6 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
                }
        }
 
                }
        }
 
-       if (ss->face_normals) {
-               for (i = 0; i < ss->totpoly; i++) {
-                       copy_v3_v3(ss->face_normals[i], cache->face_norms[i]);
-               }
-       }
-
        if (nodes)
                MEM_freeN(nodes);
 }
        if (nodes)
                MEM_freeN(nodes);
 }
@@ -505,7 +495,7 @@ static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
        }
 }
 
        }
 }
 
-BLI_INLINE bool sculpt_brush_test_clipping(SculptBrushTest *test, const float co[3])
+BLI_INLINE bool sculpt_brush_test_clipping(const SculptBrushTest *test, const float co[3])
 {
        RegionView3D *rv3d = test->clip_rv3d;
        return (rv3d && (ED_view3d_clipping_test(rv3d, co, true)));
 {
        RegionView3D *rv3d = test->clip_rv3d;
        return (rv3d && (ED_view3d_clipping_test(rv3d, co, true)));
@@ -543,7 +533,7 @@ static bool sculpt_brush_test_sq(SculptBrushTest *test, const float co[3])
        }
 }
 
        }
 }
 
-static bool sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
+static bool sculpt_brush_test_fast(const SculptBrushTest *test, const float co[3])
 {
        if (sculpt_brush_test_clipping(test, co)) {
                return 0;
 {
        if (sculpt_brush_test_clipping(test, co)) {
                return 0;
@@ -551,7 +541,7 @@ static bool sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
        return len_squared_v3v3(co, test->location) <= test->radius_squared;
 }
 
        return len_squared_v3v3(co, test->location) <= test->radius_squared;
 }
 
-static bool sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
+static bool sculpt_brush_test_cube(SculptBrushTest *test, const float co[3], float local[4][4])
 {
        float side = M_SQRT1_2;
        float local_co[3];
 {
        float side = M_SQRT1_2;
        float local_co[3];
@@ -3503,8 +3493,6 @@ static const char *sculpt_tool_name(Sculpt *sd)
 
 static void sculpt_cache_free(StrokeCache *cache)
 {
 
 static void sculpt_cache_free(StrokeCache *cache)
 {
-       if (cache->face_norms)
-               MEM_freeN(cache->face_norms);
        if (cache->dial)
                MEM_freeN(cache->dial);
        MEM_freeN(cache);
        if (cache->dial)
                MEM_freeN(cache->dial);
        MEM_freeN(cache);
@@ -3764,13 +3752,6 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
 
        /* Make copies of the mesh vertex locations and normals for some tools */
        if (brush->flag & BRUSH_ANCHORED) {
 
        /* Make copies of the mesh vertex locations and normals for some tools */
        if (brush->flag & BRUSH_ANCHORED) {
-               if (ss->face_normals) {
-                       cache->face_norms = MEM_mallocN(sizeof(float) * 3 * ss->totpoly, "Sculpt face norms");
-                       for (i = 0; i < ss->totpoly; ++i) {
-                               copy_v3_v3(cache->face_norms[i], ss->face_normals[i]);
-                       }
-               }
-
                cache->original = 1;
        }
 
                cache->original = 1;
        }