mask now draws in the image view, misc minor edits.

This commit is contained in:
Campbell Barton 2012-07-25 13:44:59 +00:00
parent eed0fda33c
commit 1091030c11
8 changed files with 35 additions and 17 deletions

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

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

@ -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();

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

@ -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);
}

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

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

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