Old 02-21-2017, 11:15 AM   #1
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default Snap Edit cursor to nearest Grid Line...

Dear Reapers,

Seems that there doesn't exist an Action "Snap Edit Cursor to nearest Grid line".
For my workflow, this Action would be so useful .

Am i overseeing it ?
If not available indeed, is it maybe scriptable ?
Willing to pay generously for it.


Warm Regards.
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 02-21-2017, 11:38 AM   #2
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
Default

As long as relative grid is not activated, snapping is on as well as the grid, you just need to nudge your editor cursor to land on the next or previous grid line.

Here's the simple code for LUA, which was actually provided to me by some helpful soul on this forum:
Code:
local val=1
reaper.ApplyNudge(  -- move edit cursor left 1 frame
                   0,    -- ReaProject project
                   2,    -- integer nudgeflag (&1=set to value (otherwise nudge by value), &2=snap)
                   6,    -- 0=position, 1=left trim, 2=left edge, 3=right edge, 4=contents, 5=duplicate, 6=edit cursor
                   18,   -- integer nudgeunits: 0=ms, 1=seconds, 2=grid, 3=256th notes, ..., 15=whole notes, 16=measures.beats (1.15 = 1 measure + 1.5 beats), 17=samples, 18=frames, 19=pixels, 20=item lengths, 21=item selections
                   val,    -- value: amount to nudge by, or value to set to
                   true, -- reverse: in nudge mode, nudges left (otherwise ignored)
                   0     -- copies: in nudge duplicate mode, number of copies (otherwise ignored)
                 )
I use this stuff to move items around, manipulate item edges and so on. You can use the nudge-by-slot actions of course. You'd need to save the right settings in the right slot first. Those load/save actions are only available in the action list though, not in the nudge window itself.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 02-21-2017, 11:48 AM   #3
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Quote:
Originally Posted by airon View Post
As long as relative grid is not activated, snapping is on as well as the grid, you just need to nudge your editor cursor to land on the next or previous grid line.
.
Thanks for your help !
But the Action should decide itself if the Edit cursor should be moved backwards or forward, depending on which Gridline is closest to Edit Cursor, the left one or right one.

Workflow:

I have Snap OFF.
I have Grid ON.
I place Edit cursor somewhere between 2 Grid lines.
I execute wishful Script.
Outcome: The Edit Cursor snaps to the nearest Gridline, be it on the left or the right.

Sorry for my misunderstanding if your lua script does exactly this ..:0)
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 02-21-2017, 06:28 PM   #4
ericzang
Human being with feelings
 
ericzang's Avatar
 
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 488
Default

how about this:
Script: me2beats_Move cursor to nearest grid division.lua
get here:
http://forum.cockos.com/showthread.php?t=186999

seems to do what you ask
ericzang is offline   Reply With Quote
Old 02-21-2017, 11:13 PM   #5
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

AWESOME !

Thank you !
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 01-22-2018, 08:39 PM   #6
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Is there a way to remove the nudge commands from the undo history?
I tried the trick with the empty function and defer, but the undo points are still shown
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.