Fix T34993: "Jump to Next Keyframe" shortcut not related to the timeline viewable keyframes

Made the timeline option to only show keyframes from selected channels/data be a
per-scene setting instead of the per-timeline option it was previously. This makes
it easier for animators working on rigs with multiple bones (especially during the
polishing phase), since now the timeline and jump to keyframe operators use the same
setting to decide which subset of keyframes they need to consider.

By default, this option is enabled by default.

TODO: Extend this to the keyframe status shading on the active object name in the 3D view?
This commit is contained in:
Joshua Leung 2014-04-26 03:36:34 +12:00
parent b6e967be63
commit c26105278f
6 changed files with 19 additions and 8 deletions

View File

@ -122,6 +122,7 @@ class TIME_MT_view(Menu):
def draw(self, context):
layout = self.layout
scene = context.scene
st = context.space_data
layout.prop(st, "show_seconds")
@ -130,7 +131,7 @@ class TIME_MT_view(Menu):
layout.separator()
layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_only_selected")
layout.prop(scene, "show_keys_from_selected_only")
layout.separator()

View File

@ -2095,6 +2095,12 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
/* init binarytree-list for getting keyframes */
BLI_dlrbTree_init(&keys);
/* seed up dummy dopesheet context with flags to perform necessary filtering */
if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) {
/* only selected channels are included */
ads.filterflag |= ADS_FILTER_ONLYSEL;
}
/* populate tree with keyframe nodes */
scene_to_keylist(&ads, scene, &keys, NULL);

View File

@ -341,7 +341,7 @@ static void time_draw_keyframes(const bContext *C, SpaceTime *stime, ARegion *ar
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
View2D *v2d = &ar->v2d;
short onlysel = (stime->flag & TIME_ONLYACTSEL);
bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0);
/* draw scene keyframes first
* - don't try to do this when only drawing active/selected data keyframes,

View File

@ -1245,6 +1245,8 @@ typedef struct Scene {
/* use preview range */
#define SCER_PRV_RANGE (1<<0)
#define SCER_LOCK_FRAME_SELECTION (1<<1)
/* timeline/keyframe jumping - only selected items (on by default) */
#define SCE_KEYS_NO_SELONLY (1<<2)
/* mode (int now) */
#define R_OSA 0x0001

View File

@ -5247,6 +5247,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Preview Range End Frame", "Alternative end frame for UI playback");
RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
/* Timeline / Time Navigation settings */
prop = RNA_def_property(srna, "show_keys_from_selected_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCE_KEYS_NO_SELONLY);
RNA_def_property_ui_text(prop, "Only Keyframes from Selected Channels",
"Consider keyframes for active Object and/or its selected bones only "
"(in timeline and when jumping between keyframes)");
RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
/* Stamp */
prop = RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");

View File

@ -2941,12 +2941,6 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data");
/* view settings */
prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
RNA_def_property_ui_text(prop, "Only Selected Channels",
"Show keyframes for active Object and/or its selected bones only");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
RNA_def_property_ui_text(prop, "Show Frame Number Indicator",