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:
authorCampbell Barton <ideasman42@gmail.com>2020-01-20 12:45:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-01-20 12:46:29 +0300
commitcfae9fb9e4836b61369c4261f5f6a8311f7d18b9 (patch)
tree13e3eb92c6e449e7ac73a468909c244e39229110 /source/blender/editors/sculpt_paint
parent02f6722350d9b613450016505db0c24ba2bc9109 (diff)
Fix T73224: Crash calling UV Sculpt from operator search
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 72b02436b92..5beaff5ef00 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -807,6 +807,23 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_RUNNING_MODAL;
}
+static bool uv_sculpt_stroke_poll(bContext *C)
+{
+ if (ED_operator_uvedit_space_image(C)) {
+ /* While these values could be initialized on demand,
+ * the only case this would be useful is running from the operator search popup.
+ * This is such a corner case that it's simpler to check a brush has already been created
+ * (something the tool system ensures). */
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
+ Brush *brush = BKE_paint_brush(&ts->uvsculpt->paint);
+ if (brush != NULL) {
+ return true;
+ }
+ }
+ return false;
+}
+
void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
{
static const EnumPropertyItem stroke_mode_items[] = {
@@ -832,7 +849,7 @@ void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
/* api callbacks */
ot->invoke = uv_sculpt_stroke_invoke;
ot->modal = uv_sculpt_stroke_modal;
- ot->poll = ED_operator_uvedit_space_image;
+ ot->poll = uv_sculpt_stroke_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;