svn merge -r 21041:21301 https://svn.blender.org/svnroot/bf-blender/branches/blender2...
[blender.git] / source / blender / makesrna / intern / rna_screen.c
index 35191744f2273ba122bd0f45a94d125e952df741..a4ba6ec172b5046f1c87443ed681b70b13a3bd2f 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: rna_screen.c 21247 2009-06-29 21:50:53Z jaguarandi $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -42,6 +42,31 @@ EnumPropertyItem region_type_items[] = {
 
 #ifdef RNA_RUNTIME
 
+#include "WM_api.h"
+#include "WM_types.h"
+
+static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
+{
+       bScreen *sc= (bScreen*)ptr->data;
+
+       if(value.data == NULL)
+               return;
+
+       /* exception: can't set screens inside of area/region handers */
+       sc->newscene= value.data;
+}
+
+static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
+{
+       bScreen *sc= (bScreen*)ptr->data;
+
+       /* exception: can't set screens inside of area/region handers */
+       if(sc->newscene) {
+               WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, sc->newscene);
+               sc->newscene= NULL;
+       }
+}
+
 #else
 
 static void rna_def_scrarea(BlenderRNA *brna)
@@ -94,6 +119,9 @@ static void rna_def_bscreen(BlenderRNA *brna)
        
        prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen.");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL);
+       RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
        
        prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);