Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-28 08:55:24 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-28 08:55:24 +0400
commit412eed6a2753bfdeaf158dd2f82e4ba070f2c254 (patch)
treecf73499fe542a86547af85b311c88d0fecd6638c /source/blender/makesrna/intern/rna_wm.c
parentdd56ebe6076d7ffbe9dd698a5c1bc94fff6ff306 (diff)
RNA functions for adding timer (needed for demo mode, also useful for python modal operators).
- timer = WindowManager.event_timer_add(time_step, window=None) - WindowManager.event_timer_remove(timer) Still TODO, is a way for python to check the timer identity.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index ea26663df44..df029c9d871 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1418,6 +1418,36 @@ static void rna_def_event(BlenderRNA *brna)
RNA_define_verify_sdna(1); // not in sdna
}
+static void rna_def_timer(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "Timer", NULL);
+ RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
+ RNA_def_struct_sdna(srna, "wmTimer");
+
+ RNA_define_verify_sdna(0); // not in sdna
+
+ /* could wrap more, for now this is enough */
+ prop= RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timestep");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Time Step", "");
+
+ prop= RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "delta");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
+
+ prop= RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "duration");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
+
+ RNA_define_verify_sdna(1); // not in sdna
+}
+
static void rna_def_window(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1801,6 +1831,7 @@ void RNA_def_wm(BlenderRNA *brna)
rna_def_macro_operator(brna);
rna_def_operator_type_macro(brna);
rna_def_event(brna);
+ rna_def_timer(brna);
rna_def_window(brna);
rna_def_windowmanager(brna);
rna_def_keyconfig(brna);