[Bf-blender-cvs] [3b3c82042e6] profiler-editor: add functions to rna
Jacques Lucke
noreply at git.blender.org
Thu Apr 29 11:30:47 CEST 2021
Commit: 3b3c82042e6e6c799101dffe61b549f4a583aa10
Author: Jacques Lucke
Date: Tue Apr 27 15:41:13 2021 +0200
Branches: profiler-editor
https://developer.blender.org/rB3b3c82042e6e6c799101dffe61b549f4a583aa10
add functions to rna
===================================================================
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 516ddf2932a..e3e3f2c2cda 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -34,6 +34,7 @@
#include "BKE_node.h"
#include "BKE_studiolight.h"
+#include "ED_profiler.h"
#include "ED_spreadsheet.h"
#include "ED_text.h"
@@ -3162,6 +3163,12 @@ static void rna_spreadsheet_set_geometry_node_context(SpaceSpreadsheet *sspreads
WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL);
}
+static bool rna_SpaceProfiler_profile_is_enabled_get(PointerRNA *ptr)
+{
+ SpaceProfiler *sprofiler = ptr->data;
+ return ED_profiler_profile_is_enabled(sprofiler);
+}
+
#else
static const EnumPropertyItem dt_uv_items[] = {
@@ -7574,9 +7581,26 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna)
static void rna_def_space_profiler(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
srna = RNA_def_struct(brna, "SpaceProfiler", "Space");
RNA_def_struct_ui_text(srna, "Space Profiler", "Profiler space data");
+
+ func = RNA_def_function(srna, "profile_enable", "ED_profiler_profile_enable");
+ RNA_def_function_ui_description(func, "Enable profile recording in this editor");
+
+ func = RNA_def_function(srna, "profile_disable", "ED_profiler_profile_disable");
+ RNA_def_function_ui_description(func, "Disable profile recording in this editor");
+
+ prop = RNA_def_property(srna, "profile_is_enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceProfiler_profile_is_enabled_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Profiling is Enabled", "True if this editor is currently recording");
+
+ func = RNA_def_function(srna, "profile_clear", "ED_profiler_profile_clear");
+ RNA_def_function_ui_description(func, "Reset recorded profile in this editor");
}
void RNA_def_space(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list