Revision: 18505
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18505
Author:   nicholasbishop
Date:     2009-01-14 18:22:30 +0100 (Wed, 14 Jan 2009)

Log Message:
-----------
Fixed warnings in sculpt, also brought back brush curve.

Modified Paths:
--------------
    branches/blender2.5/blender/CMakeLists.txt
    branches/blender2.5/blender/source/blender/blenkernel/intern/brush.c
    branches/blender2.5/blender/source/blender/editors/include/ED_sculpt.h
    branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
    branches/blender2.5/blender/source/blender/editors/sculpt/sculpt_intern.h
    branches/blender2.5/blender/source/blender/editors/sculpt/stroke.c
    
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h

Modified: branches/blender2.5/blender/CMakeLists.txt
===================================================================
--- branches/blender2.5/blender/CMakeLists.txt  2009-01-14 16:54:36 UTC (rev 
18504)
+++ branches/blender2.5/blender/CMakeLists.txt  2009-01-14 17:22:30 UTC (rev 
18505)
@@ -197,7 +197,7 @@
   SET(PLATFORM_LINKFLAGS "-pthread")
 
   # Better warnings
-  SET(C_WARNINGS "-Wall -Wno-char-subscripts -W -Wshadow -Wpointer-arith 
-Wbad-function-cast -Wcast-qual -Wcast-align -Waggregate-return 
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
-Wnested-externs -Wredundant-decls")
+  SET(C_WARNINGS "-Wall -Wno-char-subscripts -W -Wshadow -Wpointer-arith 
-Wbad-function-cast -Wcast-qual -Wcast-align -Waggregate-return 
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
-Wnested-externs -Wredundant-decls -Wdeclaration-after-statement")
 
   INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
 ENDIF(UNIX)

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/brush.c        
2009-01-14 16:54:36 UTC (rev 18504)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/brush.c        
2009-01-14 17:22:30 UTC (rev 18505)
@@ -72,6 +72,8 @@
        brush->clone.alpha= 0.5;
        brush->sculpt_tool = SCULPT_TOOL_DRAW;
 
+       brush_curve_preset(brush, BRUSH_PRESET_SHARP);
+
        /* enable fake user by default */
        brush->id.flag |= LIB_FAKEUSER;
        brush_toggled_fake_user(brush);
@@ -222,8 +224,7 @@
        }
 }
 
-
-void sculpt_preset_curve(Brush *b, BrushCurvePreset preset)
+void brush_curve_preset(Brush *b, BrushCurvePreset preset)
 {
        CurveMap *cm = NULL;
 

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_sculpt.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_sculpt.h      
2009-01-14 16:54:36 UTC (rev 18504)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_sculpt.h      
2009-01-14 17:22:30 UTC (rev 18505)
@@ -31,7 +31,7 @@
 struct bContext;
 struct wmWindowManager;
 
-void ED_operatortypes_sculpt();
+void ED_operatortypes_sculpt(void);
 void ED_keymap_sculpt(wmWindowManager *wm);
 
 #endif

Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c  
2009-01-14 16:54:36 UTC (rev 18504)
+++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c  
2009-01-14 17:22:30 UTC (rev 18505)
@@ -53,6 +53,7 @@
 #include "DNA_userdef_types.h"
 #include "DNA_color_types.h"
 
+#include "BKE_brush.h"
 #include "BKE_context.h"
 #include "BKE_customdata.h"
 #include "BKE_DerivedMesh.h"
@@ -184,19 +185,6 @@
 
 static void init_brushaction(SculptData *sd, BrushAction *a, short *, short *);
 
-
-/* ===== MEMORY =====
- * 
- * Allocate/initialize/free data
- */
-
-static void sculpt_init_session(SculptData *sd)
-{
-       if(sd->session)
-               ;/*XXX: sculptsession_free(G.scene); */
-       sd->session= MEM_callocN(sizeof(SculptSession), "SculptSession");
-}
-
 /* vertex_users is an array of Lists that store all the faces that use a
    particular vertex. vertex_users is in the same order as mesh.mvert */
 static void calc_vertex_users(SculptSession *ss)
@@ -252,31 +240,11 @@
  * Simple functions to get data from the GL
  */
 
-/* Store the modelview and projection matrices and viewport. */
-void init_sculptmatrices()
-{
-       /* XXX: probably becomes context data?
-
-       SculptSession *ss= sculpt_session();
-
-       glMatrixMode(GL_MODELVIEW);
-       glPushMatrix();
-       glMultMatrixf(OBACT->obmat);
-
-       if(!ss->mats)
-               ss->mats = MEM_callocN(sizeof(bglMats), "sculpt bglmats");
-       bgl_get_mats(ss->mats);
-       
-       glPopMatrix();
-       */
-}
-
 /* Uses window coordinates (x,y) to find the depth in the GL depth buffer. If
    available, G.vd->depths is used so that the brush doesn't sculpt on top of
    itself (G.vd->depths is only updated at the end of a brush stroke.) */
-float get_depth(bContext *C, short x, short y)
+static float get_depth(bContext *C, short x, short y)
 {
-       float depth;
        ScrArea *sa= CTX_wm_area(C);
 
        if(sa->spacetype==SPACE_VIEW3D) { // should check this in context 
instead?
@@ -294,7 +262,7 @@
 
 /* Uses window coordinates (x,y) and depth component z to find a point in
    modelspace */
-void unproject(SculptSession *ss, float out[3], const short x, const short y, 
const float z)
+static void unproject(SculptSession *ss, float out[3], const short x, const 
short y, const float z)
 {
        double ux, uy, uz;
 
@@ -333,9 +301,10 @@
    shrink the brush. Skipped for grab brush because only the first mouse down
    size is used, which is small if the user has just touched the pen to the
    tablet */
-char brush_size(SculptData *sd, Brush *b)
+static char brush_size(SculptData *sd)
 {
-       float size= b->size;
+       float size= sd->brush->size;
+#if 0
        float pressure= 0; /* XXX: get_pressure(); */
        short activedevice= 0; /* XXX: get_activedevice(); */
        
@@ -347,25 +316,25 @@
                        size*= sd->tablet_size==0?1:
                        (1-size_factor) + pressure*size_factor;*/
        }
-       
+#endif
        return size;
 }
 
 /* Return modified brush strength. Includes the direction of the brush, 
positive
    values pull vertices, negative values push. Uses tablet pressure and a
    special multiplier found experimentally to scale the strength factor. */
-float brush_strength(SculptData *sd, StrokeCache *cache, BrushAction *a)
+static float brush_strength(SculptData *sd, StrokeCache *cache)
 {
        float dir= sd->brush->flag & BRUSH_DIR_IN ? -1 : 1;
        float pressure= 1;
-       short activedevice= 0;/*XXX: get_activedevice(); */
+       /* short activedevice= 0;XXX: get_activedevice(); */
        float flip= cache->flip ? -1:1;
        float anchored = sd->brush->flag & BRUSH_ANCHORED ? 25 : 1;
 
-       const float strength_factor= sd->tablet_strength / 10.0f;
-
        /* XXX: tablet stuff */
 #if 0
+       const float strength_factor= sd->tablet_strength / 10.0f;
+
        if(ELEM(activedevice, DEV_STYLUS, DEV_ERASER))
                pressure= sd->sculptdata.tablet_strength==0?1:
                        (1-strength_factor) + 1/*XXX: get_pressure()*/ 
*strength_factor;
@@ -395,7 +364,7 @@
 }
 
 /* For clipping against a mirror modifier */
-void sculpt_clip(StrokeCache *cache, float *co, const float val[3])
+static void sculpt_clip(StrokeCache *cache, float *co, const float val[3])
 {
        char i;
        for(i=0; i<3; ++i) {
@@ -406,7 +375,7 @@
        }               
 }
 
-void sculpt_axislock(SculptData *sd, float *co)
+static void sculpt_axislock(SculptData *sd, float *co)
 {
        if (sd->flags & (SCULPT_LOCK_X|SCULPT_LOCK_Y|SCULPT_LOCK_Z)) return;
        /* XXX: if(G.vd->twmode == V3D_MANIP_LOCAL) { */
@@ -441,7 +410,7 @@
 
 /* Currently only for the draw brush; finds average normal for all active
    vertices */
-void calc_area_normal(SculptData *sd, float out[3], const BrushAction *a, 
const float *outdir, const ListBase* active_verts)
+static void calc_area_normal(SculptData *sd, float out[3], BrushAction *a, 
const float *outdir, const ListBase* active_verts)
 {
        ActiveData *node = active_verts->first;
        const int view = 0; /* XXX: should probably be a flag, not number: 
sd->brush_type==SCULPT_TOOL_DRAW ? sculptmode_brush()->view : 0; */
@@ -451,11 +420,11 @@
 
        if(sd->brush->flag & BRUSH_ANCHORED) {
                for(; node; node = node->next)
-                       add_norm_if(((BrushAction*)a)->symm.out, out, out_flip, 
a->orig_norms[node->Index]);
+                       add_norm_if(a->symm.out, out, out_flip, 
a->orig_norms[node->Index]);
        }
        else {
                for(; node; node = node->next)
-                       add_norm_if(((BrushAction*)a)->symm.out, out, out_flip, 
sd->session->mvert[node->Index].no);
+                       add_norm_if(a->symm.out, out, out_flip, 
sd->session->mvert[node->Index].no);
        }
 
        if (out[0]==0.0 && out[1]==0.0 && out[2]==0.0) {
@@ -473,7 +442,7 @@
        Normalize(out);
 }
 
-void do_draw_brush(SculptData *sd, SculptSession *ss, const BrushAction *a, 
const ListBase* active_verts)
+static void do_draw_brush(SculptData *sd, SculptSession *ss, BrushAction *a, 
const ListBase* active_verts)
 {
        float area_normal[3];
        ActiveData *node= active_verts->first;
@@ -498,18 +467,19 @@
 /* For the smooth brush, uses the neighboring vertices around vert to calculate
    a smoothed location for vert. Skips corner vertices (used by only one
    polygon.) */
-vec3f neighbor_average(SculptSession *ss, const int vert)
+static void neighbor_average(SculptSession *ss, float avg[3], const int vert)
 {
        int i, skip= -1, total=0;
        IndexNode *node= ss->vertex_users[vert].first;
-       vec3f avg= {0,0,0};
        char ncount= BLI_countlist(&ss->vertex_users[vert]);
        MFace *f;
+
+       avg[0] = avg[1] = avg[2] = 0;
                
        /* Don't modify corner vertices */
        if(ncount==1) {
-               VecCopyf(&avg.x, ss->mvert[vert].co);
-               return avg;
+               VecCopyf(avg, ss->mvert[vert].co);
+               return;
        }
 
        while(node){
@@ -524,7 +494,7 @@
 
                for(i=0; i<(f->v4?4:3); ++i) {
                        if(i != skip && (ncount!=2 || 
BLI_countlist(&ss->vertex_users[(&f->v1)[i]]) <= 2)) {
-                               VecAddf(&avg.x, &avg.x, 
ss->mvert[(&f->v1)[i]].co);
+                               VecAddf(avg, avg, ss->mvert[(&f->v1)[i]].co);
                                ++total;
                        }
                }
@@ -532,33 +502,31 @@
                node= node->next;
        }
 
-       if(total>0) {
-               avg.x/= total;
-               avg.y/= total;
-               avg.z/= total;
-       }
+       if(total>0)
+               VecMulf(avg, 1.0f / total);
        else
-               VecCopyf(&avg.x, ss->mvert[vert].co);
-
-       return avg;
+               VecCopyf(avg, ss->mvert[vert].co);
 }
 
-void do_smooth_brush(SculptSession *ss, const BrushAction *a, const ListBase* 
active_verts)
+static void do_smooth_brush(SculptSession *ss, const ListBase* active_verts)
 {
        ActiveData *node= active_verts->first;
 
        while(node){
                float *co= ss->mvert[node->Index].co;
-               const vec3f avg= neighbor_average(ss, node->Index);
-               const float val[3]= {co[0]+(avg.x-co[0])*node->Fade,
-                                    co[1]+(avg.y-co[1])*node->Fade,
-                                    co[2]+(avg.z-co[2])*node->Fade};
+               float avg[3], val[3];
+
+               neighbor_average(ss, avg, node->Index);
+               val[0] = co[0]+(avg[0]-co[0])*node->Fade;
+               val[1] = co[1]+(avg[1]-co[1])*node->Fade;
+               val[2] = co[2]+(avg[2]-co[2])*node->Fade;
+
                sculpt_clip(ss->cache, co, val);
                node= node->next;
        }
 }
 
-void do_pinch_brush(SculptSession *ss, const BrushAction *a, const ListBase* 
active_verts)
+static void do_pinch_brush(SculptSession *ss, const BrushAction *a, const 
ListBase* active_verts)
 {
        ActiveData *node= active_verts->first;
 
@@ -572,7 +540,7 @@
        }
 }
 

@@ 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