Revision: 35484
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35484
Author:   nicholasbishop
Date:     2011-03-12 02:12:02 +0000 (Sat, 12 Mar 2011)
Log Message:
-----------
== Sculpt ==

* Removed some fields from struct SculptSession:
  - Fields drawobject, projverts, and previous_r were completely
    unused
  - Field `ob' was really unnecessary, changed sculpt functions
    to pass the object rather than the SculptSession

This removal of `ob' from SculptSession should should make it a little
easier to continue generalizing paint/sculpt functionality.

There should be no visible changes from cleanup.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_paint.h
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_undo.c

Modified: trunk/blender/source/blender/blenkernel/BKE_paint.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_paint.h 2011-03-12 01:09:40 UTC 
(rev 35483)
+++ trunk/blender/source/blender/blenkernel/BKE_paint.h 2011-03-12 02:12:02 UTC 
(rev 35484)
@@ -32,8 +32,6 @@
  *  \ingroup bke
  */
 
-#include "DNA_vec_types.h"
-
 struct Brush;
 struct MFace;
 struct MultireModifierData;
@@ -65,15 +63,12 @@
 /* Session data (mode-specific) */
 
 typedef struct SculptSession {
-       struct ProjVert *projverts;
-
        /* Mesh data (not copied) can come either directly from a Mesh, or from 
a MultiresDM */
        struct MultiresModifierData *multires; /* Special handling for multires 
meshes */
        struct MVert *mvert;
        struct MFace *mface;
        int totvert, totface;
        float *face_normals;
-       struct Object *ob;
        struct KeyBlock *kb;
        
        /* Mesh connectivity */
@@ -99,10 +94,6 @@
 
        struct SculptStroke *stroke;
        struct StrokeCache *cache;
-
-       struct GPUDrawObject *drawobject;
-
-       rcti previous_r;
 } SculptSession;
 
 void free_sculptsession(struct Object *ob);

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2011-03-12 
01:09:40 UTC (rev 35483)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2011-03-12 
02:12:02 UTC (rev 35484)
@@ -4319,7 +4319,6 @@
 
        if(ob->sculpt) {
                ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt 
session");
-               ob->sculpt->ob= ob;
        }
 }
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c    
2011-03-12 01:09:40 UTC (rev 35483)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c    
2011-03-12 02:12:02 UTC (rev 35484)
@@ -390,7 +390,7 @@
                if (*pixel_radius == 0)
                        *pixel_radius = brush_size(stroke->brush);
 
-               mul_m4_v3(stroke->vc.obact->sculpt->ob->obmat, location);
+               mul_m4_v3(stroke->vc.obact->obmat, location);
 
                hit = 1;
        }

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c  2011-03-12 
01:09:40 UTC (rev 35483)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c  2011-03-12 
02:12:02 UTC (rev 35484)
@@ -814,8 +814,9 @@
        }
 }
 
-static void calc_area_normal(Sculpt *sd, SculptSession *ss, float an[3], 
PBVHNode **nodes, int totnode)
+static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode 
**nodes, int totnode)
 {
+       SculptSession *ss = ob->sculpt;
        int n;
 
        float out_flip[3] = {0.0f, 0.0f, 0.0f};
@@ -832,7 +833,7 @@
                float private_an[3] = {0.0f, 0.0f, 0.0f};
                float private_out_flip[3] = {0.0f, 0.0f, 0.0f};
 
-               unode = sculpt_undo_push_node(ss, nodes[n]);
+               unode = sculpt_undo_push_node(ob, nodes[n]);
                sculpt_brush_test_init(ss, &test);
 
                if(ss->cache->original) {
@@ -878,8 +879,9 @@
 
 /* This initializes the faces to be moved for this sculpt for 
draw/layer/flatten; then it
  finds average normal for all active vertices - note that this is called once 
for each mirroring direction */
-static void calc_sculpt_normal(Sculpt *sd, SculptSession *ss, float an[3], 
PBVHNode **nodes, int totnode)
+static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode 
**nodes, int totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
 
        if (ss->cache->mirror_symmetry_pass == 0 &&
@@ -910,7 +912,7 @@
                                break;
 
                        case SCULPT_DISP_DIR_AREA:
-                               calc_area_normal(sd, ss, an, nodes, totnode);
+                               calc_area_normal(sd, ob, an, nodes, totnode);
 
                        default:
                                break;
@@ -1113,8 +1115,9 @@
        }
 }
 
-static void smooth(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int 
totnode, float bstrength)
+static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, 
float bstrength)
 {
+       SculptSession *ss = ob->sculpt;
        const int max_iterations = 4;
        const float fract = 1.0f/max_iterations;
        int iteration, n, count;
@@ -1136,23 +1139,25 @@
                }
 
                if(ss->multires)
-                       multires_stitch_grids(ss->ob);
+                       multires_stitch_grids(ob);
        }
 }
 
-static void do_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
-       smooth(sd, ss, nodes, totnode, ss->cache->bstrength);
+       SculptSession *ss = ob->sculpt;
+       smooth(sd, ob, nodes, totnode, ss->cache->bstrength);
 }
 
-static void do_draw_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int 
totnode)
+static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float offset[3], area_normal[3];
        float bstrength= ss->cache->bstrength;
        int n;
 
-       calc_sculpt_normal(sd, ss, area_normal, nodes, totnode);
+       calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
        
        /* offset with as much as possible factored in already */
        mul_v3_v3fl(offset, area_normal, ss->cache->radius);
@@ -1186,15 +1191,16 @@
        }
 }
 
-static void do_crease_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float offset[3], area_normal[3];
        float bstrength= ss->cache->bstrength;
        float flippedbstrength, crease_correction;
        int n;
 
-       calc_sculpt_normal(sd, ss, area_normal, nodes, totnode);
+       calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
        
        /* offset with as much as possible factored in already */
        mul_v3_v3fl(offset, area_normal, ss->cache->radius);
@@ -1249,8 +1255,9 @@
        }
 }
 
-static void do_pinch_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float bstrength= ss->cache->bstrength;
        int n;
@@ -1281,8 +1288,9 @@
        }
 }
 
-static void do_grab_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int 
totnode)
+static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush= paint_brush(&sd->paint);
        float bstrength= ss->cache->bstrength;
        float grab_delta[3], an[3];
@@ -1293,7 +1301,7 @@
                int cache= 1;
                /* grab brush requires to test on original data */
                SWAP(int, ss->cache->original, cache);
-               calc_sculpt_normal(sd, ss, an, nodes, totnode);
+               calc_sculpt_normal(sd, ob, an, nodes, totnode);
                SWAP(int, ss->cache->original, cache);
        }
        
@@ -1316,7 +1324,7 @@
                short (*origno)[3];
                float (*proxy)[3];
 
-               unode=  sculpt_undo_push_node(ss, nodes[n]);
+               unode=  sculpt_undo_push_node(ob, nodes[n]);
                origco= unode->co;
                origno= unode->no;
 
@@ -1338,8 +1346,9 @@
        }
 }
 
-static void do_nudge_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float bstrength = ss->cache->bstrength;
        float grab_delta[3];
@@ -1349,7 +1358,7 @@
 
        copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 
-       calc_sculpt_normal(sd, ss, an, nodes, totnode);
+       calc_sculpt_normal(sd, ob, an, nodes, totnode);
 
        cross_v3_v3v3(tmp, an, grab_delta);
        cross_v3_v3v3(cono, tmp, an);
@@ -1378,8 +1387,9 @@
        }
 }
 
-static void do_snake_hook_brush(Sculpt *sd, SculptSession *ss, PBVHNode 
**nodes, int totnode)
+static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float bstrength = ss->cache->bstrength;
        float grab_delta[3], an[3];
@@ -1387,7 +1397,7 @@
        float len;
 
        if (brush->normal_weight > 0 || brush->flag & BRUSH_FRONTFACE)
-               calc_sculpt_normal(sd, ss, an, nodes, totnode);
+               calc_sculpt_normal(sd, ob, an, nodes, totnode);
 
        copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 
@@ -1426,8 +1436,9 @@
        }
 }
 
-static void do_thumb_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float bstrength = ss->cache->bstrength;
        float grab_delta[3];
@@ -1437,7 +1448,7 @@
 
        copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 
-       calc_sculpt_normal(sd, ss, an, nodes, totnode);
+       calc_sculpt_normal(sd, ob, an, nodes, totnode);
 
        cross_v3_v3v3(tmp, an, grab_delta);
        cross_v3_v3v3(cono, tmp, an);
@@ -1451,7 +1462,7 @@
                short (*origno)[3];
                float (*proxy)[3];
 
-               unode=  sculpt_undo_push_node(ss, nodes[n]);
+               unode=  sculpt_undo_push_node(ob, nodes[n]);
                origco= unode->co;
                origno= unode->no;
 
@@ -1473,8 +1484,9 @@
        }
 }
 
-static void do_rotate_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush= paint_brush(&sd->paint);
        float bstrength= ss->cache->bstrength;
        float an[3];
@@ -1483,7 +1495,7 @@
        static const int flip[8] = { 1, -1, -1, 1, -1, 1, 1, -1 };
        float angle = ss->cache->vertex_rotation * 
flip[ss->cache->mirror_symmetry_pass];
 
-       calc_sculpt_normal(sd, ss, an, nodes, totnode);
+       calc_sculpt_normal(sd, ob, an, nodes, totnode);
 
        axis_angle_to_mat3(m, an, angle);
 
@@ -1496,7 +1508,7 @@
                short (*origno)[3];
                float (*proxy)[3];
 
-               unode=  sculpt_undo_push_node(ss, nodes[n]);
+               unode=  sculpt_undo_push_node(ob, nodes[n]);
                origco= unode->co;
                origno= unode->no;
 
@@ -1520,8 +1532,9 @@
        }
 }
 
-static void do_layer_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, 
int totnode)
+static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int 
totnode)
 {
+       SculptSession *ss = ob->sculpt;
        Brush *brush = paint_brush(&sd->paint);
        float bstrength= ss->cache->bstrength;
        float area_normal[3], offset[3];
@@ -1531,7 +1544,7 @@
        if(bstrength < 0)
                lim = -lim;
 
-       calc_sculpt_normal(sd, ss, area_normal, nodes, totnode);
+       calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
 

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to