diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 29 |
3 files changed, 47 insertions, 19 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 9b98be61cbf..1208d69a988 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -924,13 +924,6 @@ static void rna_Scene_volume_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_VOLUME | ID_RECALC_SEQUENCER_STRIPS); } -static const char *rna_Scene_statistics_string_get(Scene *UNUSED(scene), - Main *UNUSED(bmain), - ViewLayer *view_layer) -{ - return ED_info_footer_string(view_layer); -} - static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images; @@ -7275,9 +7268,6 @@ void RNA_def_scene(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - FunctionRNA *func; - PropertyRNA *parm; - static const EnumPropertyItem audio_distance_model_items[] = { {0, "NONE", 0, "None", "No distance attenuation"}, {1, "INVERSE", 0, "Inverse", "Inverse distance model"}, @@ -7669,14 +7659,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); - /* Statistics */ - func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get"); - RNA_def_function_flag(func, FUNC_USE_MAIN); - parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "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); - /* Grease Pencil */ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "gpd"); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index ea6421c8d11..2b65bf4922c 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -30,6 +30,8 @@ #include "DNA_screen_types.h" #include "DNA_workspace_types.h" +#include "ED_info.h" + const EnumPropertyItem rna_enum_region_type_items[] = { {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, @@ -286,6 +288,11 @@ static void rna_View2D_view_to_region( } } +static const char *rna_Screen_statusbar_info_get(struct bScreen *screen, Main *bmain, bContext *C) +{ + return ED_info_statusbar_string(bmain, screen, C); +} + #else /* Area.spaces */ @@ -536,6 +543,9 @@ static void rna_def_screen(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + srna = RNA_def_struct(brna, "Screen", "ID"); RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */ RNA_def_struct_ui_text( @@ -570,11 +580,18 @@ static void rna_def_screen(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen"); + /* Status Bar. */ + prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR); - RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar"); + RNA_def_property_ui_text(prop, "Show Status Bar", "Show Status Bar"); RNA_def_property_update(prop, 0, "rna_Screen_bar_update"); + func = RNA_def_function(srna, "statusbar_info", "rna_Screen_statusbar_info_get"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT); + parm = RNA_def_string(func, "statusbar_info", NULL, 0, "Status Bar Info", ""); + RNA_def_function_return(func, parm); + /* Define Anim Playback Areas */ prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 956fb65054b..e609bdacb02 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -188,6 +188,7 @@ static const EnumPropertyItem rna_enum_userdef_viewport_aa_items[] = { # include "DEG_depsgraph.h" # include "GPU_draw.h" +# include "GPU_extensions.h" # include "GPU_select.h" # include "BLF_api.h" @@ -1066,6 +1067,11 @@ static void rna_UserDef_studiolight_light_ambient_get(PointerRNA *ptr, float *va copy_v3_v3(values, sl->light_ambient); } +int rna_show_statusbar_vram_editable(struct PointerRNA *UNUSED(ptr), const char **UNUSED(r_info)) +{ + return GPU_mem_stats_supported() ? PROP_EDITABLE : 0; +} + #else # define USERDEF_TAG_DIRTY_PROPERTY_UPDATE_ENABLE \ @@ -4771,6 +4777,29 @@ static void rna_def_userdef_view(BlenderRNA *brna) "Translate New Names", "Translate the names of new data-blocks (objects, materials...)"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + /* Statusbar. */ + + prop = RNA_def_property(srna, "show_statusbar_memory", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_MEMORY); + RNA_def_property_ui_text(prop, "Show Memory", "Show Blender memory usage"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_vram", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VRAM); + RNA_def_property_ui_text(prop, "Show VRAM", "Show GPU video memory usage"); + RNA_def_property_editable_func(prop, "rna_show_statusbar_vram_editable"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_version", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_VERSION); + RNA_def_property_ui_text(prop, "Show Version", "Show Blender version string"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_statusbar_stats", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "statusbar_flag", STATUSBAR_SHOW_STATS); + RNA_def_property_ui_text(prop, "Show Statistics", "Show scene statistics"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, "rna_userdef_update"); } static void rna_def_userdef_edit(BlenderRNA *brna) |