Revision: 39083
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39083
Author:   psy-fi
Date:     2011-08-05 20:40:57 +0000 (Fri, 05 Aug 2011)
Log Message:
-----------
smooth brush
============
-Move smooth brush state entirely to toolsettings, since this is an edit-mode 
function and it doesn't make sense to keep as space image flag.
-loading a file with smooth brushes now works
-size doesn't update correctly yet, will check on it

Modified Paths:
--------------
    branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c
    branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-onion/source/blender/blenloader/intern/writefile.c
    branches/soc-2011-onion/source/blender/editors/object/object_edit.c
    branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
    branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-onion/source/blender/makesdna/DNA_space_types.h
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py        
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_image.py        
2011-08-05 20:40:57 UTC (rev 39083)
@@ -288,7 +288,7 @@
 
         layout.menu("IMAGE_MT_uvs_showhide")
         layout.separator()
-        layout.prop(sima, "use_smooth_brush")
+        layout.prop(toolsettings, "use_smooth_brush")
         layout.separator()
 
 

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c    
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/paint.c    
2011-08-05 20:40:57 UTC (rev 39083)
@@ -71,6 +71,8 @@
                                return &ts->wpaint->paint;
                        case OB_MODE_TEXTURE_PAINT:
                                return &ts->imapaint.paint;
+                       case OB_MODE_EDIT:
+                               return &ts->uvsmooth->paint;
                        }
                }
 

Modified: branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c 
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c 
2011-08-05 20:40:57 UTC (rev 39083)
@@ -4442,6 +4442,7 @@
                        link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
                        link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
                        link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
+                       link_paint(fd, sce, 
&sce->toolsettings->uvsmooth->paint);
 
                        sce->toolsettings->skgen_template = newlibadr(fd, 
sce->id.lib, sce->toolsettings->skgen_template);
 
@@ -4564,6 +4565,7 @@
                direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt);
                direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint);
                direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint);
+               direct_link_paint(fd, (Paint**)&sce->toolsettings->uvsmooth);
 
                if (sce->toolsettings->sculpt)
                        sce->toolsettings->sculpt->paint.cache= NULL;
@@ -4574,6 +4576,9 @@
                if (sce->toolsettings->wpaint)
                        sce->toolsettings->wpaint->paint.cache= NULL;
 
+               if (sce->toolsettings->uvsmooth)
+                       sce->toolsettings->uvsmooth->paint.cache= NULL;
+
                sce->toolsettings->imapaint.paint.cache= NULL;
 
                sce->toolsettings->particle.paintcursor= NULL;

Modified: branches/soc-2011-onion/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenloader/intern/writefile.c        
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/blenloader/intern/writefile.c        
2011-08-05 20:40:57 UTC (rev 39083)
@@ -1893,6 +1893,9 @@
                if(tos->sculpt) {
                        writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
                }
+               if(tos->uvsmooth) {
+                       writestruct(wd, DATA, "UvSmooth", 1, tos->uvsmooth);
+               }
 
                // write_paint(wd, &tos->imapaint.paint);
 

Modified: branches/soc-2011-onion/source/blender/editors/object/object_edit.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/object/object_edit.c 
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/object/object_edit.c 
2011-08-05 20:40:57 UTC (rev 39083)
@@ -90,8 +90,8 @@
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_util.h"
+#include "ED_image.h"
 
-
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -516,11 +516,14 @@
 
 static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
+       ToolSettings *toolsettings =  CTX_data_scene(C)->toolsettings;
        if(!CTX_data_edit_object(C))
                ED_object_enter_editmode(C, EM_WAITCURSOR);
        else
                ED_object_exit_editmode(C, 
EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls 
undo too [#24685] */
        
+       ED_space_image_uv_smooth_update(CTX_wm_manager(C), toolsettings);
+
        return OPERATOR_FINISHED;
 }
 

Modified: branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c  
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c  
2011-08-05 20:40:57 UTC (rev 39083)
@@ -367,8 +367,9 @@
 int    ED_operator_uvedit_no_smooth(struct bContext *C)
 {
        SpaceImage *sima= CTX_wm_space_image(C);
+       ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
        Object *obedit= CTX_data_edit_object(C);
-       return ED_space_image_show_uvedit(sima, obedit) && !(sima->flag & 
SI_SMOOTH_BRUSH);
+       return ED_space_image_show_uvedit(sima, obedit) && 
!(toolsettings->use_uv_smooth);
 }
 
 

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c   
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c   
2011-08-05 20:40:57 UTC (rev 39083)
@@ -4541,15 +4541,16 @@
 
 static int uv_smooth_brush_poll(const bContext *C)
 {
-//     Object *obact = CTX_data_active_object(C);
+       Object *obedit = CTX_data_edit_object(C);
        SpaceImage *sima= CTX_wm_space_image(C);
+       ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
 
-       if(!uv_smooth_brush(C))
+       if(!uv_smooth_brush(C) || !obedit)
                return 0;
 
        if(sima) {
                ARegion *ar= CTX_wm_region(C);
-               if((sima->flag & SI_SMOOTH_BRUSH) && 
ar->regiontype==RGN_TYPE_WINDOW)
+               if((toolsettings->use_uv_smooth) && 
ar->regiontype==RGN_TYPE_WINDOW)
                        return 1;
        }
 
@@ -5102,6 +5103,23 @@
                uv_smooth_brush_poll,
                brush_drawcursor,
                NULL);
+       if(settings->use_uv_smooth){
+               if(!settings->uvsmooth){
+                       settings->uvsmooth = 
MEM_callocN(sizeof(*settings->uvsmooth), "UV Smooth paint");
+               }
+               paint_mode_init(
+                       wm,
+                       &(settings->uvsmooth->paint),
+                       OB_MODE_TEXTURE_PAINT,
+                       uv_smooth_brush_poll,
+                       brush_drawcursor,
+                       NULL);
+
+               settings->uvsmooth->paint.flags |= PAINT_SHOW_BRUSH;
+       }
+       else {
+               settings->uvsmooth->paint.flags &= ~PAINT_SHOW_BRUSH;
+       }
 }
 /************************ grab clone operator ************************/
 

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c      
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c      
2011-08-05 20:40:57 UTC (rev 39083)
@@ -1,5 +1,5 @@
 /*
- * $Id: paint_uv.c 39020 2011-08-04 13:55:38Z psy-fi $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -35,12 +35,8 @@
  */
 
 
-#include "paint_stroke.h"
-
 #include "MEM_guardedalloc.h"
 
-#include <stdlib.h>
-#include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 #include "DNA_object_types.h"
@@ -49,13 +45,10 @@
 
 #include "BKE_brush.h"
 #include "BKE_context.h"
-#include "BKE_paint.h"
 #include "BKE_main.h"
 #include "BKE_depsgraph.h"
 
-#include "ED_sculpt.h"
 #include "ED_screen.h"
-#include "UI_resources.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -65,12 +58,7 @@
 #include "RNA_enum_types.h"
 
 #include "paint_intern.h"
-#include "sculpt_intern.h"
 
-#include <string.h>
-//#include <stdio.h>
-#include <stddef.h>
-
 typedef struct SmoothBrushData{
        /* Timer to be used for airbrush-type brush */
        wmTimer *timer;
@@ -117,6 +105,7 @@
 
        data = op->customdata;
        data->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), 
TIMER, 0.01f);
+
        if(!data->timer){
                uv_smooth_stroke_exit(C, op);
                return OPERATOR_CANCELLED;

Modified: branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c      
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c      
2011-08-05 20:40:57 UTC (rev 39083)
@@ -175,8 +175,10 @@
 {
        SpaceImage *sima= CTX_wm_space_image(C);
        Object *obedit= CTX_data_edit_object(C);
+       ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
+
        if(obedit){
-               if(ED_space_image_show_uvedit(sima, obedit) && (sima->flag & 
SI_SMOOTH_BRUSH))
+               if(ED_space_image_show_uvedit(sima, obedit) && 
(toolsettings->use_uv_smooth))
                        return 0;
        }
        return space_image_main_area_poll(C);

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_draw.c 
2011-08-05 20:40:57 UTC (rev 39083)
@@ -920,6 +920,7 @@
 {
        int show_uvedit, show_uvshadow, show_texpaint_uvshadow;
        Object *paint_ob = CTX_data_active_object(C);
+       ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
 
        show_texpaint_uvshadow = (paint_ob && paint_ob->type == OB_MESH && 
paint_ob->mode == OB_MODE_TEXTURE_PAINT);
        show_uvedit= ED_space_image_show_uvedit(sima, obedit);
@@ -935,7 +936,7 @@
                        draw_uvs_texpaint(sima, scene, paint_ob, ima);
                }
 
-               if(show_uvedit && !(sima->flag & SI_SMOOTH_BRUSH))
+               if(show_uvedit && !(toolsettings->use_uv_smooth))
                        drawcursor_sima(sima, ar);
        }
 }

Modified: branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h   
2011-08-05 19:55:36 UTC (rev 39082)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h   
2011-08-05 20:40:57 UTC (rev 39083)
@@ -713,7 +713,7 @@
        int auto_normalize; /*auto normalizing mode in wpaint*/
 
        short sculpt_paint_settings; /* user preferences for sculpt and paint */
-       short pad1;
+       short use_uv_smooth;
        int sculpt_paint_unified_size; /* unified radius of brush in pixels */
        float sculpt_paint_unified_unprojected_radius;/* unified radius of 
brush in Blender units */
        float sculpt_paint_unified_alpha; /* unified strength of brush */


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