|
|
|
05-16-2020, 03:48 AM
|
#41
|
Human being with feelings
Join Date: Oct 2017
Location: U.K
Posts: 542
|
I tried this on the latest dev version using metal (I know currently you have to disable optimized drawing on mac) and still doesn't work. Is that because the script would need updating to reflect two of the changes made to metal? Or does it require the 3d fix too?
* SRCCOPY_USEALPHACHAN not doing alpha blending,
* StretchBlt not stretching to Metal surface, and
(still waiting on the third):
* BitBlt not blitting from Metal surface.
Thanks
|
|
|
05-16-2020, 06:01 AM
|
#42
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Pink Wool
Very nice script! Thanks! Super useful!
How would one go about making a custom action so that this would be on when choosing the ripple editing modes? I made a custom action with cycle ripple editing and this but now the cycle is messed up...
I know I could run it on startup or make a new toolbar icon for it but I would really like to learn to do custom actions like these (if it's possible)
|
The script monitors the ripple editing modes and does its thing if ripple is enabled. If not, it does nothing else than checking every 1/3 of a second if the ripple mode changed.
It is better to keep it on.
Making a Cycle Action is impossible due to the restraints of the Cycle Actions (no nested IFs or ELSE IFs).
You can do it with this script:
Code:
-- Get ripple state
local ripple
if reaper.GetToggleCommandState( 41991 ) == 1 then ripple = 2 -- ripple editing all tracks
elseif reaper.GetToggleCommandState( 41990 ) == 1 then ripple = 1 -- ripple editing per-track
else ripple = 0
end
-- Get script command ID
local cmd = reaper.NamedCommandLookup('_RS7507a4bbefb6bb43a22048a145a624d40ce55e1b') -- amagalma_Distinguish visually the ripple editing modes
-- Get its state
local cmd_state = reaper.GetToggleCommandState( cmd ) == 1 and true or false
-- Cycle ripple state
if ripple == 0 then
reaper.Main_OnCommand(40310, 0) -- Set ripple editing per-track
-- Turn on if not running
if not cmd_state then
reaper.Main_OnCommand(cmd, 0)
end
elseif ripple == 1 then
reaper.Main_OnCommand(40311, 0) -- Set ripple editing all tracks
-- Turn on if not running
if not cmd_state then
reaper.Main_OnCommand(cmd, 0)
end
elseif ripple == 2 then
reaper.Main_OnCommand(40309, 0) -- Set ripple editing off
-- Turn off if running
if cmd_state then
reaper.Main_OnCommand(cmd, 0)
end
end
-- Create no Undo
reaper.defer(function() end)
|
|
|
05-16-2020, 06:03 AM
|
#43
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Ideosound
I tried this on the latest dev version using metal (I know currently you have to disable optimized drawing on mac) and still doesn't work. Is that because the script would need updating to reflect two of the changes made to metal? Or does it require the 3d fix too?
* SRCCOPY_USEALPHACHAN not doing alpha blending,
* StretchBlt not stretching to Metal surface, and
(still waiting on the third):
* BitBlt not blitting from Metal surface.
Thanks
|
I have no idea.. I am waiting for the things to settle down first... Do other scripts like Area 51 and my Guide Line work?
|
|
|
05-16-2020, 07:29 AM
|
#44
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Quote:
Originally Posted by amagalma
The script monitors the ripple editing modes and does its thing if ripple is enabled. If not, it does nothing else than checking every 1/3 of a second if the ripple mode changed.
It is better to keep it on.
Making a Cycle Action is impossible due to the restraints of the Cycle Actions (no nested IFs or ELSE IFs).
You can do it with this script:
|
Thank you!
So now I made a custom action icon (using the default ripple editing icon) but it doesn't "toggle" and just flashes as I change the mode. I know this isn't really a question about the script but more about the toggle but do you know the way, old wise one? :-D
|
|
|
05-16-2020, 08:15 AM
|
#45
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Pink Wool
Thank you!
So now I made a custom action icon (using the default ripple editing icon) but it doesn't "toggle" and just flashes as I change the mode. I know this isn't really a question about the script but more about the toggle but do you know the way, old wise one? :-D
|
Can't be done. All Reaper buttons have 2 states: on and off. Only the native Ripple button has 3 states (off/per-track/all-tracks). The only way to see which mode is on is by looking at the native ripple button.
|
|
|
05-16-2020, 11:27 AM
|
#46
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Quote:
Originally Posted by amagalma
Can't be done. All Reaper buttons have 2 states: on and off. Only the native Ripple button has 3 states (off/per-track/all-tracks). The only way to see which mode is on is by looking at the native ripple button.
|
Ok! So I'll have two buttons then! Thanks for all the help!
|
|
|
05-16-2020, 01:17 PM
|
#47
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
|
im sorry dude I was in an altered state will do again
|
|
|
05-16-2020, 01:32 PM
|
#48
|
Human being with feelings
Join Date: Oct 2009
Location: France
Posts: 743
|
Thank you Amagalma it works now on my mac with V1.21 after activate state ON
would it be possible to make the colour darker?
Thank you in advance
|
|
|
05-16-2020, 01:49 PM
|
#49
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
|
|
|
05-17-2020, 06:09 AM
|
#50
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
|
Thank you! That is super weird! In order to solve this, we will have to work step by step together. Checking one thing at a time until we find the culprit. Ok, let's check the first suspect. Could you test the following script and post me the results?
Code:
-- TEST
local function Msg(...)
if debug then
local arg = { ... }
for i = 1, #arg do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg) .. "\n")
end
end
local MainHwnd = reaper.GetMainHwnd()
local trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
local _, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
reaper.ClearConsole()
Msg("Trackview: ", trackview, "\nWidth: ", width_trackview, "\nHeight: ", height_trackview, "\n")
local track_cnt = reaper.CountTracks( 0 )
local vis_tr = {}
for i = 0, track_cnt-1 do
local track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
local y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
vis_tr[#vis_tr+1] = string.format("%i", id)
end
end
Msg("Visible tracks: ", table.concat(vis_tr, ", "), "\n")
Test script.lua
|
|
|
05-17-2020, 06:12 AM
|
#51
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Sumalc
Thank you Amagalma it works now on my mac with V1.21 after activate state ON
would it be possible to make the colour darker?
Thank you in advance
|
You can set the color inside the script. Choose "Edit...". Inside you will find this:
Code:
-- SET COLOR HERE -- (0-255)
local red, green, blue, alpha = 0, 255, 0, 13
|
|
|
05-17-2020, 08:22 AM
|
#52
|
Human being with feelings
Join Date: Oct 2009
Location: France
Posts: 743
|
Cool thank you very much.
|
|
|
05-18-2020, 01:55 PM
|
#53
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
Thank you! That is super weird! In order to solve this, we will have to work step by step together. Checking one thing at a time until we find the culprit. Ok, let's check the first suspect. Could you test the following script and post me the results?
Code:
-- TEST
local function Msg(...)
if debug then
local arg = { ... }
for i = 1, #arg do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg) .. "\n")
end
end
local MainHwnd = reaper.GetMainHwnd()
local trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
local _, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
reaper.ClearConsole()
Msg("Trackview: ", trackview, "\nWidth: ", width_trackview, "\nHeight: ", height_trackview, "\n")
local track_cnt = reaper.CountTracks( 0 )
local vis_tr = {}
for i = 0, track_cnt-1 do
local track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
local y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
vis_tr[#vis_tr+1] = string.format("%i", id)
end
end
Msg("Visible tracks: ", table.concat(vis_tr, ", "), "\n")
Test script.lua
|
Code:
Trackview: userdata: 00000000000C066A
Width: 1352
Height: 498
Visible tracks: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
|
|
|
05-18-2020, 04:18 PM
|
#54
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thanks! Try this please:
Code:
-- TEST
local reaper, floor = reaper, math.floor
local function Msg( ... )
local arg = table.pack( ... )
for i = 1, arg.n do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg))
end
------------------------------------------------------
local MainHwnd = reaper.GetMainHwnd()
local tracks = {}
local p_trackitems_cnt = {}
local trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
local _, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
local start = reaper.time_precise()
local checksizetime = start
local p_item, p_item_cnt = 0, -1
local huge = math.huge
local first_pos
local st, en, arr_duration, track_cnt
---------------------------------------------------------------
function main()
local now = reaper.time_precise()
st, en = reaper.GetSet_ArrangeView2( 0, false, 0, 0 )
arr_duration = en - st
track_cnt = reaper.CountTracks( 0 )
-- Check every now and then if arrange size changed and update values
if now - checksizetime >= 1 then
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
checksizetime = now
end
for i = 0, track_cnt-1 do
local track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
local y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
local item_cnt = reaper.CountTrackMediaItems( track )
if p_trackitems_cnt[id] ~= item_cnt then
tracks[id] = nil
p_trackitems_cnt[id] = item_cnt
end
if item_cnt > 0 then
local paint = false
local x_pos
for j = 0, item_cnt-1 do
local item = reaper.GetTrackMediaItem( track, j )
if reaper.IsMediaItemSelected( item ) then
x_pos = floor( ( ( reaper.GetMediaItemInfo_Value( item, "D_POSITION" ) - st ) / arr_duration ) * width_trackview )
x_pos = x_pos > 0 and ( x_pos < width_trackview and x_pos or width_trackview ) or 0
paint = true
local ID = tostring(id)
Msg("item selected on track ", ID:match("%d+"), "\n")
break
end
end
local track_h = reaper.GetMediaTrackInfo_Value( track, "I_WNDH" )
--[[
if paint then
if ( not tracks[id] ) then
Msg( string.format("track %i : x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
elseif x_pos ~= tracks[id] then
Msg( string.format("track %i new positin: x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
end
else
if tracks[id] then
Msg( string.format("erase track %i", id) .. "\n" )
tracks[id] = nil
end
end
--]]
end
else
break
end
end
if now - start <= 20 then
reaper.defer(main)
end
end
function Exit()
Msg("\n\n== script ran for 20secs and ended ==\n\n")
return reaper.defer(function() end)
end
reaper.atexit(Exit)
main()
script
|
|
|
05-18-2020, 07:34 PM
|
#55
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
== script ran for 20secs and ended ==
|
|
|
05-19-2020, 02:13 AM
|
#56
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
== script ran for 20secs and ended ==
|
Sorry, I forgot to tell you to select any item on a visible track and see if you get any message while the script is running. Could you try it again?
|
|
|
05-19-2020, 09:35 AM
|
#57
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
Sorry, I forgot to tell you to select any item on a visible track and see if you get any message while the script is running. Could you try it again?
|
nothing...
|
|
|
05-19-2020, 10:29 AM
|
#58
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
nothing...
|
Try this version with a small project (2-3 tracks with 2-3 items on each track) and have one item selected:
Code:
-- TEST
local reaper, floor = reaper, math.floor
local function Msg( ... )
local arg = table.pack( ... )
for i = 1, arg.n do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg))
end
------------------------------------------------------
local MainHwnd = reaper.GetMainHwnd()
local tracks = {}
local p_trackitems_cnt = {}
local trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
local _, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
local start = reaper.time_precise()
local checksizetime = start
local p_item, p_item_cnt = 0, -1
local huge = math.huge
local first_pos
local st, en, arr_duration, track_cnt
---------------------------------------------------------------
function main()
local now = reaper.time_precise()
st, en = reaper.GetSet_ArrangeView2( 0, false, 0, 0 )
arr_duration = en - st
track_cnt = reaper.CountTracks( 0 )
-- Check every now and then if arrange size changed and update values
if now - checksizetime >= 1 then
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
checksizetime = now
end
for i = 0, track_cnt-1 do
local track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
local ID = tostring(id)
ID = ID:match("%d+")
local y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
Msg("Track ",ID," visible with ")
local item_cnt = reaper.CountTrackMediaItems( track )
Msg(item_cnt, " items.\n")
if p_trackitems_cnt[id] ~= item_cnt then
tracks[id] = nil
Msg(" -- Item count changed. -- ")
p_trackitems_cnt[id] = item_cnt
end
if item_cnt > 0 then
local item_selected = false
local paint = false
local x_pos
for j = 0, item_cnt-1 do
local item = reaper.GetTrackMediaItem( track, j )
if reaper.IsMediaItemSelected( item ) then
x_pos = floor( ( ( reaper.GetMediaItemInfo_Value( item, "D_POSITION" ) - st ) / arr_duration ) * width_trackview )
x_pos = x_pos > 0 and ( x_pos < width_trackview and x_pos or width_trackview ) or 0
paint = true
Msg("item selected\n")
break
end
end
local track_h = reaper.GetMediaTrackInfo_Value( track, "I_WNDH" )
--[[
if paint then
if ( not tracks[id] ) then
Msg( string.format("track %i : x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
elseif x_pos ~= tracks[id] then
Msg( string.format("track %i new positin: x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
end
else
if tracks[id] then
Msg( string.format("erase track %i", id) .. "\n" )
tracks[id] = nil
end
end
--]]
end
else
break
end
end
if now - start <= 20 then
reaper.defer(main)
end
end
function Exit()
Msg("\n\n== script ran for 20secs and ended ==\n\n")
return reaper.defer(function() end)
end
reaper.atexit(Exit)
main()
script
Do you see anything like this?:
Code:
Track 2 visible with 2 items.
Track 3 visible with 1 items.
Track 1 visible with 2 items.
item selected
|
|
|
05-20-2020, 08:40 AM
|
#59
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
Try this version with a small project (2-3 tracks with 2-3 items on each track) and have one item selected:
Code:
-- TEST
local reaper, floor = reaper, math.floor
local function Msg( ... )
local arg = table.pack( ... )
for i = 1, arg.n do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg))
end
------------------------------------------------------
local MainHwnd = reaper.GetMainHwnd()
local tracks = {}
local p_trackitems_cnt = {}
local trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
local _, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
local start = reaper.time_precise()
local checksizetime = start
local p_item, p_item_cnt = 0, -1
local huge = math.huge
local first_pos
local st, en, arr_duration, track_cnt
---------------------------------------------------------------
function main()
local now = reaper.time_precise()
st, en = reaper.GetSet_ArrangeView2( 0, false, 0, 0 )
arr_duration = en - st
track_cnt = reaper.CountTracks( 0 )
-- Check every now and then if arrange size changed and update values
if now - checksizetime >= 1 then
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
checksizetime = now
end
for i = 0, track_cnt-1 do
local track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
local ID = tostring(id)
ID = ID:match("%d+")
local y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
Msg("Track ",ID," visible with ")
local item_cnt = reaper.CountTrackMediaItems( track )
Msg(item_cnt, " items.\n")
if p_trackitems_cnt[id] ~= item_cnt then
tracks[id] = nil
Msg(" -- Item count changed. -- ")
p_trackitems_cnt[id] = item_cnt
end
if item_cnt > 0 then
local item_selected = false
local paint = false
local x_pos
for j = 0, item_cnt-1 do
local item = reaper.GetTrackMediaItem( track, j )
if reaper.IsMediaItemSelected( item ) then
x_pos = floor( ( ( reaper.GetMediaItemInfo_Value( item, "D_POSITION" ) - st ) / arr_duration ) * width_trackview )
x_pos = x_pos > 0 and ( x_pos < width_trackview and x_pos or width_trackview ) or 0
paint = true
Msg("item selected\n")
break
end
end
local track_h = reaper.GetMediaTrackInfo_Value( track, "I_WNDH" )
--[[
if paint then
if ( not tracks[id] ) then
Msg( string.format("track %i : x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
elseif x_pos ~= tracks[id] then
Msg( string.format("track %i new positin: x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
end
else
if tracks[id] then
Msg( string.format("erase track %i", id) .. "\n" )
tracks[id] = nil
end
end
--]]
end
else
break
end
end
if now - start <= 20 then
reaper.defer(main)
end
end
function Exit()
Msg("\n\n== script ran for 20secs and ended ==\n\n")
return reaper.defer(function() end)
end
reaper.atexit(Exit)
main()
script
Do you see anything like this?:
Code:
Track 2 visible with 2 items.
Track 3 visible with 1 items.
Track 1 visible with 2 items.
item selected
|
nothing. I'm going to try it on a portable version. After a bit it say:
== script ran for 20secs and ended ==
|
|
|
05-20-2020, 08:51 AM
|
#60
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
same for portable
|
|
|
05-20-2020, 08:52 AM
|
#61
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
nothing. I'm going to try it on a portable version. After a bit it say:
== script ran for 20secs and ended ==
|
Super super strange! It seems like all the API functions do not work!? Try it please on a portable installation and tell me if it works there. Thanks!
|
|
|
05-20-2020, 08:53 AM
|
#62
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
Super super strange! It seems like all the API functions do not work!? Try it please on a portable installation and tell me if it works there. Thanks!
|
just did as you're posting. No go. I wonder if I'm doing something wrong.
I'm not stupid I swear
|
|
|
05-20-2020, 12:43 PM
|
#63
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
just did as you're posting. No go. I wonder if I'm doing something wrong.
I'm not stupid I swear
|
Don't worry! Let's try a final test:
Code:
-- TEST
local reaper, floor = reaper, math.floor
local function Msg( ... )
local arg = table.pack( ... )
for i = 1, arg.n do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg))
end
------------------------------------------------------
MainHwnd = reaper.GetMainHwnd()
tracks = {}
p_trackitems_cnt = {}
local _
trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
local start = reaper.time_precise()
local checksizetime = start
p_item, p_item_cnt = 0, -1
local huge = math.huge
---------------------------------------------------------------
function main()
local now = reaper.time_precise()
st, en = reaper.GetSet_ArrangeView2( 0, false, 0, 0 )
arr_duration = en - st
track_cnt = reaper.CountTracks( 0 )
-- Check every now and then if arrange size changed and update values
if now - checksizetime >= 1 then
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
checksizetime = now
end
for i = 0, track_cnt-1 do
track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
ID = tostring(id)
ID = ID:match("%d+")
y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
--Msg("Track ",ID," visible with ")
item_cnt = reaper.CountTrackMediaItems( track )
--Msg(item_cnt, " items.\n")
if p_trackitems_cnt[id] ~= item_cnt then
tracks[id] = nil
--Msg(" -- Item count changed. -- ")
p_trackitems_cnt[id] = item_cnt
end
if item_cnt > 0 then
item_selected = false
local paint = false
for j = 0, item_cnt-1 do
item = reaper.GetTrackMediaItem( track, j )
if reaper.IsMediaItemSelected( item ) then
item_selected = true
x_pos = floor( ( ( reaper.GetMediaItemInfo_Value( item, "D_POSITION" ) - st ) / arr_duration ) * width_trackview )
x_pos = x_pos > 0 and ( x_pos < width_trackview and x_pos or width_trackview ) or 0
paint = true
--Msg("item selected\n")
break
end
end
local track_h = reaper.GetMediaTrackInfo_Value( track, "I_WNDH" )
--[[
if paint then
if ( not tracks[id] ) then
Msg( string.format("track %i : x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
elseif x_pos ~= tracks[id] then
Msg( string.format("track %i new positin: x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
end
else
if tracks[id] then
Msg( string.format("erase track %i", id) .. "\n" )
tracks[id] = nil
end
end
--]]
end
else
break
end
end
if now - start <= 40 then
reaper.defer(main)
end
end
function Exit()
Msg("\n\n== script ran for 40secs and ended ==\n\n")
return reaper.defer(function() end)
end
reaper.atexit(Exit)
main()
script
Follow my instructions in the gif to make me a licecap:
Big image
EDIT> IMPORTANT: Add a dot after "reaper" so it is:
Code:
NOT gfx NOT reaper.
Last edited by amagalma; 05-20-2020 at 12:56 PM.
|
|
|
05-21-2020, 09:47 AM
|
#64
|
Human being with feelings
Join Date: Apr 2020
Posts: 1,501
|
Ummm...is this "normal"? If there's a folder, then any tracks under that won't show color (tracks not in the folder)?
Last edited by Pink Wool; 05-21-2020 at 10:01 AM.
|
|
|
05-21-2020, 09:49 AM
|
#65
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Pink Wool
Ummm...is this "normal"? If there's a folder, then any tracks under that won't show color (tracks not in the folder)?
|
A licecap please?
|
|
|
05-21-2020, 01:01 PM
|
#67
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Pink Wool
|
Thanks! Fixed in v1.30
|
|
|
05-22-2020, 08:18 AM
|
#68
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
https://youtu.be/jpmwAzxkx-A
Quote:
Originally Posted by amagalma
Don't worry! Let's try a final test:
Code:
-- TEST
local reaper, floor = reaper, math.floor
local function Msg( ... )
local arg = table.pack( ... )
for i = 1, arg.n do
if arg[i] then arg[i] = tostring(arg[i]) else arg[i] = "nil" end
end
reaper.ShowConsoleMsg(table.concat(arg))
end
------------------------------------------------------
MainHwnd = reaper.GetMainHwnd()
tracks = {}
p_trackitems_cnt = {}
local _
trackview = reaper.JS_Window_FindChildByID(MainHwnd, 0x3E8)
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
local start = reaper.time_precise()
local checksizetime = start
p_item, p_item_cnt = 0, -1
local huge = math.huge
---------------------------------------------------------------
function main()
local now = reaper.time_precise()
st, en = reaper.GetSet_ArrangeView2( 0, false, 0, 0 )
arr_duration = en - st
track_cnt = reaper.CountTracks( 0 )
-- Check every now and then if arrange size changed and update values
if now - checksizetime >= 1 then
_, width_trackview, height_trackview = reaper.JS_Window_GetClientSize( trackview )
width_trackview = width_trackview + 17
checksizetime = now
end
for i = 0, track_cnt-1 do
track = reaper.GetTrack( 0, i )
local id = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" )
ID = tostring(id)
ID = ID:match("%d+")
y_pos = reaper.GetMediaTrackInfo_Value( track, "I_TCPY" )
if reaper.IsTrackVisible( track, false ) and y_pos < height_trackview then
--Msg("Track ",ID," visible with ")
item_cnt = reaper.CountTrackMediaItems( track )
--Msg(item_cnt, " items.\n")
if p_trackitems_cnt[id] ~= item_cnt then
tracks[id] = nil
--Msg(" -- Item count changed. -- ")
p_trackitems_cnt[id] = item_cnt
end
if item_cnt > 0 then
item_selected = false
local paint = false
for j = 0, item_cnt-1 do
item = reaper.GetTrackMediaItem( track, j )
if reaper.IsMediaItemSelected( item ) then
item_selected = true
x_pos = floor( ( ( reaper.GetMediaItemInfo_Value( item, "D_POSITION" ) - st ) / arr_duration ) * width_trackview )
x_pos = x_pos > 0 and ( x_pos < width_trackview and x_pos or width_trackview ) or 0
paint = true
--Msg("item selected\n")
break
end
end
local track_h = reaper.GetMediaTrackInfo_Value( track, "I_WNDH" )
--[[
if paint then
if ( not tracks[id] ) then
Msg( string.format("track %i : x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
elseif x_pos ~= tracks[id] then
Msg( string.format("track %i new positin: x = %i, y = %i", id, x_pos, y_pos) .. "\n")
tracks[id] = x_pos
end
else
if tracks[id] then
Msg( string.format("erase track %i", id) .. "\n" )
tracks[id] = nil
end
end
--]]
end
else
break
end
end
if now - start <= 40 then
reaper.defer(main)
end
end
function Exit()
Msg("\n\n== script ran for 40secs and ended ==\n\n")
return reaper.defer(function() end)
end
reaper.atexit(Exit)
main()
script
Follow my instructions in the gif to make me a licecap:
Big image
EDIT> IMPORTANT: Add a dot after "reaper" so it is:
Code:
NOT gfx NOT reaper.
|
|
|
|
05-22-2020, 08:41 AM
|
#69
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by Jason Brian Merrill
|
Thanks mate! Got it now! Fix is coming
|
|
|
05-22-2020, 02:12 PM
|
#70
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
Quote:
Originally Posted by amagalma
Thanks mate! Got it now! Fix is coming
|
thank you for your work!
|
|
|
05-25-2020, 02:09 AM
|
#71
|
Human being with feelings
Join Date: Oct 2017
Location: U.K
Posts: 542
|
I think there has been an improvement in how this works with metal on mac. When I tested it before it wouldn't show any change using metal at all (rather than the recommended disabled drawing option). Using the latest reaper release build and reapack builds.
|
|
|
05-25-2020, 06:08 AM
|
#72
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Nice to see it working.. But it does not appear right.. The yellow should be transparent.. Could you try a thing for me?
Go to lines 74-76 inside the script:
Code:
alpha = OSX and (alpha and (alpha < 0 and 0 or (alpha > 255 and 255 or alpha)) or 13) or
(alpha and (alpha < 0 and 0 or (alpha > 255 and 1 or alpha/255)) or 0.051)
local color_trackview = OSX and ((blue&0xFF)|((green&0xFF)<<8)|((red&0xFF)<<16)|((alpha&0xFF)<<24)) or
And comment out this: (by adding "--")
Code:
alpha = -- OSX and (alpha and (alpha < 0 and 0 or (alpha > 255 and 255 or alpha)) or 13) or
(alpha and (alpha < 0 and 0 or (alpha > 255 and 1 or alpha/255)) or 0.051)
local color_trackview = -- OSX and ((blue&0xFF)|((green&0xFF)<<8)|((red&0xFF)<<16)|((alpha&0xFF)<<24)) or
And tell me please if it shows correctly now. Thanks!
|
|
|
05-25-2020, 06:45 AM
|
#73
|
Human being with feelings
Join Date: Oct 2017
Location: U.K
Posts: 542
|
Quote:
Originally Posted by amagalma
Nice to see it working.. But it does not appear right.. The yellow should be transparent.. Could you try a thing for me?
Go to lines 74-76 inside the script:
Code:
alpha = OSX and (alpha and (alpha < 0 and 0 or (alpha > 255 and 255 or alpha)) or 13) or
(alpha and (alpha < 0 and 0 or (alpha > 255 and 1 or alpha/255)) or 0.051)
local color_trackview = OSX and ((blue&0xFF)|((green&0xFF)<<8)|((red&0xFF)<<16)|((alpha&0xFF)<<24)) or
And comment out this: (by adding "--")
Code:
alpha = -- OSX and (alpha and (alpha < 0 and 0 or (alpha > 255 and 255 or alpha)) or 13) or
(alpha and (alpha < 0 and 0 or (alpha > 255 and 1 or alpha/255)) or 0.051)
local color_trackview = -- OSX and ((blue&0xFF)|((green&0xFF)<<8)|((red&0xFF)<<16)|((alpha&0xFF)<<24)) or
And tell me please if it shows correctly now. Thanks!
|
I get this now, sorry its a rubbish capture but its the same just not yellow.
|
|
|
05-25-2020, 08:14 AM
|
#74
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
So, it seems that the drawing is fixed but it can't do transparency
|
|
|
05-25-2020, 08:43 AM
|
#75
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Could you please try a few more values?:
Go to line 78 (which is empty and add this:
Code:
color_trackview = 0x23FFFF7F
And try these values too: 0x01FFFF7F, 0x0AFFFF7F, 0x01232311, 0x23232311, 0x7F232311
Just to be sure.. Thanks!
(with a dev build that has the Metal fix)
|
|
|
05-25-2020, 09:40 AM
|
#76
|
Human being with feelings
Join Date: Oct 2017
Location: U.K
Posts: 542
|
Quote:
Originally Posted by amagalma
Could you please try a few more values?:
Go to line 78 (which is empty and add this:
Code:
color_trackview = 0x23FFFF7F
And try these values too: 0x01FFFF7F, 0x0AFFFF7F, 0x01232311, 0x23232311, 0x7F232311
Just to be sure.. Thanks!
(with a dev build that has the Metal fix)
|
Can't see any dev builds in the directory at the moment, maybe wait until V6.12 release is out since that should include the improvements.
|
|
|
05-25-2020, 11:44 AM
|
#77
|
Human being with feelings
Join Date: Jun 2006
Posts: 22,567
|
hey, this works for me now
|
|
|
07-04-2020, 11:25 PM
|
#78
|
Human being with feelings
Join Date: Aug 2019
Location: beijing
Posts: 612
|
wow this is kinda useful and handy !
does it wrk on Mac yet ?
thank u amagalma
|
|
|
08-07-2020, 08:04 AM
|
#79
|
Human being with feelings
Join Date: Dec 2018
Location: Paris (France)
Posts: 155
|
Very useful script, thank you !
|
|
|
08-07-2020, 08:47 AM
|
#80
|
Human being with feelings
Join Date: Dec 2018
Location: Paris (France)
Posts: 155
|
Very useful script, thank you !
Since my problem with the original "ripple" button is that you forget to turn it off when you're done, i just added another button next to it (with the "nuke" red icon), and this button triggers a custom action that i named "Custom: Cycle ripple editing mode and ripple visualization", which has the two following actions :
Options: Cycle ripple editing mode
Script: amagalma_Distinguish visually the ripple editing modes.lua
I also swapped the "Alt + P" shortcut from the original "Options: Cycle ripple editing mode" action, to this new action.
This way, if i use my regular shortcut to cycle ripple editing, i now have the obvious ripple visualization (from "Script: amagalma_Distinguish visually the ripple editing modes.lua") on the items that lets me know that i'm in ripple mode, and if i'm tempted to click on the default "ripple editing mode" button on the taskbar, i have a bright red button next to it that reminds me i should use the keystroke or this other button instead.
Of course the best way would be to have only one button with the new action, and that changes icons just like the original "ripple editing mode", but it seems nobody has found a way to do changing icons so far.
Last edited by djabthrash; 08-07-2020 at 10:07 AM.
Reason: licecap
|
|
|
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 11:53 PM.
|