Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-04 11:29:45 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-04 11:29:45 +0400
commit46cd2a6a38a67c7dfc3e5a8880b6f7f055e50a8a (patch)
treeeb678691d0d90b24d8c756ce99ba20f8a2b51aa7 /source/blender/editors/sculpt_paint/paint_utils.c
parent4414f38cbfa22d875039c4660af2954f6d7cdfc3 (diff)
Fix #31093: Brush's "Paint curve presets" in Image paint in UV\Image Editor doesn't work if weight paint mode is active
Some operators like curve presets, color sample and some more were using object's mode to distinguish in which mode user is currently painting. Such approach fails in cases when there's paint mode active in 3D viewport and Image Editor. Changed logic here to use some context's state like active space which helps distinguishing current paint mode more accurate. Ported all areas which uses paint_get_active() to new paint_get_active_from_context(). There're still some calls to paint_get_active(), but that shouldn't be harmful due to that places indeed have object's mode as priority when getting paint mode.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_utils.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 4c374674c9a..082e40f8e4c 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -333,9 +333,9 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index,
}
/* used for both 3d view and image window */
-void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf */
+void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* frontbuf */
{
- Brush *br = paint_brush(paint_get_active(scene));
+ Brush *br = paint_brush(paint_get_active_from_context(C));
unsigned int col;
char *cp;
@@ -357,7 +357,7 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
{
- Brush *br = paint_brush(paint_get_active(CTX_data_scene(C)));
+ Brush *br = paint_brush(paint_get_active_from_context(C));
BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
return OPERATOR_FINISHED;
@@ -365,7 +365,7 @@ static int brush_curve_preset_exec(bContext *C, wmOperator *op)
static int brush_curve_preset_poll(bContext *C)
{
- Brush *br = paint_brush(paint_get_active(CTX_data_scene(C)));
+ Brush *br = paint_brush(paint_get_active_from_context(C));
return br && br->curve;
}