Revision: 39151
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39151
Author:   jwilkins
Date:     2011-08-07 16:18:41 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
fixed the copy/paste code for handling sculpt tool radius modifier

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_controls.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_tools.c

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_controls.c
===================================================================
--- 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_controls.c    
    2011-08-07 16:11:56 UTC (rev 39150)
+++ 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_controls.c    
    2011-08-07 16:18:41 UTC (rev 39151)
@@ -1534,7 +1534,6 @@
                }
        }
 }
-#endif
 
 float paint_brush_radius_multiplier(const Brush *brush)
 {
@@ -1544,6 +1543,7 @@
        else
                return 1.0;
 }
+#endif
 
 void paint_cursor_start(
        struct wmWindowManager *wm,

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c        
2011-08-07 16:11:56 UTC (rev 39150)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c        
2011-08-07 16:18:41 UTC (rev 39151)
@@ -265,8 +265,6 @@
        struct Brush      *brush= paint_brush(&(sd->paint));
        struct SculptData *mode_data;
 
-       float radius_factor;
-
        paint_cache_init(
                CTX_wm_manager(C),
                &(sd->paint),
@@ -293,17 +291,12 @@
 
        sculpt_undo_push_begin(sculpt_tool_name(sd));
 
-       if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
-               radius_factor= 2.0f;
-       else
-               radius_factor= 1.0f;
-
        paint_bspace_init(
                C,
                stroke,
                sculpt_stroke_get_location,
                paint_stroke_mouse(stroke),
-               radius_factor * brush_size(brush));
+               sculpt_stroke_radius2d(brush));
 }
 
 static void sculpt_stroke_done(

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_intern.h 
2011-08-07 16:11:56 UTC (rev 39150)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_intern.h 
2011-08-07 16:18:41 UTC (rev 39151)
@@ -131,4 +131,6 @@
        SCULPT_CLIP_Z= (1<<2)
 } SculptClipFlags;
 
+float sculpt_stroke_radius2d(struct Brush *brush);
+
 #endif

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_tools.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_tools.c  
2011-08-07 16:11:56 UTC (rev 39150)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_tools.c  
2011-08-07 16:18:41 UTC (rev 39151)
@@ -1768,6 +1768,16 @@
                multires_stitch_grids(ob);
 }
 
+float sculpt_stroke_radius2d(struct Brush *brush)
+{
+       float radius=  brush_size(brush);
+
+       if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
+               radius *= 1.5f;
+
+       return radius;
+}
+
 void sculpt_stroke_update_step(
        const struct bContext *C,
        struct PaintStroke *stroke)
@@ -1777,8 +1787,6 @@
        struct Brush  *brush= paint_brush(&sd->paint);
        struct SculptData *mode_data= paint_stroke_mode_data(stroke);
 
-       float radius_factor;
-
        /* pay careful attention to the order of operations in this function
           update the mesh cache
           update brush space, which depends on an up-to-date mesh
@@ -1790,11 +1798,6 @@
 
        paint_mesh_update_when_modifiers(C, sculpt_tool_need_fmap(brush));
 
-       if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
-               radius_factor= 2.0f;
-       else
-               radius_factor= 1.0f;
-
        /* first step is handled by paint_bspace_init */
        if (!paint_stroke_first_dab(stroke)) {
                paint_bspace_update(
@@ -1802,7 +1805,7 @@
                        stroke,
                        sculpt_stroke_get_location,
                        paint_stroke_mouse(stroke),
-                       radius_factor * brush_size(brush));
+                       sculpt_stroke_radius2d(brush));
        }
 
        if (paint_bspace_hit(C)) {

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

Reply via email to