diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_info.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_info.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 48 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_layer_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 4 |
10 files changed, 41 insertions, 31 deletions
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index f986235cc90..90168429724 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -69,7 +69,7 @@ class INFO_HT_header(Header): return row.operator("wm.splash", text="", icon='BLENDER', emboss=False) - row.label(text=scene.statistics(), translate=False) + row.label(text=scene.statistics(context.render_layer), translate=False) class INFO_MT_editor_menus(Menu): diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 5942e575fd2..fddffa63a59 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -175,6 +175,8 @@ void BKE_scene_layer_free(SceneLayer *sl) IDP_FreeProperty(sl->properties_evaluated); MEM_freeN(sl->properties_evaluated); } + + MEM_SAFE_FREE(sl->stats); } /** diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index b8d69c6077b..ff29affd6d9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -254,7 +254,6 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) scen->theDag = NULL; scen->depsgraph = NULL; scen->obedit = NULL; - scen->stats = NULL; scen->fps_info = NULL; if (sce->rigidbody_world) @@ -317,6 +316,7 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) BLI_duplicatelist(&scen->render_layers, &sce->render_layers); SceneLayer *new_sl = scen->render_layers.first; for (SceneLayer *sl = sce->render_layers.first; sl; sl = sl->next) { + new_sl->stats = NULL; new_sl->properties = IDP_New(IDP_GROUP, (const IDPropertyTemplate *){0}, ROOT_PROP); new_sl->properties_evaluated = NULL; @@ -571,8 +571,7 @@ void BKE_scene_free(Scene *sce) DEG_scene_graph_free(sce); if (sce->depsgraph) DEG_graph_free(sce->depsgraph); - - MEM_SAFE_FREE(sce->stats); + MEM_SAFE_FREE(sce->fps_info); BKE_sound_destroy_scene(sce); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index cac1ec084b5..f44fe3327c9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6049,7 +6049,6 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->theDag = NULL; sce->depsgraph = NULL; sce->obedit = NULL; - sce->stats = NULL; sce->fps_info = NULL; sce->customdata_mask_modal = 0; sce->lay_updated = 0; @@ -6309,6 +6308,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) link_list(fd, &sce->render_layers); for (sl = sce->render_layers.first; sl; sl = sl->next) { + sl->stats = NULL; link_list(fd, &sl->object_bases); sl->basact = newdataadr(fd, sl->basact); direct_link_layer_collections(fd, &sl->layer_collections); diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index 6970abaa633..fe570fef83d 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -28,7 +28,7 @@ #define __ED_INFO_H__ /* info_stats.c */ -void ED_info_stats_clear(struct Scene *scene); -const char *ED_info_stats_string(struct Scene *scene); +void ED_info_stats_clear(struct SceneLayer *sl); +const char *ED_info_stats_string(struct Scene *scene, struct SceneLayer *sl); #endif /* __ED_INFO_H__ */ diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 435d9b2ee26..bd1bdb952d6 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -49,6 +49,7 @@ #include "BKE_displist.h" #include "BKE_DerivedMesh.h" #include "BKE_key.h" +#include "BKE_layer.h" #include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_editmesh.h" @@ -269,9 +270,9 @@ static void stats_object_sculpt_dynamic_topology(Object *ob, SceneStats *stats) stats->tottri = ob->sculpt->bm->totface; } -static void stats_dupli_object(BaseLegacy *base, Object *ob, SceneStats *stats) +static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) { - if (base->flag_legacy & SELECT) stats->totobjsel++; + if (base->flag & BASE_SELECTED) stats->totobjsel++; if (ob->transflag & OB_DUPLIPARTS) { /* Dupli Particles */ @@ -344,11 +345,11 @@ static bool stats_is_object_dynamic_topology_sculpt(Object *ob) } /* Statistics displayed in info header. Called regularly on scene changes. */ -static void stats_update(Scene *scene) +static void stats_update(Scene *scene, SceneLayer *sl) { SceneStats stats = {0}; - Object *ob = (scene->basact) ? scene->basact->object : NULL; - BaseLegacy *base; + Object *ob = (sl->basact) ? sl->basact->object : NULL; + Base *base; if (scene->obedit) { /* Edit Mode */ @@ -364,23 +365,25 @@ static void stats_update(Scene *scene) } else { /* Objects */ - for (base = scene->base.first; base; base = base->next) - if (scene->lay & base->lay) + for (base = sl->object_bases.first; base; base = base->next) + if (base->flag & BASE_VISIBLED) { stats_dupli_object(base, base->object, &stats); + } } - if (!scene->stats) - scene->stats = MEM_callocN(sizeof(SceneStats), "SceneStats"); + if (!sl->stats) { + sl->stats = MEM_callocN(sizeof(SceneStats), "SceneStats"); + } - *(scene->stats) = stats; + *(sl->stats) = stats; } -static void stats_string(Scene *scene) +static void stats_string(Scene *scene, SceneLayer *sl) { #define MAX_INFO_MEM_LEN 64 - SceneStats *stats = scene->stats; + SceneStats *stats = sl->stats; SceneStatsFmt stats_fmt; - Object *ob = (scene->basact) ? scene->basact->object : NULL; + Object *ob = (sl->basact) ? sl->basact->object : NULL; uintptr_t mem_in_use, mmap_in_use; char memstr[MAX_INFO_MEM_LEN]; char gpumemstr[MAX_INFO_MEM_LEN] = ""; @@ -487,19 +490,20 @@ static void stats_string(Scene *scene) #undef MAX_INFO_LEN -void ED_info_stats_clear(Scene *scene) +void ED_info_stats_clear(SceneLayer *sl) { - if (scene->stats) { - MEM_freeN(scene->stats); - scene->stats = NULL; + if (sl->stats) { + MEM_freeN(sl->stats); + sl->stats = NULL; } } -const char *ED_info_stats_string(Scene *scene) +const char *ED_info_stats_string(Scene *scene, SceneLayer *sl) { - if (!scene->stats) - stats_update(scene); - stats_string(scene); + if (!sl->stats) { + stats_update(scene, sl); + } + stats_string(scene, sl); - return scene->stats->infostr; + return sl->stats->infostr; } diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index c97413915c6..6b4c19d2977 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -74,6 +74,7 @@ typedef struct SceneLayer { short flag; short pad[2]; ListBase object_bases; /* ObjectBase */ + struct SceneStats *stats; /* default allocated now */ struct Base *basact; ListBase layer_collections; /* LayerCollection */ struct IDProperty *properties; /* overrides */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index b7d607b6940..57290b70b45 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1689,7 +1689,7 @@ typedef struct Scene { struct Editing *ed; /* sequence editor data is allocated here */ struct ToolSettings *toolsettings; /* default allocated now */ - struct SceneStats *stats; /* default allocated now */ + void *pad2; struct DisplaySafeAreas safe_areas; /* migrate or replace? depends on some internal things... */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 930441dcd5c..f0f43b64f2f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -9230,6 +9230,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Statistics */ func = RNA_def_function(srna, "statistics", "ED_info_stats_string"); + parm = RNA_def_pointer(func, "scene_layer", "SceneLayer", "", "Active layer"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", ""); RNA_def_function_return(func, parm); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 5f28bcc32ed..5d4b7a68d42 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -54,6 +54,7 @@ #include "BKE_context.h" #include "BKE_idprop.h" #include "BKE_global.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -318,7 +319,8 @@ void wm_event_do_notifiers(bContext *C) } } if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_WM)) { - ED_info_stats_clear(win->screen->scene); + SceneLayer *sl = BKE_scene_layer_context_active(win->screen->scene); + ED_info_stats_clear(sl); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); } } |