|
|
|
01-05-2018, 04:27 PM
|
#1
|
Human being with feelings
Join Date: Apr 2011
Location: Germany
Posts: 1,186
|
Grid and snap automatically adapts to zoom level (solved)
Is there a grid and snap feature that can be adapted to the zoom level? If not, is this planned for the future?
Last edited by mawi; 07-15-2021 at 01:02 PM.
|
|
|
01-06-2018, 04:07 AM
|
#2
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Was asking myself the same question
|
|
|
01-06-2018, 11:38 AM
|
#3
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
What i use for that is a "workaround" cause i believe your wish isn't implemented natively in Reaper (yet).
When you have ReaPack installed ( www.reapack.com) , you will have this Action:
Script: mpl_Zoom horizontally, change grid relatively, preserve grid visibility and snap state (mousewheel).lua
Assign it to your mousewheel (mousewheel plus modifier key like SHIFT is also possible).
- Make sure you have Snap turned on.
- Dial mousewheel.
Now, Arrange View will be zoomed horizontally and the grid values will change accordingly.
Kudos ofcourse to great scripter mpl for this great script !
|
|
|
01-09-2018, 12:53 PM
|
#4
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
That's indeed a marvelous script, thanks for mentioning vanhaze and thanks for codind MPL!
|
|
|
01-09-2018, 01:28 PM
|
#5
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
!!
|
|
|
01-10-2018, 10:20 AM
|
#6
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
I made a version where you can assign zoom in and out to shortcuts.
I don't feel like adding those to my repo, since all kudos go to MPL, maybe he can add them to his repo.
Basically, I only removed the mousewheel assignment and the if condition.
Zoom out
Code:
-- @description Zoom horizontally, change grid relatively, preserve grid visibility and snap state (mousewheel)
-- @version 1.0
-- @author mpl
-- @changelog
-- + init
-- @website http://forum.cockos.com/member.php?u=70694
function main()
--------------------------------------------------------------------
zoom_adjust = 1
stages = {0.38, -- no grid
5, -- 2
16,--1
22.84,
48.84, -- 1/4
117.86,
351.95,-- 1/16
1050.92,
3200.07,
6077} -- no grid
------------------------------------------------------------------
function log(value, base) return math.log(value) /math.log(base)end
function msg(s) reaper.ShowConsoleMsg(s..'\n') end
reaper.adjustZoom( -zoom_adjust,
0,--forceset,
true,--doupd,
-1)--centermode )
grid_t = {}
for i = 2, -7, -1 do grid_t[#grid_t+1] = 2^i end
zoom_lev = reaper.GetHZoomLevel()
--[[if zoom_lev < stages[2] or zoom_lev > stages[10] then
reaper.Main_OnCommand(40753,0) -- disable snap
if reaper.GetToggleCommandState( 40145 ) == 1 then
reaper.Main_OnCommand(40145,0) -- toggle grid lines
end
else
reaper.Main_OnCommand(40754,0) -- enable snap
if reaper.GetToggleCommandState( 40145 ) == 0 then
reaper.Main_OnCommand(40145,0) -- toggle grid lines
end
end]]
for i = 1, #stages-1 do
if zoom_lev > stages[i] and zoom_lev <= stages[i+1] then
reaper.SetProjectGrid( 0, grid_t[i] )
--[[reaper.ShowConsoleMsg("")
msg('zoom_lev '..zoom_lev)
msg('grid_t '..i..' // '..grid_t[i]..'\n 2 ^'..log(grid_t[i], 2) )
msg('stages '..i..' '..stages[i]) ]]
break
end
end
end
reaper.defer(main)
Zoom in
Code:
-- @description Zoom horizontally, change grid relatively, preserve grid visibility and snap state (mousewheel)
-- @version 1.0
-- @author mpl
-- @changelog
-- + init
-- @website http://forum.cockos.com/member.php?u=70694
function main()
--------------------------------------------------------------------
zoom_adjust = 1
stages = {0.38, -- no grid
5, -- 2
16,--1
22.84,
48.84, -- 1/4
117.86,
351.95,-- 1/16
1050.92,
3200.07,
6077} -- no grid
------------------------------------------------------------------
function log(value, base) return math.log(value) /math.log(base)end
function msg(s) reaper.ShowConsoleMsg(s..'\n') end
reaper.adjustZoom( zoom_adjust,
0,--forceset,
true,--doupd,
-1)--centermode )
grid_t = {}
for i = 2, -7, -1 do grid_t[#grid_t+1] = 2^i end
zoom_lev = reaper.GetHZoomLevel()
--[[if zoom_lev < stages[2] or zoom_lev > stages[10] then
reaper.Main_OnCommand(40753,0) -- disable snap
if reaper.GetToggleCommandState( 40145 ) == 1 then
reaper.Main_OnCommand(40145,0) -- toggle grid lines
end
else
reaper.Main_OnCommand(40754,0) -- enable snap
if reaper.GetToggleCommandState( 40145 ) == 0 then
reaper.Main_OnCommand(40145,0) -- toggle grid lines
end
end]]
for i = 1, #stages-1 do
if zoom_lev > stages[i] and zoom_lev <= stages[i+1] then
reaper.SetProjectGrid( 0, grid_t[i] )
--[[reaper.ShowConsoleMsg("")
msg('zoom_lev '..zoom_lev)
msg('grid_t '..i..' // '..grid_t[i]..'\n 2 ^'..log(grid_t[i], 2) )
msg('stages '..i..' '..stages[i]) ]]
break
end
end
end
reaper.defer(main)
|
|
|
01-25-2021, 09:56 AM
|
#7
|
Human being with feelings
Join Date: Nov 2018
Location: Montreal
Posts: 405
|
This is amazing! Exactly what I needed!
|
|
|
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:49 PM.
|