From 9347dd04a30ea091df4cc5d54af5a84e83652afc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Oct 2010 01:10:56 +0000 Subject: bugfix [#24231] outliner not refreshed correctly also made world changes only redraw the 3d view if 'Render Only' option is set. --- .../editors/space_outliner/space_outliner.c | 1 + source/blender/editors/space_view3d/space_view3d.c | 33 ++++++++++++++++++---- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_world.c | 5 ++-- source/blender/windowmanager/WM_types.h | 1 + 5 files changed, 32 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index f0f9ac945ef..5667ae51ee4 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -104,6 +104,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_FRAME: case ND_RENDER_OPTIONS: case ND_LAYER: + case ND_WORLD: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8a215834c38..629e0efe2ce 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -548,22 +548,36 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene base= base->next; } - sa= win->screen->areabase.first; - while(sa) { - if(sa->spacetype == SPACE_VIEW3D) - if(BLI_findindex(&sa->regionbase, ar) >= 0) { + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) { + if(BLI_findindex(&sa->regionbase, ar) != -1) { View3D *v3d= sa->spacedata.first; v3d->lay_used= lay_used; break; } + } + } +} - sa= sa->next; +static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn) +{ + wmWindow *win= wmn->wm->winactive; + ScrArea *sa; + + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) + if(BLI_findindex(&sa->regionbase, ar) != -1) { + return (View3D *)sa->spacedata.first; + } } + + return NULL; } static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { bScreen *sc; + View3D *v3d; /* context changes */ switch(wmn->category) { @@ -600,6 +614,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: ED_region_tag_redraw(ar); break; + case ND_WORLD: + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); + break; } if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); @@ -650,7 +669,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_WORLD: switch(wmn->data) { case ND_WORLD_DRAW: - ED_region_tag_redraw(ar); + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); break; } break; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2cccf96c518..bc778ff3256 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3094,7 +3094,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_WORLD, NULL); prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index ecf253acbce..726d64f26f4 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -478,9 +478,8 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon"); /* RNA_def_property_update(prop, 0, "rna_World_update"); */ - /* render-only uses this, the notifier could be made to be more spesific */ - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_World_update"); - + /* render-only uses this */ + RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update"); prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0447524255f..7af6de6c86c 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -191,6 +191,7 @@ typedef struct wmNotifier { #define ND_TOOLSETTINGS (15<<16) #define ND_LAYER (16<<16) #define ND_FRAME_RANGE (17<<16) +#define ND_WORLD (92<<16) #define ND_LAYER_CONTENT (101<<16) /* NC_OBJECT Object */ -- cgit v1.2.3