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.
This commit is contained in:
Philipp Oeser 2021-08-30 20:56:37 +10:00 committed by Campbell Barton
parent b7cb7b78a8
commit 0a8f53a7b8
Notes: blender-bot 2023-02-14 06:05:22 +01:00
Referenced by commit d374ff5b8f, PyDoc: Fix compilation after recent contex_member addition
1 changed files with 15 additions and 0 deletions

View File

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