[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55896] trunk/blender/source/blender/ editors/render/render_shading.c: Fix [#34920] Hit Spacebar, search for freestyle, click Move Freestyle Module - crash

Bastien Montagne montagne29 at wanadoo.fr
Mon Apr 8 09:07:10 CEST 2013


Revision: 55896
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55896
Author:   mont29
Date:     2013-04-08 07:07:10 +0000 (Mon, 08 Apr 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/render/render_shading.c

Modified: trunk/blender/source/blender/editors/render/render_shading.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_shading.c	2013-04-08 05:01:35 UTC (rev 55895)
+++ trunk/blender/source/blender/editors/render/render_shading.c	2013-04-08 07:07:10 UTC (rev 55896)
@@ -586,6 +586,14 @@
 
 #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 @@
 	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 @@
 	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 */




More information about the Bf-blender-cvs mailing list