Quote:
Originally Posted by tompad
Let see if I got this right - If I export a GUI-file in GUI-Builder, I can load
that file with loadfile in the beginning of the main script file and if I want one
of the.... let say a button in GUI-file have a function hooked to it I just
override with GUI.New("myButton", "Button", func = nameOfFunc)?
So the w,h,x,y,etc of button is taken from GUI-file and nameOfFunc is added to that button?
|
Almost.
- You'll probably want to load Lokasenna_GUI itself in the main script so you can use helpers like
GUI.Msg.
- You'll probably want to move the
GUI.Init and
GUI.Main statements from the end of the UI file into your main script as well so that it can be charge of when the GUI starts up.
- If you just don't assign a
func to the button in your GUI file, any time after the main script has loaded it you can set it with
GUI.elms.my_button.func = some_function_in_this_script
Here's a quick example that should get the idea across:
https://dl.dropboxusercontent.com/s/...gui%20test.zip
There are different ways to do it, such as setting up the GUI script as a function that you pass the click handler into when you call it, but that's really just a tidiness/organization thing.
Quote:
Is it advisebly to put a call to a function with reaper.CountTracks() and reaper.ReorderSelected() and some more in Main loop? I have something that I might wanna run in the background, but if its not ok I could do a regular script called by user.
|
You certainly can, as long as you aren't abusing the user's CPU. If there's a particular condition you can check for, like "has the number of tracks changed?", then that's easy enough to run on every loop. You can also use
reaper.time_precise() or just a simple loop counter to reduce how often your checking + doing stuff happens.