mask now draws in the image view, misc minor edits.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 25 Jul 2012 13:44:59 +0000 (13:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 25 Jul 2012 13:44:59 +0000 (13:44 +0000)
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/paint.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_image/space_image.c
source/blender/makesrna/intern/rna_space.c

index 419fb4cedaeb43bddcac87fb0beed4f140f7e8f7..e517d950d05f456649da29271de8cff0bdb73369 100644 (file)
@@ -51,7 +51,7 @@ extern const char PAINT_CURSOR_VERTEX_PAINT[3];
 extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
 extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
 
-void paint_init(struct Paint *p, const char col[3]);
+void BKE_paint_init(struct Paint *p, const char col[3]);
 void free_paint(struct Paint *p);
 void copy_paint(struct Paint *src, struct Paint *tar);
 
index ef3fd5c93d008e363c9f8ae2111e090892504c2e..56db84ab0d5d54e1b9299a39d5ecb6a3c9eb8821 100644 (file)
@@ -168,7 +168,7 @@ int paint_vertsel_test(Object *ob)
                 );
 }
 
-void paint_init(Paint *p, const char col[3])
+void BKE_paint_init(Paint *p, const char col[3])
 {
        Brush *brush;
 
index aa239af43f7dc3528db1085f1c7852ba830cd291..91a41224d6a5e9cee8633ea56019ca67645c11f5 100644 (file)
@@ -5312,7 +5312,7 @@ void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings
                        settings->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN;
                }
 
-               paint_init(&settings->uvsculpt->paint, PAINT_CURSOR_SCULPT);
+               BKE_paint_init(&settings->uvsculpt->paint, PAINT_CURSOR_SCULPT);
 
                WM_paint_cursor_activate(wm, uv_sculpt_brush_poll,
                                         brush_drawcursor, NULL);
@@ -5602,7 +5602,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
                        me->mtface = CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
                                                          NULL, me->totface);
 
-               paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
+               BKE_paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
 
                if (U.glreslimit != 0)
                        GPU_free_images();
index 1b62ba8a7e0e46c72a1861d793d0757f8033362d..3c389f97b340cec2ebcb9f7f14e1844f3818d6a1 100644 (file)
@@ -1997,7 +1997,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op))  /* toggle */
                if (wp == NULL)
                        wp = scene->toolsettings->wpaint = new_vpaint(1);
 
-               paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
+               BKE_paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
                paint_cursor_start(C, weight_paint_poll);
                
                mesh_octree_table(ob, NULL, NULL, 's');
@@ -2574,7 +2574,7 @@ static int set_vpaint(bContext *C, wmOperator *op)  /* toggle */
                
                paint_cursor_start(C, vertex_paint_poll);
 
-               paint_init(&vp->paint, PAINT_CURSOR_VERTEX_PAINT);
+               BKE_paint_init(&vp->paint, PAINT_CURSOR_VERTEX_PAINT);
        }
        
        if (me)
index 35d508c5a1faec88304dc86ed67d44da4ce6be5f..4932a41579e96f26c4c68bbaa746ef45ea9f7ed6 100644 (file)
@@ -4212,7 +4212,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
                /* Mask layer is required */
                ED_sculpt_mask_layers_ensure(ob, mmd);
 
-               paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT);
+               BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT);
                
                paint_cursor_start(C, sculpt_poll);
        }
index 9b1ffcf31b1fe17266569261a58d770a435de75e..d3fb0157828842d40e7e5b20a1fed59489244053 100644 (file)
@@ -389,7 +389,6 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
                        }
                        switch (wmn->action) {
                                case NA_SELECTED:
-                                       clip_scopes_tag_refresh(sa);
                                        ED_area_tag_redraw(sa);
                                        break;
                                case NA_EDITED:
index 178eba3cb687ab67f4f4c16d4cc81d7482970582..349d4f5d53faa622b18110a58f1da35796f7c885 100644 (file)
@@ -429,6 +429,23 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
                                ED_area_tag_redraw(sa);
                        }
                        break;
+               case NC_MASK:
+                       switch (wmn->data) {
+                               case ND_SELECT:
+                               case ND_DATA:
+                               case ND_DRAW:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
+                       switch (wmn->action) {
+                               case NA_SELECTED:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                               case NA_EDITED:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
+                       break;
                case NC_GEOM:
                        switch (wmn->data) {
                                case ND_DATA:
@@ -468,8 +485,7 @@ static int image_context(const bContext *C, const char *member, bContextDataResu
                return 1;
        }
        else if (CTX_data_equals(member, "edit_mask")) {
-               Scene *scene = CTX_data_scene(C);
-               Mask *mask = BKE_sequencer_mask_get(scene); /* XXX */
+               Mask *mask = ED_space_image_get_mask(sima);
                if (mask) {
                        CTX_data_id_pointer_set(result, &mask->id);
                }
@@ -605,12 +621,12 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
        draw_image_grease_pencil((bContext *)C, 0);
 
        {
-               Mask *mask = BKE_sequencer_mask_get(scene); /* XXX */
+               Mask *mask = ED_space_image_get_mask(sima);
                if (mask) {
                        int width, height;
                        ED_mask_size(C, &width, &height);
                        ED_mask_draw_region(mask, ar,
-                                           0, 0,  /* TODO */
+                                           sima->mask_info.draw_flag, sima->mask_info.draw_type,
                                            width, height,
                                            TRUE, FALSE,
                                            NULL, C);
index c710831d4213dac7519311df895cf83c47318f1d..acfd413fddef3dcb5fb212463b4aaac57e297f61 100644 (file)
@@ -123,7 +123,7 @@ EnumPropertyItem clip_editor_mode_items[] = {
        {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
                                 "Show tracking/reconstruction tools"},
        {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
-       {SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
+       {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -529,11 +529,14 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
        return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
 }
 
-static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
+static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-       paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
+       SpaceImage *sima = (SpaceImage *)(ptr->data);
+       if (sima->mode == SI_MODE_PAINT) {
+               BKE_paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
 
-       ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
+               ED_space_image_paint_update(bmain->wm.first, scene->toolsettings);
+       }
 }
 
 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
@@ -2041,7 +2044,7 @@ static void rna_def_space_image(BlenderRNA *brna)
        RNA_def_property_enum_sdna(prop, NULL, "mode");
        RNA_def_property_enum_items(prop, image_space_mode_items);
        RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceImageEditor_mode_update");
 
        /* grease pencil */
        prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);