Using batFINGERs example from here I get the data from the lower right corner to the top left corner. Is there a way to read the data in the opposite direction?

Example here: How to get a clip's source media starting and ending frame numbers?

EDIT: I just realized that the order of the list is the order clips are added to the timeline and not the order the clips are located in the timelines. So reversing the loop is not the solution.

  • $\begingroup$ These lists should be sortable and therefore reversable. $\endgroup$ – Samoth Mar 25 '17 at 2:25
  • $\begingroup$ How do I do that in batFINGERS example? $\endgroup$ – tintwotin Mar 25 '17 at 4:46
  • $\begingroup$ maybe somehow related or of help... blender.stackexchange.com/a/57235/2843 $\endgroup$ – Samoth Mar 25 '17 at 10:59
  • $\begingroup$ Rather than changing and adding to your question again and again you should ask new precise questions and maybe link to the previous one. This site is not like a forum. It's hard to keep up with changing requirements... ;-) $\endgroup$ – Samoth Mar 26 '17 at 7:14
  • $\begingroup$ I'm sorry. I'm a Stack Exchange and Python noob. But I'm really, really greatful for all of your execelent help. I would have been stuck with the EDL export script without you. Part of my problem is that what I think I need solved chances as I learn from you guys. So the question changes, but my ultimate goal remains the same, so I should proberly be more clear in the way I ask the questions. Thanks again! $\endgroup$ – tintwotin Mar 26 '17 at 7:49

Python's sorted() can use a custom function that defines the key to use when sorting a list and it also has a reverse option.

def start(strip):
    return strip.frame_start

def end(strip):
    return strip.frame_start + strip.frame_final_duration

Then you can sort by start or end frame with

seq_strips = bpy.context.scene.sequence_editor.sequences

strips_by_start = sorted(seq_strips, key=start)

strips_reversed = sorted(seq_strips, key=end, reverse=True)
|improve this answer|||||
  • $\begingroup$ Thank you. I didn't know about the sorted function. It is very helpful. I managed to get the list sorted after clip start points in sequence and after channels(reversed), but I also need to get all video related clips first(including effectstrips like Cross, Wipe etc.) and then all sound related clips. Is there some way to do this? $\endgroup$ – tintwotin Mar 26 '17 at 6:20
  • $\begingroup$ Expand the key function used - build the sorting index by using frame_start+channel+type maybe multiply frame by 100,000 and channel by 10,000 $\endgroup$ – sambler Mar 26 '17 at 6:30
  • $\begingroup$ Can't you just call sorted multiple times with different keys to achieve that? $\endgroup$ – Samoth Mar 26 '17 at 7:10
  • $\begingroup$ I have first sorted all clips after their start frames and then sorted in channels. And since the sorting is stable the previous sorting is still respected. So that question is solved. However in most nles all video is located in the top tracks and all audio is located in the bottom tracks. So crossfades and wipes should not be separated from video clips. Actually I only need to separate the audio clips. I might just do one loop for video and one for audio. $\endgroup$ – tintwotin Mar 26 '17 at 7:38

Here's some help:

Just use reversed(...) on that collection like reversed(vse.sequences_all) in the case of this script and you're done...

|improve this answer|||||
  • $\begingroup$ Thank you for this function I didn't know about it. However I just realized that the order of the list is the order clips are added to the timeline and not the order the clips are located in the timelines. So the question still stands: How to pull sequencer data from the top left corner and to the right lower corner? $\endgroup$ – tintwotin Mar 25 '17 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.