Old 11-26-2020, 02:11 PM   #1
bhuether
Human being with feelings
 
Join Date: Nov 2016
Posts: 226
Default ReorderSelectedTracks - what does optoin '2' do?

Hi, reading about this function, and not quite sure how to interpret option 2.

I am trying to build a track layout based on a lua table, where each row corresponds to a track in order that I want all tracks laid out in.

I have a table with original track layout info (no folders). That is, I know original track indices. I also have a table that specifies the structure I want, which might group some tracks into folders.

As I traverse through this table I always know if I am dealing with a folder I have to create, or an existing track that I have to put in a folder, or put at same level as previous deepest level (not as folder)

So the data table has number of rows, where each row has form

Code:
[i]
   1. Track/Folder Name
   2. IsFolder?
   3. Nearest Parent (a row number of this table)
   4. Original Track Index (if this row is a track and not folder)
So I could have

Code:
1.
   1. Drums
   2. 1
   3. 0
   4. ''
2. 
   1. Kick
   2. 1
   3. 1
   4. ''
3. 
   1. Kick In
   2. 0
   3. 2
   4. sometrackindex
4. 
   1. Kick Out
   2. 0
   3. 2
   4. sometrackindex
5. 
   1. Synth Pad
   2. 0
   3. 0
   4. sometrackindex
6. 
   1. Guitars
   2. 1
   3. 0
   4. ''
7. 
   1. Gtr 1
   2. 1
   3. 6
   4. ''
8.
   1. Gtr 1 L
   2. 0
   3. 7
   4. sometrackindex
9. 
   1. Gtr 1 R
   2. 0
   3. 7
   4. sometrackindex
and so on.

When I create a folder, I understand this can be done with InsertTrackAtIndex. The index will always be i+1, where i is previously addeed row (track or folder) of my structure table that I am travesring. I also know every time I use InsertTrack I need to increment my original track indices.

Following some folder, by nature of my table, I always know what its children are.

I am quite close to understanding what I need to do. Just need to better understand nuances of ReorderSelectedTracks

thanks!
bhuether is offline   Reply With Quote
Old 11-26-2020, 02:38 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

It's described in more detail in my ReaScript-docs:
https://mespotin.uber.space/Ultrasch...SelectedTracks
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-27-2020, 12:40 AM   #3
bhuether
Human being with feelings
 
Join Date: Nov 2016
Posts: 226
Default

Thanks, that is definitely clearer!

This has me wondering if with ReorderSelectedTracks if it is even possible to iterate over my table to create folders and subfolders on the fly, moving tracks, when I come across them in the table. I have impression that the only way to make this work is to create all top level folder tracks, then 2nd level folder tracks, then 3rd level. Then after that move tracks, specifying appropriate beforeidx.
bhuether is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.