Old 09-09-2018, 01:38 AM   #1
Dupal
Human being with feelings
 
Dupal's Avatar
 
Join Date: Oct 2014
Location: Schweiz
Posts: 16
Default Working with subprojects in lua-script

I discovered a strong dependency between generating and accessing subprojects and two options related to rendering subprojects - details are described here:
https://forum.cockos.com/showthread....ght=subproject

I.e. the two options 42334 and 42333 need to be switched off in order for the handling of the subprojects to work properly. To round up this topic, following the piece of code I use in one of my scripts:

--------------------------------------------------------
--Switch off
-- - prompt for rendering
-- - no automated rendering
--Remember current status
--------------------------------------------------------
if reaper.GetToggleCommandState(42334) == 1 then
B_PromtForRend = true
reaper.Main_OnCommand(42334, 0)
reaper.RefreshToolbar2(0, 42334)
end

if reaper.GetToggleCommandState(42333) == 1 then
B_NoAutoRend = true
reaper.Main_OnCommand(42333, 0)
reaper.RefreshToolbar2(0, 42333)
end

The order at which the options are set is crucial due to the dependency that exists between the two. Please also note that, if those options are part of a toolbar, the refresh function needs to be called in order for the icon to indicate the status correctly.

At the end of the script, the settings are put back to their original state:

if B_NoAutoRend == true then
reaper.Main_OnCommand(42333, 0)
reaper.RefreshToolbar2(0, 42333)
end

if B_PromtForRend == true then
reaper.Main_OnCommand(42334, 0)
reaper.RefreshToolbar2(0, 42334)
end

Last edited by Dupal; 09-10-2018 at 08:16 AM.
Dupal is offline   Reply With Quote
Old 09-11-2018, 10:56 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

I honestly have no idea, what you are trying to say... O_O

Edit: to clarify my confusion, I see that calling the actions in a certain order seems to be important, but for which use-case is completely unclear to me...

Last edited by Meo-Ada Mespotine; 09-11-2018 at 11:02 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 09-11-2018, 11:37 PM   #3
Dupal
Human being with feelings
 
Dupal's Avatar
 
Join Date: Oct 2014
Location: Schweiz
Posts: 16
Default

Quote:
Originally Posted by mespotine View Post
I honestly have no idea, what you are trying to say... O_O

Edit: to clarify my confusion, I see that calling the actions in a certain order seems to be important, but for which use-case is completely unclear to me...

I have to admit that I am a novice - in terms of lua, programming in general and also using a forum like this one here.

The use case is quite simply about automatically generating subprojects from particular tracks with the help of a lua script. I ran into the described problems and it and took me quite while to figure out how to circumvent them, which is why I thought I share it here.
Dupal 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 11:14 AM.


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