From babdd90e2e8f0b790833a56d1641e0d0fbd523d0 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 8 Apr 2013 07:07:10 +0000 Subject: Fix [#34920] Hit Spacebar, search for freestyle, click Move Freestyle Module - crash Simply add a poll func to (re)move freestyle module ops, to check whether we actually have an active module in context. --- source/blender/editors/render/render_shading.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/editors/render') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index aae161a4721..7323e434143 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -586,6 +586,14 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) #ifdef WITH_FREESTYLE +static int freestyle_active_module_poll(bContext *C) +{ + PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); + FreestyleModuleConfig *module = ptr.data; + + return module != NULL; +} + static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -634,6 +642,7 @@ void SCENE_OT_freestyle_module_remove(wmOperatorType *ot) ot->description = "Remove the style module from the stack"; /* api callbacks */ + ot->poll = freestyle_active_module_poll; ot->exec = freestyle_module_remove_exec; /* flags */ @@ -673,6 +682,7 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) ot->description = "Change the position of the style module within in the list of style modules"; /* api callbacks */ + ot->poll = freestyle_active_module_poll; ot->exec = freestyle_module_move_exec; /* flags */ -- cgit v1.2.3