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.
This commit is contained in:
Sybren A. Stüvel 2020-07-13 15:26:00 +02:00
parent b9f565881e
commit 2be7a11e43
1 changed files with 12 additions and 0 deletions

View File

@ -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);