RNA: fix for yesterday's commit, browsing screens and scenes was

not working anymore, relies on special notifiers.
This commit is contained in:
Brecht Van Lommel
2009-12-09 10:55:28 +00:00
parent 9b6b74f292
commit 3712e78d52
3 changed files with 14 additions and 8 deletions

View File

@@ -61,13 +61,13 @@ static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
sc->newscene= value.data;
}
static void rna_Screen_scene_update(Main *bmain, Scene *scene, PointerRNA *ptr)
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_main_add_notifier(NC_SCENE|ND_SCENEBROWSE, sc->newscene);
WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, sc->newscene);
sc->newscene= NULL;
}
}
@@ -178,6 +178,7 @@ static void rna_def_screen(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL);
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen.");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);

View File

@@ -348,13 +348,13 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
win->newscreen= value.data;
}
static void rna_Window_screen_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
{
wmWindow *win= (wmWindow*)ptr->data;
/* exception: can't set screens inside of area/region handers */
if(win->newscreen) {
WM_main_add_notifier(NC_SCREEN|ND_SCREENBROWSE, win->newscreen);
WM_event_add_notifier(C, NC_SCREEN|ND_SCREENBROWSE, win->newscreen);
win->newscreen= NULL;
}
}
@@ -772,6 +772,7 @@ static void rna_def_window(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window.");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_screen_set", NULL);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_Window_screen_update");
}

View File

@@ -214,21 +214,25 @@ void wm_event_do_notifiers(bContext *C)
if(note->category==NC_SCREEN) {
if(note->data==ND_SCREENBROWSE) {
ED_screen_set(C, note->reference); // XXX hrms, think this over!
printf("screen set %p\n", note->reference);
if(G.f & G_DEBUG)
printf("screen set %p\n", note->reference);
}
else if(note->data==ND_SCREENDELETE) {
ED_screen_delete(C, note->reference); // XXX hrms, think this over!
printf("screen delete %p\n", note->reference);
if(G.f & G_DEBUG)
printf("screen delete %p\n", note->reference);
}
}
else if(note->category==NC_SCENE) {
if(note->data==ND_SCENEBROWSE) {
ED_screen_set_scene(C, note->reference); // XXX hrms, think this over!
printf("scene set %p\n", note->reference);
if(G.f & G_DEBUG)
printf("scene set %p\n", note->reference);
}
if(note->data==ND_SCENEDELETE) {
ED_screen_delete_scene(C, note->reference); // XXX hrms, think this over!
printf("scene delete %p\n", note->reference);
if(G.f & G_DEBUG)
printf("scene delete %p\n", note->reference);
}
else if(note->data==ND_FRAME)
do_anim= 1;