diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-07-13 16:26:00 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-07-13 16:26:00 +0300 |
commit | 2be7a11e4331d7a16ab29c474624b81b66eeecd4 (patch) | |
tree | f4387ea9e1e825a97ef56791424646309ce4bcf1 /source | |
parent | b9f565881e15f13f5f30b6aca9fc656b3f92b900 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 12 |
1 files changed, 12 insertions, 0 deletions
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); |