Revision: 38808
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38808
Author:   jwilkins
Date:     2011-07-29 03:05:37 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
new paint stroke stuff now works in vpaint mode

Modified Paths:
--------------
    
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
    
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_meshcache.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt_tools.c

Modified: 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py   
    2011-07-29 02:15:01 UTC (rev 38807)
+++ 
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py   
    2011-07-29 03:05:37 UTC (rev 38808)
@@ -899,7 +899,7 @@
 
         col = layout.column()
 
-        if context.sculpt_object:
+        if context.sculpt_object or context.vertex_paint_object:
             db = False
 
             col.prop(brush, "stroke_method", text="")

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-07-29 02:15:01 UTC (rev 38807)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h  
2011-07-29 03:05:37 UTC (rev 38808)
@@ -224,7 +224,6 @@
 /* paint_vertex.c */
 int weight_paint_poll(const struct bContext *C);
 int weight_paint_mode_poll(const struct bContext *C);
-int vertex_paint_poll(const struct bContext *C);
 int vertex_paint_mode_poll(const struct bContext *C);
 
 void vpaint_fill(struct Object *ob, unsigned int paintcol);
@@ -238,7 +237,7 @@
 void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
 
 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
-void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
+void PAINT_OT_vpaint_stroke(struct wmOperatorType *ot);
 
 unsigned int vpaint_get_current_col(struct VPaint *vp);
 
@@ -278,7 +277,7 @@
 
 int facemask_paint_poll(struct bContext *C);
 
-void paint_tag_partial_redraw(struct bContext *C, struct Object *ob);
+void paint_tag_partial_redraw(const struct bContext *C, struct Object *ob);
 
 struct MultiresModifierData *paint_mesh_get_active_multires(const struct 
bContext *C);
 
@@ -370,7 +369,8 @@
 void paint_mesh_undo_restore(struct bContext *C, struct SculptUndoNode *unode);
 float *paint_mesh_orig_co(const struct Object *ob, int i);
 int paint_mesh_totvert(const struct Object *ob);
-void paint_mesh_restore(const struct bContext *C);
+void paint_mesh_restore_co(const struct bContext *C);
+void paint_mesh_restore_mcol(const struct bContext *C);
 
 int paint_use_threaded(const struct bContext *C);
 

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-07-29 02:15:01 UTC (rev 38807)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-07-29 03:05:37 UTC (rev 38808)
@@ -120,7 +120,7 @@
        float symm_brush_local_mat[4][4],
        int mirror_pass,
        float special_rotation,
-       struct bglMats* mats)
+       struct bglMats* UNUSED(mats))
 {
        Brush *brush = paint_brush(paint);
        const struct ViewContext *vc;
@@ -145,11 +145,11 @@
                                if(paint_stroke_test(&test, vd.co)) {
                                        float fade;
 
-                                       fade =
-                                               bstrength *
+                                       fade = bstrength;
+                                               /* SNIP bstrength *
                                                brush_tex_strength(
                                                        vc,
-                                                       NULL /*pmat doesn't 
work*/,
+                                                       NULL, // pmat doesn't 
work
                                                        symm_brush_local_mat,
                                                        mirror_pass,
                                                        brush,
@@ -160,7 +160,8 @@
                                                        radius3d,
                                                        special_rotation,
                                                        tex_mouse,
-                                                       mats /*XXX: until fix 
pmat */);
+                                                       mats); // XXX: until 
fix pmat
+                                                       */
 
                                        *vd.mask_active += fade;
                                        CLAMP(*vd.mask_active, 0, 1);

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_meshcache.c
===================================================================
--- 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_meshcache.c   
    2011-07-29 02:15:01 UTC (rev 38807)
+++ 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_meshcache.c   
    2011-07-29 03:05:37 UTC (rev 38808)
@@ -439,7 +439,7 @@
                copy_v3_v3(me->mvert[index].co, newco);
 }
 
-void paint_mesh_restore(const struct bContext *C)
+void paint_mesh_restore_co(const struct bContext *C)
 {
        struct Object *ob= CTX_data_active_object(C);
        int use_threaded= paint_use_threaded(C);
@@ -478,8 +478,13 @@
                MEM_freeN(nodes);
 }
 
+void paint_mesh_restore_mcol(const struct bContext *C)
+{
+       /* TODO */
+}
 
 
+
 /*
  * Flush & Finish
  *

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-07-29 02:15:01 UTC (rev 38807)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c     
2011-07-29 03:05:37 UTC (rev 38808)
@@ -397,7 +397,7 @@
 
        /* vertex */
        WM_operatortype_append(PAINT_OT_vertex_paint_toggle);
-       WM_operatortype_append(PAINT_OT_vertex_paint);
+       WM_operatortype_append(PAINT_OT_vpaint_stroke);
        WM_operatortype_append(PAINT_OT_vertex_color_set);
 
        /* face-select */
@@ -566,10 +566,10 @@
        keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
        keymap->poll= sculpt_poll;
 
-       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_stroke", LEFTMOUSE, 
KM_PRESS, 0,                0)->ptr, "mode", PAINT_STROKE_NORMAL);
-       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_stroke", LEFTMOUSE, 
KM_PRESS, KM_CTRL,          0)->ptr, "mode", PAINT_STROKE_INVERT);
-       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_stroke", LEFTMOUSE, 
KM_PRESS, KM_SHIFT,         0)->ptr, "mode", PAINT_STROKE_SWITCH);
-       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_stroke", LEFTMOUSE, 
KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "mode", 
PAINT_STROKE_SWITCH|PAINT_STROKE_INVERT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_sculpt_stroke", 
LEFTMOUSE, KM_PRESS, 0,                0)->ptr, "mode", PAINT_STROKE_NORMAL);
+       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_sculpt_stroke", 
LEFTMOUSE, KM_PRESS, KM_CTRL,          0)->ptr, "mode", PAINT_STROKE_INVERT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_sculpt_stroke", 
LEFTMOUSE, KM_PRESS, KM_SHIFT,         0)->ptr, "mode", PAINT_STROKE_SWITCH);
+       RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_sculpt_stroke", 
LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "mode", 
PAINT_STROKE_SWITCH|PAINT_STROKE_INVERT);
 
        WM_keymap_add_item(keymap, "SCULPT_OT_area_hide", EVT_TWEAK_L, KM_ANY, 
KM_CTRL|KM_SHIFT, 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "SCULPT_OT_area_hide", 
EVT_TWEAK_L, KM_ANY, KM_CTRL|KM_ALT, 0)->ptr, "hide_inside", 1);
@@ -617,7 +617,7 @@
        keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
        keymap->poll= vertex_paint_mode_poll;
 
-       WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, 
KM_PRESS, 0, 0);
+       WM_keymap_verify_item(keymap, "PAINT_OT_vpaint_stroke", LEFTMOUSE, 
KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, 
KM_PRESS, 0, 0);
 
        WM_keymap_add_item(keymap,
@@ -684,7 +684,7 @@
        /* paint stroke */
        {
                wmKeyMap* keymap= paint_stroke_modal_keymap(keyconf);
-               WM_modalkeymap_assign(keymap, "SCULPT_OT_stroke");
-               WM_modalkeymap_assign(keymap, "PAINT_OT_vertex_paint");
+               WM_modalkeymap_assign(keymap, "SCULPT_OT_sculpt_stroke");
+               WM_modalkeymap_assign(keymap, "PAINT_OT_vpaint_stroke");
        }
 }

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-07-29 02:15:01 UTC (rev 38807)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-07-29 03:05:37 UTC (rev 38808)
@@ -106,20 +106,6 @@
        return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh 
*)ob->data)->totface;
 }
 
-int vertex_paint_poll(const struct bContext *C)
-{
-       if(vertex_paint_mode_poll(C) && 
-          paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) {
-               ScrArea *sa= CTX_wm_area(C);
-               if(sa->spacetype==SPACE_VIEW3D) {
-                       ARegion *ar= CTX_wm_region(C);
-                       if(ar->regiontype==RGN_TYPE_WINDOW)
-                               return 1;
-                       }
-               }
-       return 0;
-}
-
 int weight_paint_mode_poll(const struct bContext *C)
 {
        Object *ob = CTX_data_active_object(C);
@@ -149,10 +135,10 @@
 static VPaint *new_vpaint(int wpaint)
 {
        VPaint *vp= MEM_callocN(sizeof(VPaint), "VPaint");
-       
-       vp->flag= VP_AREA+VP_SPRAY;
-       
-       if(wpaint)
+
+       vp->flag= VP_AREA|VP_SPRAY;
+
+       if (wpaint)
                vp->flag= VP_AREA;
 
        return vp;
@@ -1530,89 +1516,9 @@
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-/* ************ set / clear vertex paint mode ********** */
 
-static int vpaint_stroke_get_location(
-       const struct bContext *C,
-       float out[3],
-       const struct PaintStroke *stroke,
-       const float mouse[2]);
 
-static int set_vpaint(bContext *C, wmOperator *op)             /* toggle */
-{      
-       Object *ob= CTX_data_active_object(C);
-       Scene *scene= CTX_data_scene(C);
-       VPaint *vp= scene->toolsettings->vpaint;
-       Mesh *me;
-       
-       me= get_mesh(ob);
-       
-       if(me==NULL || object_data_is_libdata(ob)) {
-               ob->mode &= ~OB_MODE_VERTEX_PAINT;
-               return OPERATOR_PASS_THROUGH;
-       }
-       
-       /* toggle: end vpaint */
-       if(ob->mode & OB_MODE_VERTEX_PAINT) {
-               free_paintsession(ob);
-               
-               ob->mode &= ~OB_MODE_VERTEX_PAINT;
 
-               paint_mode_exit(&(vp->paint));
-       }
-       else {
-               ob->mode |= OB_MODE_VERTEX_PAINT;
-               /* Turn off weight painting */
-               if (ob->mode & OB_MODE_WEIGHT_PAINT)
-                       set_wpaint(C, op);
-               
-               if(vp==NULL)
-                       vp= scene->toolsettings->vpaint= new_vpaint(0);
-               
-               if(me->mcol==NULL)
-                       make_vertexcol(ob);
-
-               create_paintsession(ob);
-               
-               paint_mode_init(
-                       CTX_wm_manager(C),
-                       &(vp->paint),
-                       OB_MODE_VERTEX_PAINT,
-                       vertex_paint_poll,
-                       paint_draw_cursor,
-                       vpaint_stroke_get_location);
-
-               // SNIP paint_init(&vp->paint, OB_MODE_VERTEX_PAINT);
-       }
-       
-       /* create pbvh */
-       if(ob->mode & OB_MODE_VERTEX_PAINT) {
-               DerivedMesh *dm = mesh_get_derived_final(scene, ob, 
CD_MASK_BAREMESH|CD_MASK_MCOL);
-               ob->paint->pbvh = dm->getPBVH(ob, dm);
-       }
-       
-       WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
-       
-       return OPERATOR_FINISHED;
-}
-
-void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
-{
-       
-       /* identifiers */
-       ot->name= "Vertex Paint Mode";
-       ot->idname= "PAINT_OT_vertex_paint_toggle";
-       
-       /* api callbacks */
-       ot->exec= set_vpaint;
-       ot->poll= paint_poll_test;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-
-
 /* ********************** vertex paint operator ******************* */
 
 /* Implementation notes:
@@ -1664,12 +1570,20 @@

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