|
|
|
06-04-2018, 01:43 PM
|
#161
|
Human being with feelings
Join Date: Nov 2015
Posts: 137
|
oh man thank you so much.. I have been asking for this for a long time.
I wish I could figure out how to do this stuff..
every time you guys come out with scripts that I have crazy crazy custom cycle action for I have to re do my templates..
looks like im redoing my template again tonight.
thanks
sorry where is the proper location to enter the "track name" in the code?
Last edited by Frank B; 06-04-2018 at 01:53 PM.
|
|
|
06-04-2018, 02:45 PM
|
#162
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Full code, will take either a number or a name:
Code:
local dest_val = "track name here"
local function Main()
local num_tracks = reaper.CountSelectedTracks(0)
if num_tracks == 0 then return end
local dest
-- Track number?
if tonumber(dest_val) then
dest = reaper.GetTrack(0, tonumber(dest_val) - 1)
-- Track name?
elseif tostring(dest_val) then
for i = 0, reaper.GetNumTracks() - 1 do
local track = reaper.GetTrack(0, i)
local ret, name = reaper.GetTrackName(track, "")
if ret and name == tostring(dest_val) then
dest = track
end
end
end
if not dest then return end
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)
-- For each selected track
local sel = {}
for i = 0, num_tracks - 1 do
local sel = reaper.GetSelectedTrack(0, i)
-- Create a default send
--reaper.CreateTrackSend( tr, desttrInOptional )
reaper.CreateTrackSend(sel, dest)
end
reaper.PreventUIRefresh(-1)
reaper.UpdateTimeline()
reaper.Undo_EndBlock("Create send from selected tracks", -1)
end
Main()
|
|
|
06-04-2018, 04:05 PM
|
#163
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Quote:
Originally Posted by RobU
I'll have a play around with something simple and see how I get on. If I get stuck I'll give you a shout thanks for the info.
R
|
Since you got me thinking, I've just pushed an update that adds onresize to the element methods. If you wanted to be CPU-friendly, you could theoretically blit+stretch the existing copy until the GUI stops being resized (would have to check that yourself), and only THEN reinit and redraw the element at the new scale.
|
|
|
06-05-2018, 04:34 PM
|
#164
|
Human being with feelings
Join Date: Nov 2015
Posts: 137
|
sorry but I am not certain how to get it to work. I inserted the name of the track "stereosbus" where I believe you meant. ??? com+s to save.. but running it does nothing.
am I missing something?
local dest_val = "stereobus"
local function Main()
local num_tracks = reaper.CountSelectedTracks(0)
if num_tracks == 0 then return end
local dest
-- Track number?
if tonumber(dest_val) then
dest = reaper.GetTrack(0, tonumber(dest_val) - 1)
-- Track name?
elseif tostring(dest_val) then
for i = 0, reaper.GetNumTracks() - 1 do
local track = reaper.GetTrack(0, i)
local ret, name = reaper.GetTrackName(track, "")
if ret and name == tostring(dest_val) then
dest = track
end
end
end
if not dest then return end
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)
-- For each selected track
local sel = {}
for i = 0, num_tracks - 1 do
local sel = reaper.GetSelectedTrack(0, i)
-- Create a default send
--reaper.CreateTrackSend( tr, desttrInOptional )
reaper.CreateTrackSend(sel, dest)
end
reaper.PreventUIRefresh(-1)
reaper.UpdateTimeline()
reaper.Undo_EndBlock("Create send from selected tracks", -1)
end
|
|
|
06-05-2018, 04:40 PM
|
#165
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
You missed one line - that code defines the function Main, but this runs it. Just add it at the end:
|
|
|
06-06-2018, 03:37 PM
|
#166
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Update - Elements can now be created from tables rather than as a series of function arguments, and multiple elements can be created that way using a new function, GUI.CreateElms. There's a new example script demonstrating this, and updated documentation on the Wiki.
|
|
|
06-09-2018, 05:06 AM
|
#167
|
Human being with feelings
Join Date: Nov 2015
Posts: 137
|
Thanks I got it to work now..
its case sensitive so the name has to be correctly capitalized.
when you type the name in it won't allow the capitalize function, so you have to copy/paste the name in place...
Works great now... thanks again
|
|
|
06-09-2018, 06:02 AM
|
#168
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Just for fun, here's how to remove case sensitivity. Replace this line:
Code:
if ret and name == tostring(dest_val) then
with
Code:
if ret and string.lower(name) == string.lower( tostring(dest_val) ) then
|
|
|
06-18-2018, 01:25 PM
|
#169
|
Human being with feelings
Join Date: Nov 2015
Posts: 137
|
I see you added a few more "create send" scripts.
nice thanks
|
|
|
06-26-2018, 11:03 PM
|
#170
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
FR - set active element in listbox
Hey Loka, thanks for awesome GUI, I'm having fun!
I currently have the problem that I can't set/choose active element in the listbox.
So on startup no element is selected before user clicks an element.
Also when loading a new string table into the listbox (updating it) all elements appear selected (highlighted), even if the listbox is set to only use one active element.
|
|
|
06-27-2018, 05:04 AM
|
#171
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
The first should be doable using GUI.Val("my_list", index), but I'll have a look.
The second shouldn't be happening, will also have a look.
|
|
|
06-27-2018, 05:14 AM
|
#172
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Big news! A stable release! On ReaPack! So you don't have to distribute/compile the library yourself! That I won't fuck around with anymore! Yay! Ooh! Aah!
I've uploaded two new packages to ReaPack:
1. Lokasenna's GUI library v2 for Lua will install just the library. It comes with an installation script that users must run* which stores the library's path as an ExtState, allowing other scripts to access it.
2. Lokasenna's GUI library v2 for Lua (developer tools) contains the examples, templates, and an HTML version of the project wiki. All of the examples (I think) have been updated to look for the install script's ExtState, so have a look at them for usage instructions.
From this point forward, the ReaPack release will only be updated for bugfixes - no feature updates or new classes unless I really feel that they're necessary. v3 is being worked on, and will (someday, theoretically) be released as a separate package.
* Should end up at ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/Set Lokasenna_GUI v2 library path.lua
|
|
|
06-27-2018, 05:17 PM
|
#173
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Never mind, I see the issue - the documentation is wrong. Listbox's :val method returns a table of the selected options, and accepts new boolean values to be selected/not selected.
If you want to modify the list you can set GUI.elms.my_list.list = {"Item A", "Item B", "Item C", "Item D"} or = "Item A,Item B,Item C,Item D" - if you give it a string, you'll have to call :init afterward to have it read into the table.
You'll also probably want to update/reset the selected values at the same time. I *think* GUI.Val("my_list", {}) will clear the selection, not sure though.
|
|
|
06-27-2018, 05:41 PM
|
#174
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,900
|
really nice to have it on reateam repo in a reapack friendly way !
what the point if the install script ? I mean, why path need to be stored as Exstate ? arent path just relative to the main file ?
|
|
|
06-27-2018, 05:43 PM
|
#175
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
So that other scripts can just grab the ExtState and never have to care about exactly where it is; if someone installs the library by hand it won't end up in the standard ReaTeam folder.
|
|
|
06-28-2018, 01:58 PM
|
#176
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
Quote:
Originally Posted by Lokasenna
Never mind, I see the issue - the documentation is wrong. Listbox's :val method returns a table of the selected options, and accepts new boolean values to be selected/not selected.
If you want to modify the list you can set GUI.elms.my_list.list = {"Item A", "Item B", "Item C", "Item D"} or = "Item A,Item B,Item C,Item D" - if you give it a string, you'll have to call :init afterward to have it read into the table.
You'll also probably want to update/reset the selected values at the same time. I *think* GUI.Val("my_list", {}) will clear the selection, not sure though.
|
Got it working thank you so much!
|
|
|
07-01-2018, 11:48 PM
|
#177
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
I'm looking to make a Lua GUI that would run outside of Reaper, looking at https://sourceforge.net/projects/ceres-compiler/
to compile it to an exe.
Would this be possible with this GUI or Radial Menu ?
|
|
|
07-02-2018, 06:18 AM
|
#178
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Nope - it uses Reaper's drawing functions for everything. You'd have to find a reasonably-similar library for drawing stuff and adapt it line-by-line, but there are plenty of existing GUI libraries for Lua (wxLua is a good one) so that would really be a waste of your time.
|
|
|
07-02-2018, 01:20 PM
|
#179
|
Human being with feelings
Join Date: Sep 2009
Posts: 863
|
Quote:
Originally Posted by MusoBob
|
If you do have have the itch to write a GUI (and, as already noted, waste a bunch of time), ZeroBrane Studio is a Lua editor and debugger that comes with a few gfx libraries to work with (Love, Corona, and more).
The debugger is awesome and sorely missed when coding for Reaper.
|
|
|
07-03-2018, 11:40 AM
|
#180
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
Is there a method or boolean for when not onmouseover() ?
I'm trying to change the cursor only when hovering over a custom class element,
it is easy to change the cursor on hover, but I can't figure out a way to change it back to default whenever the cursor is not hovering over an element - is there a way to do it?
I tried,
function GUI.Block nmouseover()
gfx.setcursor(1, 'ruler_scroll')
self:redraw()
end
But then it redraws the default cursor immediately, so is there a boolean to use or something?
function GUI.Block:draw()
local x, y, w, h = self.x, self.y, self.w, self.h
-- Copy the pre-drawn bits
gfx.blit(self.buff, 1, 0, 0, 0, w, h, x, y)
-- Draw text, or whatever you want, here
GUI.color(self.col_fill)
gfx.rect(self.x, self.y, w, h, 1)
gfx.setcursor(1, 'arrow')
end
|
|
|
07-03-2018, 02:10 PM
|
#181
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I believe gfx.setcursor is reset by Reaper on each loop of a defer script; not aware of any way around that.
Depending on what you need to communicate, however, you can use tooltips. Set GUI.elms.Block1.tooltip = "This is Block1!" and it will pop up if you hover the mouse over the elment. If the delay is too long, set GUI.tooltip_time smaller - it defaults to 0.8s.
Edit: I just realized that the tooltip stuff isn't documented. Will add that later.
|
|
|
07-04-2018, 02:38 AM
|
#182
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
Quote:
Originally Posted by Lokasenna
I believe gfx.setcursor is reset by Reaper on each loop of a defer script; not aware of any way around that.
Depending on what you need to communicate, however, you can use tooltips. Set GUI.elms.Block1.tooltip = "This is Block1!" and it will pop up if you hover the mouse over the elment. If the delay is too long, set GUI.tooltip_time smaller - it defaults to 0.8s.
Edit: I just realized that the tooltip stuff isn't documented. Will add that later.
|
I got it partly working but some things seem a bit funky.
When I hover the cursor changes and remains changed, but I cannot get it to change back (when not hovering anymore), I guess I could try and create a new function in the core file for when mouse stops hovering over an element ?
There were some booleans outcommented I believe..
Another issue, just to try it out I made it so that the cursor changes on :mousedown ,
but strangely enough as long as the button is held it does not change - only when mouse button is released does the gfx.setcursor update?
It is strange as I can get other graphic updates such as changing color of the element on :mousedown without problems.
But thank you for looking into it, it would be awesome functionality to customize the cursor.
I will try out working with tooltips. Thanks!
|
|
|
07-04-2018, 02:47 AM
|
#183
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
Ok, the setcursor function is messed up,
I guess we just have to wait for the developers to improve it.
Sometimes setcursor loads the graphics of a cursor fine, sometimes it does not and there is no cursor.
|
|
|
07-04-2018, 03:01 AM
|
#184
|
Human being with feelings
Join Date: Oct 2016
Posts: 39
|
Yep it works now! As you would surely know
I just made an extra function nmouseoverend, called when not hovering. (where you had left a comment in the code..)
I suppose since it is then called practically all the time that there would be a smarter way of doing things but I'm happy
|
|
|
07-04-2018, 07:01 AM
|
#185
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I haven't tried, but I think the easiest way around it would be to have a Frame element the same size as the window, behind all of the other elements, and with its :draw method rewritten so it stays invisible.
Then you can set its mouseover method to reset the cursor.
I'll look at adding a "stopped mousing over the current mouseover element" hook though.
|
|
|
07-04-2018, 06:14 PM
|
#186
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
First, this is super cool. I've tried copying in a few classes to a few personal scripts and it works great.
However, when I try to reference the classes using the Developer folder in the ReaTeam scripts I run into errors.
Namely:
Code:
Error
Couldn't load path...\Library/Modules/Error.lua
Error: cannot open path...\Library/Modules/Error.lua: No such file or directory.
I can see the file/directory being referenced, so I know the files in question are there.
A few things to note;
- I have run the Set Lokasenna_GUI v2 library path.lua file
- I have updated the ReaPack version of your GUI tool, but the most recent version that it updates to is 2.9
Any thoughts or suggestions on how to troubleshoot?
|
|
|
07-04-2018, 07:16 PM
|
#187
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
How are you accessing the classes?
The example scripts in /Developer Tools/ work here, using this to call their element classes:
Code:
local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
if not lib_path or lib_path == "" then
reaper.MB("Couldn't load the Lokasenna_GUI library. Please run 'Set Lokasenna_GUI v2 library path.lua' in the Lokasenna_GUI folder.", "Whoops!", 0)
return
end
loadfile(lib_path .. "Core.lua")()
GUI.req("Classes/Class - Slider.lua")()
|
|
|
07-04-2018, 07:18 PM
|
#188
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Wait, never mind. From the code you listed I think you're using the current Github version which... is definitely broken. I'm in the middle of reorganizing it and probably shouldn't have uploaded it.
The v2 release on ReaTeam IS stable and shouldn't give you any trouble.
|
|
|
07-05-2018, 04:49 AM
|
#189
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
ah, ok. I probably did have the git hub version.
Now I have a new error:
-I cleared out all the Lokasenna GUI Development folders
-Re-synced from ReaTeam
-Cleared out the Lokaseena entry in the reaper-extstate file
-Ran the Set Lokasenna_GUI v2 library path.lua script
-Opened and tried to compile blank GUI template
-Got this error
Code:
Whoops!
Couldn't load the Lokasenna_GUI library. Please run 'Set Lokasenna_GUI v3 library path.lua' in the Lokasenna_GUI folder.
I don't see a version 3; only version 2.
|
|
|
07-05-2018, 08:05 AM
|
#190
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Oops - the template is looking for v3 instead of v2. You can change the two "v3" references at the top of the template file to fix it.
I'm uploading a fix right now.
|
|
|
07-05-2018, 09:16 PM
|
#191
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Thanks, but now a new error:
This fails due to a null value
Code:
loadfile(lib_path .. "Lokasenna_GUI.lua")()
Not sure the Lokaseena_Gui.lua file is in there.
|
|
|
07-06-2018, 03:19 AM
|
#192
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
God I'm an idiot. Uploading a new version, I swear it works on my end this time.
|
|
|
07-06-2018, 06:15 AM
|
#193
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
lol - all good. I really appreciate your help.
|
|
|
07-06-2018, 02:28 PM
|
#194
|
Human being with feelings
Join Date: Jan 2009
Posts: 1,030
|
Got it working. Thanks!
|
|
|
07-07-2018, 02:27 PM
|
#195
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
@Lokasenna:
I'm using Solger's ReaLauncher script. Is it normal, that the performance of the GUI is better on OSX than on Windows? When I move the window around, the GUI feels sluggish in Windows. In OSX it behaves completely normal.
|
|
|
07-07-2018, 03:05 PM
|
#196
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
I don't know why OSX would be better, but the current version of his script is redrawing everything on every loop - that's why there's sluggishness. I modded my copy with a quick fix and it cleared right up (broke a couple of his other functions though).
|
|
|
07-07-2018, 03:09 PM
|
#197
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Hm strange, on my MacBook 2011 the GUI is completely responsive but on my
i7 6900 4GHz it's sluggish. I begin to think that the resolution of my Ultra Wide monitor causes these issues.
|
|
|
07-07-2018, 03:55 PM
|
#198
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
If anything I'd suspect differences in how Windows and Mac handle drawing - all of the GUI code is handled internally by Reaper, so screen resolution or DPI or whatever shouldn't be a factor.
It wouldn't be the only example of Windows lagging - if a script tries to print a lot of console messages, really fast, my Reaper will freeze up completely while it tries to keep updating. From what I've been told, Mac slows down a bit but not to that extent.
|
|
|
07-07-2018, 08:47 PM
|
#199
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Update to 2.10.0.
The install script is (well, should be) automatically registered in the Action List, so end users don't have to go hunting through their script folders for it. The error message given by the examples and the script template have been updated to reflect the change.
|
|
|
07-08-2018, 05:08 AM
|
#200
|
Human being with feelings
Join Date: Nov 2015
Posts: 137
|
I noticed you have included some "create send" scripts using pre-fader..
Can I splice them together some how with the one you gave me above?
So it will select the named track and create a pre-fader send instead.
Also does REAPER have the scripting ability to change them to mono sends as well?
Here is the script:
local dest_val = "track name here"
local function Main()
local num_tracks = reaper.CountSelectedTracks(0)
if num_tracks == 0 then return end
local dest
-- Track number?
if tonumber(dest_val) then
dest = reaper.GetTrack(0, tonumber(dest_val) - 1)
-- Track name?
elseif tostring(dest_val) then
for i = 0, reaper.GetNumTracks() - 1 do
local track = reaper.GetTrack(0, i)
local ret, name = reaper.GetTrackName(track, "")
if ret and name == tostring(dest_val) then
dest = track
end
end
end
if not dest then return end
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)
-- For each selected track
local sel = {}
for i = 0, num_tracks - 1 do
local sel = reaper.GetSelectedTrack(0, i)
-- Create a default send
--reaper.CreateTrackSend( tr, desttrInOptional )
reaper.CreateTrackSend(sel, dest)
end
reaper.PreventUIRefresh(-1)
reaper.UpdateTimeline()
reaper.Undo_EndBlock("Create send from selected tracks", -1)
end
Main()
|
|
|
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 08:00 PM.
|