Old 08-08-2019, 05:24 AM   #1
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default reaper.GetSubProjectFromSource returns nil

I'm trying to get the subproject name from an item, but it seems to only ever return nil. Is it broken?



Code:
  item =  reaper.GetSelectedMediaItem( 0, 0 )
  take =  reaper.GetActiveTake( item )
  src =   reaper.GetMediaItemTake_Source( take )
  subproject = reaper.GetSubProjectFromSource( src )
  msg(subproject)
Travesty is offline   Reply With Quote
Old 08-08-2019, 05:39 AM   #2
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

I can't get this to work either...


reaper.SelectProjectInstance( proj )
Travesty is offline   Reply With Quote
Old 08-08-2019, 05:47 AM   #3
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,929
Default

GetSubProjectFromSource seems to be returning nil, at least with Lua ReaScript, so it's either buggy or it needs to be used in some non-obvious way.

Functions taking in a ReaProject are not going to work if the ReaProject is nil or the functions end up using the currently active project tab.

GetMediaSourceFileName(src, "") does return the file name of the .rpp file, though. (Not sure if that's useful for you.)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 08-08-2019, 05:54 AM   #4
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

Yeah I got the project through EnumProjects and tried that in SelectProjectInstance, but that did nothing either. They both seem to be broken.


I'm trying to close a subproject tab after it's been opened, but after getting hold of the project and filename of the open tab, I can't actually find a function to close a project.

The best I have at the moment is SWS: Switch to last project tab, then close current tab. But I don't trust native actions as the script won't always wait for them to complete
Travesty is offline   Reply With Quote
Old 08-08-2019, 07:02 AM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,041
Default

WHat if you call reaper.GetMediaSourceParent( src ) after the first src = ?


If src type is SECTION, it may not work.
X-Raym is offline   Reply With Quote
Old 08-08-2019, 08:11 AM   #6
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

That could be it actually
Travesty is offline   Reply With Quote
Old 08-08-2019, 08:16 AM   #7
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

No, still always returns nil

Code:
item =  reaper.GetSelectedMediaItem( 0, 0)
take =  reaper.GetMediaItemTake( item, 0 )
src =  reaper.GetMediaItemTake_Source( take )
src = reaper.GetMediaSourceParent( src ) 

proj = reaper.GetSubProjectFromSource( src )

msg(proj)
Travesty is offline   Reply With Quote
Old 08-08-2019, 08:42 AM   #8
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,530
Default

https://forums.cockos.com/showthread.php?t=195460
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 08-08-2019, 08:43 AM   #9
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

Oh dear, 2017
Travesty is offline   Reply With Quote
Old 08-08-2019, 08:44 AM   #10
Travesty
Human being with feelings
 
Travesty's Avatar
 
Join Date: Nov 2014
Posts: 506
Default

I don't suppose anyone had any luck with this one?

reaper.SelectProjectInstance( proj )
Travesty is offline   Reply With Quote
Old 08-24-2019, 09:45 AM   #11
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,530
Default

This was fixed in some of latest builds, at least if project tab is opened, it is possible to give project pointer to regular API for stuff like that (the script is pretty rough actually, but it somehow works for simple stuff like drums):

__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl 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 04:01 AM.


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