|
|
|
08-03-2019, 10:37 AM
|
#1
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
v5.981+dev0803 - August 3 2019
v5.981+dev0803 - August 3 2019
- + Ruler: support more display combinations (Measures,Beats / H:M:S:F, etc)
- # API: add GetEnvelopeInfo_Value()
- # API: add I_TCPH/I_TCPY read-only track attributes
- # GetUserInput() centering fix
- # envcp: fix drawing of envcps whose tcps are offscreen
- # midi editor: obey window positioning pref for humanize/quantize/display quantize/note properties/filter/transpose
- # mixer: fix FX dragging
- # mixer: fix master context menu
This thread is for pre-release features discussion. Use the Feature Requests forum for other requests.
Changelog - Pre-Releases
Generated by X-Raym's REAPER ChangeLog to BBCode
|
|
|
08-03-2019, 10:39 AM
|
#2
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
lets begin the recoding!
EDIT:
Does GetTrackFromPoint include envelopes? If not then I still cannot do anything (since I'm looking at track/envelope under mouse cursor)
Last edited by Sexan; 08-03-2019 at 11:01 AM.
|
|
|
08-03-2019, 11:07 AM
|
#3
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by Sexan
lets begin the recoding!
EDIT:
Does GetTrackFromPoint include envelopes? If not then I still cannot do anything (since I'm looking at track/envelope under mouse cursor)
|
Yes, GetTrackFromPoint() sets the info parameter if the point is within an envelope lane (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).
Last edited by Justin; 08-03-2019 at 11:24 AM.
|
|
|
08-03-2019, 11:10 AM
|
#4
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Quote:
Originally Posted by Justin
Yes, and it sets the info thingy if it's an env lane that contains the point (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).
|
You referring to the new API above or there is some new API also in the previous versions (sorry was off some time not much up to date)?
|
|
|
08-03-2019, 11:23 AM
|
#5
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by Sexan
You referring to the new API above or there is some new API also in the previous versions (sorry was off some time not much up to date)?
|
editing my original post for clarity -- GetTrackFromPoint() has not changed, the new API added lets you enumerate the position of the env lanes.
|
|
|
08-03-2019, 12:01 PM
|
#6
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
I'm sure I forgot something really stupid here:
Store all tracks
Code:
function GetTracksXYH()
TBH = {}
for i = 1 , reaper.CountTracks(0) do
local tr = reaper.GetTrack(0, i-1)
local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
local tr_t = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
local tr_b = tr_t + tr_h
for j = 1 , reaper.CountTrackEnvelopes(tr) do
local env = reaper.GetTrackEnvelope(tr, j-1)
local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY")
local env_b = env_t + env_h
TBH[env] = {t = env_t, b = env_b, h = env_h}
end
TBH[tr] = {t = tr_t, b = tr_b, h = tr_h}
end
end
Retrieve from mouse
Code:
local function GetTracksFromMouse(x, y)
retval, info = reaper.GetTrackFromPoint(x, y)
if retval and info == 0 then
return retval, TBH[retval].t, TBH[retval].b, TBH[retval].h
elseif retval and info == 1 then
for i = 1 , reaper.CountTrackEnvelopes(retval) do
local env = reaper.GetTrackEnvelope(retval, i-1)
if TBH[env].t < y and TBH[env].b > y then
return env, TBH[env].t, TBH[env].b, TBH[env].h
end
end
end
end
It very wonky, does not get every envelope,skips some, finds few in same lane.
Must be something stupid did or forgot ?
|
|
|
08-03-2019, 01:02 PM
|
#7
|
Human being with feelings
Join Date: Nov 2017
Posts: 56
|
Check!!!!!!!
Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
|
|
|
08-03-2019, 01:47 PM
|
#8
|
Human being with feelings
Join Date: Dec 2011
Posts: 506
|
Thanks for the additions to the API, they are very helpful!
Any chance at getting SetEnvelopeInfo_Value() as well? Setting envelope height through the state chunk performs way too slowly for my purposes. Unless there is some other way I'm not aware of?
This is how I was doing it, maybe this isn't optimal though:
Code:
reaper.SetEnvelopeStateChunk(envelope, envelopeState:gsub("LANEHEIGHT %d+", "LANEHEIGHT " .. tostring(newHeight)), false)
|
|
|
08-03-2019, 02:39 PM
|
#9
|
Human being with feelings
Join Date: Dec 2017
Posts: 302
|
Quote:
Originally Posted by MaestroS
Check!!!!!!!
Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
|
Many of SWS function broken now, but it's worth it!
|
|
|
08-03-2019, 02:57 PM
|
#10
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Minor bug
With no tracks, show master track, then hide master track, it leaves track background...
Windows 10(1903) x64
|
|
|
08-03-2019, 03:32 PM
|
#11
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Ok, so in envelope case arrange view Y start needs to be accounted, but on tracks not....
Code:
local function GetTracksFromMouse(y, area)
retval, info = reaper.GetTrackFromPoint( mouse.x, y )
if retval and info == 0 then
return retval, TBH[retval].t, TBH[retval].b, TBH[retval].h
elseif retval and info == 1 then
--------------------------------------------
local _, x_view_start, y_view_start, x_view_end, y_view_end = reaper.JS_Window_GetRect(track_window)
y = y - y_view_start -- <-------- THIS NEEDS TO BE ADDED OR IT DOES NOT WORK
---------------------------------------------
for i = 1 , reaper.CountTrackEnvelopes(retval) do
local env = reaper.GetTrackEnvelope(retval, i-1)
if TBH[env].t <= y and TBH[env].b > y then
msg(env)
return env, TBH[env].t, TBH[env].b, TBH[env].h
end
end
end
end
Edit: Did not read the API well... envelopes are relative like Justin pointed out
EDIT2: Yeah this is needed for now
Last edited by Sexan; 08-03-2019 at 10:57 PM.
|
|
|
08-03-2019, 03:41 PM
|
#12
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by Sexan
I'm sure I forgot something really stupid here:
Store all tracks
Code:
function GetTracksXYH()
TBH = {}
for i = 1 , reaper.CountTracks(0) do
local tr = reaper.GetTrack(0, i-1)
local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
local tr_t = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
local tr_b = tr_t + tr_h
for j = 1 , reaper.CountTrackEnvelopes(tr) do
local env = reaper.GetTrackEnvelope(tr, j-1)
local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY")
local env_b = env_t + env_h
TBH[env] = {t = env_t, b = env_b, h = env_h}
end
TBH[tr] = {t = tr_t, b = tr_b, h = tr_h}
end
end
|
Don't forget
Code:
env_t = env_t + tr_t
(the envelope position is relative to the track position)
|
|
|
08-03-2019, 03:52 PM
|
#13
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by Edgemeal
With no tracks, show master track, then hide master track, it leaves track background...
Windows 10(1903) x64
|
fixing, thanks!
|
|
|
08-03-2019, 03:57 PM
|
#14
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Maybe today I'm genuinely stupid but... are you sure about
Code:
env_t = env_t + tr_t
?
because for the first track which has I_TCPY of 0, adding that to envelope adds nothing?
Nothing changed it still offseted
|
|
|
08-03-2019, 04:15 PM
|
#15
|
Human being with feelings
Join Date: Dec 2017
Posts: 302
|
GetTrackFromPoint
It seems GetTrackFromPoint a little bit cpu hungry in defer cycles.
|
|
|
08-03-2019, 04:17 PM
|
#16
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Could be, that this is only ShowConsoleMsg().
I had similar results with other console outputs.
Only a guess, though.
|
|
|
08-03-2019, 04:20 PM
|
#17
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
yeah, I think its the console because I do not have issues with 100+ tracks at all
Glorious 60fps!!! (sorry forgot about it haha)
|
|
|
08-03-2019, 04:21 PM
|
#18
|
Human being with feelings
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,619
|
Yeah the console is a real pig when scrolling is involved. Don't log anything when you want to test performance/responsiveness.
|
|
|
08-03-2019, 04:52 PM
|
#19
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Quote:
Originally Posted by _Stevie_
Could be, that this is only ShowConsoleMsg().
I had similar results with other console outputs.
Only a guess, though.
|
I'd think so too.
You could print to console only if found track has changed and it should be better I asume, something like this (pseudo-ish)
Code:
lastTr = -1
function cpu()
tr = ...
if tr ~= lastTr then
m(tr)
end
lastTr = tr
reaper.defer(cpu)
end
|
|
|
08-03-2019, 05:25 PM
|
#20
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
Quote:
Originally Posted by Sexan
Maybe today I'm genuinely stupid but... are you sure about
Code:
env_t = env_t + tr_t
?
because for the first track which has I_TCPY of 0, adding that to envelope adds nothing?
Nothing changed it still offseted
|
Yes. Having said that, you can't pass the mouse screen coordinates in, it must be arrange-view coordinates. and to get that (for now) you probably need to use an extension-provided API (going to add a general coordinate conversion API)...
e.g.:
Code:
local function GetTrackEnvFromMouse(x, y)
local tr, info = reaper.GetTrackFromPoint(x, y)
if tr and info == 1 then
local wnd = reaper.BR_Win32_FindWindowEx(
reaper.BR_Win32_HwndToString(reaper.BR_Win32_GetMainHwnd()),0,
"REAPERTrackListWindow","",true,false)
x,y = reaper.BR_Win32_ScreenToClient(wnd,x,y)
local tr_t = reaper.GetMediaTrackInfo_Value(tr, "I_TCPY" )
for i = 1 , reaper.CountTrackEnvelopes(tr) do
local env = reaper.GetTrackEnvelope(tr, i-1)
local env_t = reaper.GetEnvelopeInfo_Value(env,"I_TCPY") + tr_t
local env_h = reaper.GetEnvelopeInfo_Value(env,"I_TCPH")
if y >= env_t and y < env_t + env_h then
return tr, env
end
end
end
return tr, nil
end
function run()
track,env = GetTrackEnvFromMouse(reaper.GetMousePosition())
reaper.defer(run);
if env ~= nil then
_,name = reaper.GetEnvelopeName(env)
else
name = ""
end
end
run()
Last edited by Justin; 08-03-2019 at 06:07 PM.
Reason: oops fixed script
|
|
|
08-04-2019, 02:32 AM
|
#21
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Edit...
Last edited by Sexan; 08-04-2019 at 03:47 AM.
|
|
|
08-04-2019, 07:23 AM
|
#22
|
Human being with feelings
Join Date: Aug 2015
Location: Florence, Italy
Posts: 463
|
Quote:
Originally Posted by MaestroS
Check!!!!!!!
Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
|
It's a pity, I use Contextual Toolbars a lot!! I hope SWS developers update their extension.
|
|
|
08-04-2019, 07:30 AM
|
#23
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by DANIELE
It's a pity, I use Contextual Toolbars a lot!! I hope SWS developers update their extension.
|
I'm sure they will, it's just a matter of time, since not many people are working on SWS.
|
|
|
08-04-2019, 01:48 PM
|
#24
|
Human being with feelings
Join Date: Aug 2015
Location: Florence, Italy
Posts: 463
|
Quote:
Originally Posted by _Stevie_
I'm sure they will, it's just a matter of time, since not many people are working on SWS.
|
I know, let's hope they do it soon, I hate to break my workflow like this.
|
|
|
08-04-2019, 04:01 PM
|
#25
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Quote:
Originally Posted by MaestroS
Check!!!!!!!
Contextual toolbars (_BR_CONTEXTUAL_TOOLBAR_) assigned to double click "Track Cotrol Panel" -Not working-
|
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
|
|
|
08-04-2019, 04:34 PM
|
#26
|
Human being with feelings
Join Date: Dec 2017
Posts: 302
|
Quote:
Originally Posted by nofish
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
|
Here how we get tcp panel to combine this two functions. GetTrackFromPoint get only only tcp panel. JS_API required.
Code:
function get_tcp_win()
local hwnd= reaper.JS_Window_FindChildByID( reaper.GetMainHwnd(), 1259)
tcp_win = reaper.JS_Window_GetRelated(reaper.JS_Window_GetRelated(hwnd, "NEXT"), "NEXT")
return tcp_win
end
function GetTrackFromPoint(x, y)
if reaper.JS_Window_FromPoint( x, y )==get_tcp_win() then
local _, left, tcptop, right, _ = reaper.JS_Window_GetClientRect(get_tcp_win())
local count_tr=reaper.CountTracks(0)
if count_tr==0 then return end
for i=1, count_tr do
local tr=reaper.GetTrack( 0, i-1)
local tr_h = reaper.GetMediaTrackInfo_Value( tr, "I_TCPH" )
local tr_y = reaper.GetMediaTrackInfo_Value( tr, "I_TCPY" )
local top = (tcptop+tr_y)
local bottom = (top+tr_h)
if x> left and x<right and y>top and y<bottom then track=tr break end
end
end
return track
end
|
|
|
08-04-2019, 05:27 PM
|
#27
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Thank you.
|
|
|
08-04-2019, 10:14 PM
|
#28
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 24,798
|
Quote:
Originally Posted by DANIELE
I know, let's hope they do it soon, I hate to break my workflow like this.
|
Then you should stay on official builds
|
|
|
08-05-2019, 01:56 AM
|
#29
|
Human being with feelings
Join Date: Aug 2015
Location: Florence, Italy
Posts: 463
|
Quote:
Originally Posted by EvilDragon
Then you should stay on official builds
|
Infact, this is what I do. I'm only wondering about the future.
|
|
|
08-05-2019, 02:26 AM
|
#30
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
|
Quote:
Originally Posted by nofish
@Justin
If tracks no longer have windows how do we detect 'mouse over TCP' now?
TrackFromPoint() works over TCP too but we'd need to know TCP width to be able to differentiate between TCP and track lane I guess?
|
It would be cool if TrackFromPoint could also give additional TCP,MCP info:
retval, info, view = reaper.GetTrackFromPoint( screen_x, screen_y )
view 0
view 1 - tcp
view 2 - mcp
|
|
|
08-05-2019, 03:22 AM
|
#31
|
Human being with feelings
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
|
Quote:
Originally Posted by Sexan
It would be cool if TrackFromPoint could also give additional TCP,MCP info:
retval, info, view = reaper.GetTrackFromPoint( screen_x, screen_y )
view 0
view 1 - tcp
view 2 - mcp
|
Yep, something like this.
The way posted by nappies above is rather involved.
|
|
|
08-05-2019, 09:47 AM
|
#32
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by Justin
Yes, GetTrackFromPoint() sets the info parameter if the point is within an envelope lane (it doesn't tell you *which* env that is, but there's a new API you can use to figure that out).
|
I tried GetTrackFromPoint yesterday and it's working great with one exception: you need to see the tracks. So you can't run a script doing something in the background with trackheights, unless all tracks are visible.
Is there a way to add an option, that allows getting the tracks at the position without having the main-Reaper-window in the front?
Some kind of optional boolean parameter or something?
|
|
|
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 05:59 PM.
|