Revision: 39702
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39702
Author:   psy-fi
Date:     2011-08-25 20:47:41 +0000 (Thu, 25 Aug 2011)
Log Message:
-----------
UV sculpting
============
-change behaviour of brush size so that, unlike image painting, it isn't scaled 
with image zoom. This makes sense for uv sculpting where you sometimes need to 
sculpt a bigger area, similar to 3D view.
-Fixed loading of stitch preview colours for older versions. Kept check on 
version 2.61 since I expect to merge then.

Modified Paths:
--------------
    
branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c
    
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
    
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c   
    2011-08-25 17:59:37 UTC (rev 39701)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c   
    2011-08-25 20:47:41 UTC (rev 39702)
@@ -1589,22 +1589,16 @@
                }
        }
 
-       /* GSoC 2011 Onion */
-       /* XXX: ONIONSUBVERSIONFILE fix before final merge! */
-       if (bmain->versionfile < 258 || (bmain->versionfile == 258 && 
bmain->subversionfile < 4)){
-               if(bmain->subversionfile < 4){
-                       bTheme *btheme;
-                       for(btheme= U.themes.first; btheme; btheme= 
btheme->next) {
-                               SETCOLF(btheme->tima.preview_stitch_face, 0.5, 
0.5, 0.0, 0.2);
-                               SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 
0.0, 1.0, 0.2);
-                               SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 
0.0, 1.0, 0.2);
-                               SETCOLF(btheme->tima.preview_stitch_stitchable, 
0.0, 1.0, 0.0, 1.0);
-                               
SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
-                       }
+       if (bmain->versionfile < 261 || (bmain->versionfile == 261 && 
bmain->subversionfile < 1)){
+               bTheme *btheme;
+               for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+                       SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 
0.0, 0.2);
+                       SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 
1.0, 0.2);
+                       SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 
1.0, 0.2);
+                       SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 
1.0, 0.0, 1.0);
+                       SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 
0.0, 0.0, 1.0);
                }
-               if(bmain->subversionfile < 3){
                U.hirestex = 0;
-               }
        }
 
        /* GL Texture Garbage Collection (variable abused above!) */

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
  2011-08-25 17:59:37 UTC (rev 39701)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
  2011-08-25 20:47:41 UTC (rev 39702)
@@ -5062,12 +5062,22 @@
        Brush *brush= paint_brush(paint);
 
        if(paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
+               ToolSettings *ts;
                float zoomx, zoomy;
                const float size= (float)brush_size(brush);
                const short use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy);
-               const float pixel_size= MAX2(size * zoomx, size * zoomy);
+               float pixel_size;
                float alpha= 0.5f;
 
+               ts = CTX_data_scene(C)->toolsettings;
+
+               if(use_zoom && !ts->use_uv_sculpt){
+                       pixel_size = MAX2(size * zoomx, size * zoomy);
+               }
+               else {
+                       pixel_size = size;
+               }
+
                /* fade out the brush (cheap trick to work around brush 
interfearing with sampling [#])*/
                if(pixel_size < PX_SIZE_FADE_MIN) {
                        return;
@@ -5080,7 +5090,8 @@
 
                glTranslatef((float)x, (float)y, 0.0f);
 
-               if(use_zoom)
+               /* No need to scale for uv sculpting, on the contrary it might 
be useful to keep unscaled */
+               if(use_zoom && !ts->use_uv_sculpt)
                        glScalef(zoomx, zoomy, 1.0f);
 
                glColor4f(brush->add_col[0], brush->add_col[1], 
brush->add_col[2], alpha);

Modified: 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c
===================================================================
--- 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c
    2011-08-25 17:59:37 UTC (rev 39701)
+++ 
branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c
    2011-08-25 20:47:41 UTC (rev 39702)
@@ -290,7 +290,7 @@
        int invert;
        int width, height;
        float aspectRatio;
-       float alpha;
+       float alpha, zoomx, zoomy;
        Brush *brush = paint_brush(sculptdata->uvsculpt);
        tool = CTX_data_scene(C)->toolsettings->uv_sculpt_tool;
 
@@ -298,11 +298,13 @@
        alpha = brush_alpha(brush);
        UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], 
&co[0], &co[1]);
 
-       radius = brush_size(brush);
        sima = CTX_wm_space_image(C);
        ED_space_image_size(sima, &width, &height);
+       ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
+
+       radius = brush_size(brush)/(width*zoomx);
        aspectRatio = width/(float)height;
-       radius /= width;
+
        /* We will compare squares to save some computation */
        radius = radius*radius;
        radius_root = sqrt(radius);
@@ -624,7 +626,7 @@
                        SpaceImage *sima;
                        int width, height;
                        float aspectRatio;
-                       float alpha;
+                       float alpha, zoomx, zoomy;
                        Brush *brush = paint_brush(sculptdata->uvsculpt);
                        tool = CTX_data_scene(C)->toolsettings->uv_sculpt_tool;
 
@@ -633,8 +635,10 @@
                        radius = brush_size(brush);
                        sima = CTX_wm_space_image(C);
                        ED_space_image_size(sima, &width, &height);
+                       ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
+
                        aspectRatio = width/(float)height;
-                       radius /= width;
+                       radius /= (width*zoomx);
                        radius = radius*radius;
                        radius_root = sqrt(radius);
 

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

Reply via email to