[Bf-blender-cvs] [2be7a11e433] master: Python API: new RNA property `Screen.is_scrubbing`

Sybren A. Stüvel noreply at git.blender.org
Mon Jul 13 15:31:09 CEST 2020


Commit: 2be7a11e4331d7a16ab29c474624b81b66eeecd4
Author: Sybren A. Stüvel
Date:   Mon Jul 13 15:26:00 2020 +0200
Branches: master
https://developer.blender.org/rB2be7a11e4331d7a16ab29c474624b81b66eeecd4

Python API: new RNA property `Screen.is_scrubbing`

This commit adds a new read-only boolean property `Screen.is_scrubbing`.

The related property `Screen.is_animation_playing` is set to `True` in
two situations:

- Animation is actually playing (for example via the Play button in the
  timeline)
- The user is scrubbing through time (in the timeline, dopesheet, graph
  editor, etc.)

To distinguish between these two cases, the property
`Screen.is_scrubbing` has been added.

Concept approved by @brecht.

===================================================================

M	source/blender/makesrna/intern/rna_screen.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 20ae69dc031..ea6421c8d11 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -90,6 +90,12 @@ static bool rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
   return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
 }
 
+static bool rna_Screen_is_scrubbing_get(PointerRNA *ptr)
+{
+  bScreen *screen = (bScreen *)ptr->data;
+  return screen->scrubbing;
+}
+
 static int rna_region_alignment_get(PointerRNA *ptr)
 {
   ARegion *region = ptr->data;
@@ -548,6 +554,12 @@ static void rna_def_screen(BlenderRNA *brna)
   RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
   RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
 
+  prop = RNA_def_property(srna, "is_scrubbing", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+  RNA_def_property_boolean_funcs(prop, "rna_Screen_is_scrubbing_get", NULL);
+  RNA_def_property_ui_text(
+      prop, "User is Scrubbing", "True when the user is scrubbing through time");
+
   prop = RNA_def_property(srna, "is_temporary", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_clear_flag(prop, PROP_EDITABLE);
   RNA_def_property_boolean_sdna(prop, NULL, "temp", 1);



More information about the Bf-blender-cvs mailing list