diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 20:23:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-12-08 20:23:48 +0300 |
commit | 07904712e8943b5845df9559093018c8473f72f3 (patch) | |
tree | 03cdc6ea24ac87a2ee2a3c1a7299874040675489 /source/blender/makesrna/intern/rna_screen.c | |
parent | ee74e720a82b7a1fb5f732cd8ceacbb26fa7e0d3 (diff) |
RNA:
* Property update functions no longer get context, instead they get only
Main and Scene. The RNA api was intended to be as context-less as
possible, since it doesn't really matter who is changing the property,
everything that uses the property should be updated.
* There's still one exception case that use it now, screen operations
still depend on context too much. It also revealed a few places using
context where they shouldn't.
* Ideally Scene shouldn't be passed, but much of Blender still depends on
it, should be dropped when we try to support multiple scene editing.
Change was planned for a while, but need this now to be able to call
update without a context pointer.
Diffstat (limited to 'source/blender/makesrna/intern/rna_screen.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 57ab63c952d..da8f326caca 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -61,13 +61,13 @@ static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value) sc->newscene= value.data; } -static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr) +static void rna_Screen_scene_update(Main *bmain, Scene *scene, 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); + WM_main_add_notifier(NC_SCENE|ND_SCENEBROWSE, sc->newscene); sc->newscene= NULL; } } @@ -94,10 +94,8 @@ static void rna_Area_type_update(bContext *C, PointerRNA *ptr) { ScrArea *sa= (ScrArea*)ptr->data; - if(sa) { - ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */ - ED_area_tag_redraw(sa); - } + ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */ + ED_area_tag_redraw(sa); } #else @@ -135,9 +133,9 @@ static void rna_def_area(BlenderRNA *brna) RNA_def_property_enum_items(prop, space_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", NULL); RNA_def_property_ui_text(prop, "Type", "Space type."); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_update(prop, 0, "rna_Area_type_update"); - RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw"); } |