Old 10-22-2019, 08:26 AM   #1
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 522
Default Weird select track functions problem

Whenever i try to use SetTrackSelected os SetOnlyTrackSelected i see the track being selected for some ms, then it goes unselected again. This function is the last line on the script so nothing else happens afterwards that deselects it.

Any idea?

EDIT: Just t be cleat, i see i got correct track index and userdata values, and I can change the name on the track, etc.

Last edited by reapero; 10-22-2019 at 08:35 AM.
reapero is offline   Reply With Quote
Old 10-22-2019, 08:28 AM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Post the code, just in case there's a bug.
- Do you have any scripts running in the background that might be affecting the track selection? (all running scripts are shown at the bottom of the action list)
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-22-2019, 08:43 AM   #3
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 522
Default

I have your script Lokasenna_Track_selection_follows_selection

Can this be the culprit?

Code:
num_selected_items =reaper.CountSelectedMediaItems(0)

for i=0, num_selected_items do
  source_item = reaper.GetSelectedMediaItem(0,i)
  table.insert(items,source_item)
  
end

for i=1, num_selected_items do
reaper.SetMediaItemInfo_Value(items[i], "B_UISEL", 0)
end


track_with_items= reaper.GetMediaItem_Track( items[1] )
track_with_items_index = reaper.GetMediaTrackInfo_Value( track_with_items, "IP_TRACKNUMBER" )

num_tracks =  reaper.GetNumTracks()
reaper.InsertTrackAtIndex( num_tracks, false )
reaper.SetOnlyTrackSelected( track_with_items )
reapero is offline   Reply With Quote
Old 10-22-2019, 09:07 AM   #4
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

My script is doing that, 100%. It checks for changes to the project state and then does its thing, so it would naturally react to your script changing stuff.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-22-2019, 09:34 AM   #5
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 522
Default

Crap..any workaround?
reapero is offline   Reply With Quote
Old 10-22-2019, 10:25 AM   #6
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

You could:
- Have your script check if mine is running and kill it. I think this would require a mod to my script, but it's possible in theory.
- Not try to select a track while you have a script running that manages the track selection for you. :P
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-22-2019, 12:44 PM   #7
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 522
Default

Hom.. i want to copy and paste items to different tracks. I planned to do that by copying, selecting the track, then pasting.

Maybe there's a way to do that without messing with selection?

I'll investigate killing scripts from a script hoping you dont need to modify anything on your script.

Btw this auto select track when selecting items..isn't there a Reaper preference to do this natively? I was shocked at the time I started using your script, since the option is there in quite other sequences.
reapero is offline   Reply With Quote
Old 10-22-2019, 01:03 PM   #8
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by reapero View Post
Hom.. i want to copy and paste items to different tracks. I planned to do that by copying, selecting the track, then pasting.
You can use reaper.Main_OnCommand([command id here], 0) to run commands from the action list, so if your script also did the copying and pasting it wouldn't run into any trouble with mine.

Quote:
isn't there a Reaper preference to do this natively? I was shocked at the time I started using your script, since the option is there in quite other sequences.
Apparently there is Preferences/Editing Behaviour/Mouse/Mouse click/edit in track view changes track selection, but I have no idea if it behaves the same as mine for things like selecting multiple items.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna 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:43 AM.


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