diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-08-30 13:56:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-08-31 00:13:31 +0300 |
commit | 0a8f53a7b847d9c8bdcefc025de70fd2608012b7 (patch) | |
tree | be36d45fd6a1178d6a6a7e3076c772eff4607274 | |
parent | b7cb7b78a87dbf19d6aefe2736df7f873476bf72 (diff) |
Context: add "active_sequence_strip" context member
This is an alternative to context.scene.sequence_editor.active_strip
which could be verbose, especially with additional None checks.
Part of fix for T90723, extracted from D12297.
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index b0181de96a0..390d1bdf428 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -56,6 +56,7 @@ #include "ED_armature.h" #include "ED_gpencil.h" +#include "SEQ_select.h" #include "SEQ_sequencer.h" #include "UI_interface.h" @@ -91,6 +92,7 @@ const char *screen_context_dir[] = { "image_paint_object", "particle_edit_object", "pose_object", + "active_sequence_strip", "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */ @@ -603,6 +605,18 @@ static eContextResult screen_ctx_pose_object(const bContext *C, bContextDataResu } return CTX_RESULT_OK; } +static eContextResult screen_ctx_active_sequence_strip(const bContext *C, + bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + Scene *scene = WM_window_get_active_scene(win); + Sequence *seq = SEQ_select_active_get(scene); + if (seq) { + CTX_data_pointer_set(result, &scene->id, &RNA_Sequence, seq); + return CTX_RESULT_OK; + } + return CTX_RESULT_NO_DATA; +} static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult *result) { wmWindow *win = CTX_wm_window(C); @@ -1097,6 +1111,7 @@ static void ensure_ed_screen_context_functions(void) register_context_function("image_paint_object", screen_ctx_image_paint_object); register_context_function("particle_edit_object", screen_ctx_particle_edit_object); register_context_function("pose_object", screen_ctx_pose_object); + register_context_function("active_sequence_strip", screen_ctx_active_sequence_strip); register_context_function("sequences", screen_ctx_sequences); register_context_function("selected_sequences", screen_ctx_selected_sequences); register_context_function("selected_editable_sequences", screen_ctx_selected_editable_sequences); |