Add a "selected_nla_strips" context member

Needed for upcomming fix for T66494.

ref T66494 / D7281
This commit is contained in:
Philipp Oeser 2020-03-30 19:33:13 +02:00
parent 029a714fc7
commit f8c4f5e308
Notes: blender-bot 2023-02-14 07:25:51 +01:00
Referenced by issue #66494, NLA Alt+changing value works for selected object but not for selected strips
1 changed files with 24 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
@ -88,6 +89,7 @@ const char *screen_context_dir[] = {
"sequences",
"selected_sequences",
"selected_editable_sequences", /* sequencer */
"selected_nla_strips", /* nla editor */
"gpencil_data",
"gpencil_data_owner", /* grease pencil data */
"annotation_data",
@ -503,6 +505,28 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
}
else if (CTX_data_equals(member, "selected_nla_strips")) {
bAnimContext ac;
if (ANIM_animdata_get_context(C, &ac) != 0) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
ANIM_animdata_filter(&ac, &anim_data, ANIMFILTER_DATA_VISIBLE, ac.data, ac.datatype);
for (ale = anim_data.first; ale; ale = ale->next) {
NlaTrack *nlt = (NlaTrack *)ale->data;
NlaStrip *strip;
for (strip = nlt->strips.first; strip; strip = strip->next) {
if (strip->flag & NLASTRIP_FLAG_SELECT) {
CTX_data_list_add(result, &scene->id, &RNA_NlaStrip, strip);
}
}
}
ANIM_animdata_freelist(&anim_data);
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
}
else if (CTX_data_equals(member, "gpencil_data")) {
/* FIXME: for some reason, CTX_data_active_object(C) returns NULL when called from these
* situations (as outlined above - see Campbell's #ifdefs).