diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-04-08 11:07:10 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-04-08 11:07:10 +0400 |
commit | babdd90e2e8f0b790833a56d1641e0d0fbd523d0 (patch) | |
tree | c5e5be2af75d8dc5ab3c13494bb2b4ff54dd634b /source/blender/editors/render/render_shading.c | |
parent | a4520320ef70fc7e7cae8399e086fd8337f971a8 (diff) |
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.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r-- | source/blender/editors/render/render_shading.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 */ |