[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26230] trunk/blender/source/blender/ makesrna/intern/rna_scene.c: unlinking objects from a scene in python wasnt notifying the outliner which would crash on redraw .

Campbell Barton ideasman42 at gmail.com
Sun Jan 24 18:40:05 CET 2010


Revision: 26230
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26230
Author:   campbellbarton
Date:     2010-01-24 18:40:05 +0100 (Sun, 24 Jan 2010)

Log Message:
-----------
unlinking objects from a scene in python wasnt notifying the outliner which would crash on redraw.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-01-24 13:11:43 UTC (rev 26229)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-01-24 17:40:05 UTC (rev 26230)
@@ -150,15 +150,17 @@
 	DAG_scene_sort(scene);
 }
 
-static void rna_Scene_unlink_object(Scene *sce, ReportList *reports, Object *ob)
+static void rna_Scene_unlink_object(Scene *scene, bContext *C, ReportList *reports, Object *ob)
 {
-	Base *base= object_in_scene(ob, sce);
+	Base *base= object_in_scene(ob, scene);
 	if (!base) {
 		BKE_report(reports, RPT_ERROR, "Object is not in this scene.");
 		return;
 	}
 	/* as long as ED_base_object_free_and_unlink calls free_libblock_us, we don't have to decrement ob->id.us */
-	ED_base_object_free_and_unlink(sce, base);
+	ED_base_object_free_and_unlink(scene, base);
+
+	WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
 }
 
 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
@@ -2376,7 +2378,7 @@
 
 	func= RNA_def_function(srna, "unlink", "rna_Scene_unlink_object");
 	RNA_def_function_ui_description(func, "Unlink object from scene.");
-	RNA_def_function_flag(func, FUNC_USE_REPORTS);
+	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene.");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 





More information about the Bf-blender-cvs mailing list