|
|
|
04-06-2016, 07:07 AM
|
#1
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Simple gui template for Scripts
Ctrl+left drag - fine tune.
Mouswheel in element supported.
------
For link function to element use use onClick,onMove etc - add onMove etc in elm draw.
Link
Last edited by eugen2777; 05-24-2016 at 03:25 AM.
|
|
|
04-06-2016, 10:20 AM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
Beautiful thanks for sharing !
Maybe a bit more doc about the function parameter could be useful
|
|
|
04-06-2016, 11:05 AM
|
#3
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Any function can be assigned.
As values for the sliders and knobs should be used sldr.norm_val and knb.norm_val.
For very simple example - add string - to sldr.draw
Code:
if self:mouseDown() then a=a+0.2
self:set_norm_val()
if self.onMove then self:onMove() end --Add this string -!!!
end
its actual for all sliders - but each slider can have self functions
---------------------------------------------------------------------
----------------------------------------------------------------------
--Add this line anywhere after the definition
--Set slider values - x,y,w,h, etc -- !
local sldr1 = H_Slider:new(20,20,180,30, 0.7,0.3,0.3,0.5, "Slider1","Arial",17, 0.5 )
---Its very simple example!---------------
-- Add function for slider(sldr1) --
sldr1.onMove = function() Track = reaper.GetSelectedTrack(0,0)
if Track then reaper.SetMediaTrackInfo_Value( Track , "D_VOL", sldr1.norm_val ) end
end
Last edited by eugen2777; 04-06-2016 at 11:44 AM.
|
|
|
04-06-2016, 12:17 PM
|
#4
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Very tidy implementation! If you don't mind, can I borrow your knob code to add a knob to my GUI stuff?
|
|
|
04-06-2016, 12:25 PM
|
#5
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Sure, no problem.
|
|
|
04-06-2016, 02:42 PM
|
#6
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
@eugen2777
Another type of slider that you could consider is a range slider
This can be handy in some case where you want things to be between x and y
EDIT : also, toggle buttons could be interesting.
Just ideas !)
|
|
|
04-06-2016, 03:01 PM
|
#7
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Yes, this is a good option. I'll do it as soon as the time. In addition, there is an option with mouse configurable elements - change the size, position, add, delete. While it is not quite ready to use.
Some other features
Last edited by eugen2777; 04-06-2016 at 03:25 PM.
|
|
|
04-06-2016, 03:22 PM
|
#8
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
Thanks !
The Interface Creator with muse input is quite impressive !
Would it then be able to export it as code to create a script from it ? or does it commit the code right in the script ? In other words.. could be build script GUI just like that ?
|
|
|
04-06-2016, 03:33 PM
|
#9
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Yes. It's just part of the graphic.
Of course, it is not suitable for complex scripts.
But for simple scripts fit
|
|
|
04-06-2016, 03:42 PM
|
#10
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
This looks cool!
|
|
|
04-06-2016, 06:12 PM
|
#11
|
Banned
Join Date: Sep 2015
Posts: 1,650
|
Quote:
Originally Posted by eugen2777
Sure, no problem.
|
Thanks!
|
|
|
04-06-2016, 08:49 PM
|
#12
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
I'm a complete noob at lua, but I thought I would ask here of what the possibility would be be to create a listbox?
Thanks, Wyatt
|
|
|
04-17-2016, 08:44 AM
|
#13
|
Human being with feelings
Join Date: Nov 2015
Posts: 1,566
|
This looks great!
|
|
|
04-17-2016, 08:46 AM
|
#14
|
Human being with feelings
Join Date: Oct 2008
Posts: 1,598
|
This is great!!
|
|
|
04-17-2016, 10:17 AM
|
#15
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
|
|
|
04-17-2016, 11:15 AM
|
#16
|
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
|
Spectacular for amateur coders like me. Knocking out a simple no-gfx button panel would be much easier with a creator like this.
I hope you release that GUI creator in whatever form you can. The libraries are already great.
|
|
|
04-18-2016, 07:40 PM
|
#17
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
This is pretty rad.
|
|
|
04-19-2016, 01:34 AM
|
#18
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,581
|
Quote:
Originally Posted by WyattRice
I'm a complete noob at lua, but I thought I would ask here of what the possibility would be be to create a listbox?
Thanks, Wyatt
|
Do you mean radio-buttons or a dropdown menubox?
|
|
|
04-19-2016, 04:15 PM
|
#19
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
"Listbox" usually means the kind you get from gfx.showmenu.
However, both that and checkboxes/radio buttons would be pretty cool.
|
|
|
04-19-2016, 06:22 PM
|
#20
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
Quote:
Originally Posted by daxliniere
Do you mean radio-buttons or a dropdown menubox?
|
A listbox for an example, in Reaper would be like view track manager, or like sws marker list window.
It has columns and text fields.
The list holds items, you can change text, click on items, then do actions, etc for each item.
This would probably be difficult and time consuming to do in lua, I think?
|
|
|
04-20-2016, 01:32 AM
|
#21
|
Human being with feelings
Join Date: Nov 2008
Location: London, UK
Posts: 2,581
|
Quote:
Originally Posted by WyattRice
A listbox for an example, in Reaper would be like...sws marker list window.
|
Ahhhh, I know it well.
|
|
|
05-04-2016, 05:44 PM
|
#22
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
@Eugen2777
Feature request : ability to increment knobs and slider on mousewheel scroll button when the mouse is over the element
Also, what could be good is knob with steps
And finally, the knobs should be able to update a global value :P
Last edited by X-Raym; 05-05-2016 at 06:19 AM.
|
|
|
05-08-2016, 02:26 PM
|
#23
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
X-Raym,
updated,mousewheel is now supported.
============
For step-knob you can simply override the method for a specific knob.
And this will not affect all other knobs!
For example:
Code:
....
local knb3 = Knob:new(20,140,50,50, 0.7,0.7,0.3,0.4, "K3","Arial",14, 0.5 )
local knb4 = Knob:new(80,140,50,50, 0.3,0.7,0.7,0.4, "K4","Arial",14, 0.5 )
-- For knb4 Only !!! ------
function knb4:set_norm_val()
local x,y,w,h = self.x,self.y,self.w,self.h
local step = 0.25
local VAL = (h-(gfx.mouse_y-y))/h
if VAL<0 then VAL=0 elseif VAL>1 then VAL=1 end
self.norm_val = math.floor(VAL/step+0.5)*step
end
local Knob_TB = {knb1,knb2,knb3,knb4}
....
===========
===========
Quote:
the knobs should be able to update a global value
|
Values are available at any part of the code, for example, we can simply use the value knb4.norm_val
|
|
|
05-10-2016, 12:01 PM
|
#24
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
eugen2777,
I have a request if possible.
Would it be possible for you to add an editbox element to your template?
http://forum.cockos.com/showpost.php...&postcount=103
Many Thanks,
Wyatt
|
|
|
05-11-2016, 08:18 AM
|
#25
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
WyattRice,Sorry, soon I do not plan to do it, maybe in the future. You could use a script from Schwa. It's ready to use script.
|
|
|
05-11-2016, 09:01 AM
|
#26
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
@eugen
Thanks !
I am instensively using your btn library on a script I am coding, can't wait to show you :P
I mod it a bit to fit more my needs,
Here are some mods I made
- No auto update size function, size is deifnitely from the source scripts
- added optional ID, Function1, Funct2 and Tooltip as element property
- When btn is pressed, func1 is trigger with ID, 1 as parameter. If it is right click, it is ID, -1 which is return, which allows to set a different thing on right click acion.
- Funct2 is triggered at mouse hover
Anyway, this library is really cool and easy to implement in a script.
I don't understand all of its core, it quite advanced, but it is very good.
|
|
|
05-11-2016, 09:28 AM
|
#27
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
I can do it, it is not difficult, but it's still a simple template... Minimum. Gui functions should not clutter up the code.
The main(no gui) part should be separate.
By the way, as I have a bit of time doing a range slider and a toggle button
For "No auto update size" - to do this, simply comment out the line
Code:
--[[
Z_w, Z_h = gfx.w/Wnd_W, gfx.h/Wnd_H
if Z_w<0.6 then Z_w = 0.6 elseif Z_w>2 then Z_w = 2 end
if Z_h<0.6 then Z_h = 0.6 elseif Z_h>2 then Z_h = 2 end
--]]
Last edited by eugen2777; 05-11-2016 at 10:11 AM.
|
|
|
05-11-2016, 10:05 AM
|
#28
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
@eugen2777
Very COOL !
I'll stay with my custom mod for the script I am coding as it works as expected for me
but I am sure your next class you will be very great !!
Indeed, separating what is GUI and what is the first thing I considered for starting moding :P
|
|
|
05-11-2016, 11:22 AM
|
#29
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Range Slider added.
|
|
|
05-11-2016, 11:13 PM
|
#30
|
Human being with feelings
Join Date: Mar 2013
Posts: 515
|
Man this is huge!!!! Very cool!
Have to check it out as soon as I have more time. Kudos eugen!
__________________
"After silence, that which comes nearest to expressing the inexpressible is music", Aldous Huxley
|
|
|
05-12-2016, 04:19 AM
|
#31
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Curse you for making a range slider before I could get around to it. CURSE YOU I SAY!!!
|
|
|
05-12-2016, 05:44 AM
|
#32
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
Thanks for it !!
|
|
|
05-13-2016, 10:07 AM
|
#33
|
Human being with feelings
Join Date: Jan 2013
Location: Kiev, Ukraine
Posts: 66
|
Thanks Eugen
|
|
|
05-13-2016, 12:46 PM
|
#34
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Well, I would add step-sliders and step-knobs.
Maybe range-knobs.
|
|
|
05-13-2016, 02:41 PM
|
#35
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
In the GUI template I'm working on I just included a "steps" parameter for sliders and knobs, and then as you drag it the element snaps to that number of values. For a pan knob you just specify 200 steps- it works really well.
|
|
|
05-13-2016, 03:58 PM
|
#36
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
Steps would be very cool indeed !
|
|
|
05-14-2016, 07:42 AM
|
#37
|
Human being with feelings
Join Date: Jan 2013
Location: Kiev, Ukraine
Posts: 66
|
It would be cool to make a checkbox
|
|
|
05-16-2016, 10:47 AM
|
#38
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
Simple checkbox added.
Probably need to change the appearance of the elements( sliders,buttons, etc). Now they look really ugly.
Last edited by eugen2777; 05-16-2016 at 10:59 AM.
|
|
|
05-25-2016, 04:49 PM
|
#39
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,876
|
@eugen2777
Is this normal ? or did I ake a mistake ? ^^
|
|
|
05-25-2016, 05:35 PM
|
#40
|
Human being with feelings
Join Date: Aug 2012
Posts: 271
|
This is normal. You can use the local table = {} etc, for example, to hide its.
Look metatable and metamethods
Last edited by eugen2777; 05-25-2016 at 05:40 PM.
|
|
|
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 06:06 PM.
|