|
|
|
08-08-2019, 05:24 AM
|
#1
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
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)
|
|
|
08-08-2019, 05:39 AM
|
#2
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
I can't get this to work either...
reaper.SelectProjectInstance( proj )
|
|
|
08-08-2019, 05:47 AM
|
#3
|
Human being with feelings
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
|
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.)
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
|
|
|
08-08-2019, 05:54 AM
|
#4
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
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
|
|
|
08-08-2019, 07:02 AM
|
#5
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
WHat if you call reaper.GetMediaSourceParent( src ) after the first src = ?
If src type is SECTION, it may not work.
|
|
|
08-08-2019, 08:11 AM
|
#6
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
That could be it actually
|
|
|
08-08-2019, 08:16 AM
|
#7
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
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)
|
|
|
08-08-2019, 08:42 AM
|
#8
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
|
|
|
08-08-2019, 08:43 AM
|
#9
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
Oh dear, 2017
|
|
|
08-08-2019, 08:44 AM
|
#10
|
Human being with feelings
Join Date: Nov 2014
Posts: 798
|
I don't suppose anyone had any luck with this one?
reaper.SelectProjectInstance( proj )
|
|
|
08-24-2019, 09:45 AM
|
#11
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
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):
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:37 AM.
|