Revision: 38904
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38904
Author:   psy-fi
Date:     2011-08-01 20:56:53 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
smooth brush
========================
-finally managed to get 'little ducks' to print, meaning the operator is 
finally called normally. I had to move al the operator code to another file. I 
don't know why(maybe keymap poll functions? I've seen the operator doesn't like 
them). I hope I can still use the new stroke code by Jason somehow.

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/include/ED_screen.h
    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_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c
    branches/soc-2011-onion/source/blender/editors/uvedit/CMakeLists.txt
    branches/soc-2011-onion/source/blender/editors/uvedit/SConscript
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c

Modified: branches/soc-2011-onion/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_screen.h  
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_screen.h  
2011-08-01 20:56:53 UTC (rev 38904)
@@ -168,7 +168,6 @@
 int            ED_operator_editlattice(struct bContext *C);
 int            ED_operator_editmball(struct bContext *C);
 int            ED_operator_uvedit(struct bContext *C);
-int            ED_operator_uvedit_no_smooth(struct bContext *C);
 int            ED_operator_uvmap(struct bContext *C);
 int            ED_operator_uvmap_mesh(struct bContext *C);
 int            ED_operator_uv_seam_tag_active(struct bContext *C);

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-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/screen/screen_ops.c  
2011-08-01 20:56:53 UTC (rev 38904)
@@ -364,14 +364,6 @@
        return ED_space_image_show_uvedit(sima, obedit);
 }
 
-int    ED_operator_uvedit_no_smooth(struct bContext *C)
-{
-       SpaceImage *sima= CTX_wm_space_image(C);
-       Object *obedit= CTX_data_edit_object(C);
-       return ED_space_image_show_uvedit(sima, obedit) && !(sima->flag & 
SI_SMOOTH_BRUSH);
-}
-
-
 int ED_operator_uvmap(bContext *C)
 {
        Object *obedit= CTX_data_edit_object(C);

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-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_image.c   
2011-08-01 20:56:53 UTC (rev 38904)
@@ -4529,11 +4529,10 @@
        return 0;
 }
 
-static int uv_smooth_brush_poll(const bContext *C)
+int uv_smooth_poll(bContext *C)
 {
 //     Object *obact = CTX_data_active_object(C);
        SpaceImage *sima= CTX_wm_space_image(C);
-
        if(!image_paint_brush(C))
                return 0;
 
@@ -5086,7 +5085,7 @@
                wm,
                &(settings->imapaint.paint),
                OB_MODE_TEXTURE_PAINT,
-               uv_smooth_brush_poll,
+               uv_smooth_poll,
                brush_drawcursor,
                NULL);
 }
@@ -5416,11 +5415,6 @@
        return (texture_paint_poll(C) || image_paint_poll(C));
 }
 
-int uv_smooth_poll(bContext *C)
-{
-       return uv_smooth_brush_poll(C);
-}
-
 int facemask_paint_poll(bContext *C)
 {
        return paint_facesel_test(CTX_data_active_object(C));

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h  
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h  
2011-08-01 20:56:53 UTC (rev 38904)
@@ -240,6 +240,7 @@
 void PAINT_OT_vpaint_stroke(struct wmOperatorType *ot);
 
 unsigned int vpaint_get_current_col(struct VPaint *vp);
+void UV_OT_uv_smooth_stroke(struct wmOperatorType *ot);
 
 /* paint_image.c */
 int image_texture_paint_poll(struct bContext *C);

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c     
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c     
2011-08-01 20:56:53 UTC (rev 38904)
@@ -359,29 +359,7 @@
        ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, 
"Tool", "");
 }
 
-static int uv_smooth_stroke_exec(bContext *C, wmOperator *op)
-{
-       printf("little ducks\n");
-       return OPERATOR_FINISHED;
-}
 
-static void UV_OT_uv_smooth_stroke(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Smooth UVs";
-       ot->description= "Smooth UVs using a brush";
-       ot->idname= "UV_OT_uv_smooth_stroke";
-
-       /* api callbacks */
-       ot->exec= uv_smooth_stroke_exec;
-       ot->poll= uv_smooth_poll;
-
-       /* flags */
-       ot->flag= OPTYPE_REGISTER;//|OPTYPE_UNDO;
-
-       /* props */
-}
-
 /**************************** registration **********************************/
 
 void ED_operatortypes_paint(void)
@@ -417,9 +395,6 @@
        WM_operatortype_append(PAINT_OT_weight_layers_images_from_view);
        WM_operatortype_append(PAINT_OT_weight_layers_to_uv_images);
 
-       /* uv */
-       WM_operatortype_append(UV_OT_uv_smooth_stroke);
-
        /* vertex */
        WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
        WM_operatortype_append(PAINT_OT_vpaint_stroke);
@@ -706,11 +681,6 @@
        WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, 
KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, 
KM_PRESS, 0, 0);
 
-       keymap= WM_keymap_find(keyconf, "UV Smooth", 0, 0);
-       keymap->poll= uv_smooth_poll;
-
-       WM_keymap_add_item(keymap, "UV_OT_uv_smooth_stroke", LEFTMOUSE, 
KM_PRESS, 0, 0);
-
        /* paint stroke */
        {
                wmKeyMap* keymap= paint_stroke_modal_keymap(keyconf);

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-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/space_image/image_ops.c      
2011-08-01 20:56:53 UTC (rev 38904)
@@ -171,16 +171,6 @@
        return 0;
 }
 
-static int space_image_image_sample_poll(bContext *C)
-{
-       SpaceImage *sima= CTX_wm_space_image(C);
-       Object *obedit= CTX_data_edit_object(C);
-       if(obedit){
-               if(ED_space_image_show_uvedit(sima, obedit) && (sima->flag & 
SI_SMOOTH_BRUSH))
-                       return 0;
-       }
-       return space_image_main_area_poll(C);
-}
 /********************** view pan operator *********************/
 
 typedef struct ViewPanData {
@@ -1830,7 +1820,7 @@
        ot->invoke= sample_invoke;
        ot->modal= sample_modal;
        ot->cancel= sample_cancel;
-       ot->poll= space_image_image_sample_poll;
+       ot->poll= space_image_main_area_poll;
 
        /* flags */
        ot->flag= OPTYPE_BLOCKING;

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/CMakeLists.txt        
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/CMakeLists.txt        
2011-08-01 20:56:53 UTC (rev 38904)
@@ -27,6 +27,7 @@
        ../../makesdna
        ../../makesrna
        ../../windowmanager
+       ../sculpt_paint
        ../../../../intern/guardedalloc
        ../../../../intern/opennl/extern
 )

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/SConscript
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/SConscript    
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/SConscript    
2011-08-01 20:56:53 UTC (rev 38904)
@@ -3,7 +3,7 @@
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf 
../sculpt_paint'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader'
 

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c  
2011-08-01 20:18:02 UTC (rev 38903)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c  
2011-08-01 20:56:53 UTC (rev 38904)
@@ -73,6 +73,7 @@
 #include "UI_resources.h"
 
 #include "uvedit_intern.h"
+#include "paint_intern.h"
 
 /************************* state testing ************************/
 
@@ -4439,6 +4440,55 @@
                "Location", "Mouse location in normalized coordinates, 0.0 to 
1.0 is within the image bounds.", -100.0f, 100.0f);
 }
 
+
+static int uv_smooth_stroke_exec(bContext *C, wmOperator *op)
+{
+       printf("little ducks\n");
+       return OPERATOR_FINISHED;
+}
+
+
+static int uv_smooth_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       return OPERATOR_RUNNING_MODAL;
+}
+
+static int uv_smooth_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+       printf("little ducks\n");
+       switch(event->type){
+               case ESCKEY:
+                       return OPERATOR_FINISHED;
+       }
+       return OPERATOR_RUNNING_MODAL;
+}
+
+static int uv_smooth_cancel(bContext *C, wmOperator *op){
+       return OPERATOR_CANCELLED;
+}
+
+void UV_OT_uv_smooth_stroke(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Smooth UVs";
+       ot->description= "Smooth UVs using a brush";
+       ot->idname= "UV_OT_uv_smooth_stroke";
+
+       /* api callbacks */
+//     ot->invoke = uv_smooth_stroke_invoke;
+       ot->exec= uv_smooth_stroke_exec;
+//     ot->modal= uv_smooth_stroke_modal;
+//     ot->cancel= uv_smooth_cancel;
+       ot->poll= uv_smooth_poll;
+
+       /* flags */
+       ot->flag= OPTYPE_REGISTER;//|OPTYPE_UNDO;
+
+       /* props */
+}
+
+
+
 /* ************************** registration **********************************/
 
 void ED_operatortypes_uvedit(void)
@@ -4478,16 +4528,22 @@
 
        WM_operatortype_append(UV_OT_cursor_set);
        WM_operatortype_append(UV_OT_tile_set);
+
+       WM_operatortype_append(UV_OT_uv_smooth_stroke);
+
 }
 
+
 void ED_keymap_uvedit(wmKeyConfig *keyconf)
 {
        wmKeyMap *keymap;
        wmKeyMapItem *kmi;
-       
+
        keymap= WM_keymap_find(keyconf, "UV Editor", 0, 0);
-       keymap->poll= ED_operator_uvedit_no_smooth;
+       keymap->poll= ED_operator_uvedit;
 
+       WM_keymap_add_item(keymap, "UV_OT_uv_smooth_stroke", LEFTMOUSE, 
KM_PRESS, 0, 0);
+
        /* Mark edge seam */
        WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, 0, 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, 
KM_PRESS, KM_CTRL, 0)->ptr, "selection", 1);

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

Reply via email to