[Bf-blender-cvs] [f8c4f5e3085] master: Add a "selected_nla_strips" context member

Philipp Oeser noreply at git.blender.org
Wed Apr 1 10:33:11 CEST 2020


Commit: f8c4f5e3085998c7db55fb490cb04c48c575a222
Author: Philipp Oeser
Date:   Mon Mar 30 19:33:13 2020 +0200
Branches: master
https://developer.blender.org/rBf8c4f5e3085998c7db55fb490cb04c48c575a222

Add a "selected_nla_strips" context member

Needed for upcomming fix for T66494.

ref T66494 / D7281

===================================================================

M	source/blender/editors/screen/screen_context.c

===================================================================

diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 9536772be3d..ea29e2f611c 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -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).



More information about the Bf-blender-cvs mailing list