Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-22-2015, 02:14 PM   #1
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default REQ: Nudge left item edge of sel items to the left / keep their snap offsets in place

Hello!

This one must be tricky! I know it!

Is it possible with the current APIs? Could someone make it?

Thanks!

EDIT:
Script by Claudiohbsantos
Script by X-Raym

Thank you guys!!

Last edited by amagalma; 03-23-2015 at 06:05 AM.
amagalma is offline   Reply With Quote
Old 03-22-2015, 02:34 PM   #2
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

Unless no one offers a solution.

I think you could do it as an action by first moving the edit cursor to the item edge and then upon adjusting the edge (with the action) you could send the action "set snap offset to cursor" which should kind of do what you need.

It would move the edit cursor though which might be able to combat with the store/recall edit cursor position actions although I think this would then break the action if you use it more than one time.
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 03-22-2015, 02:57 PM   #3
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

That is how I do it up to now.. but it works only on one item at a time...

P.S. And it works only when the snap offset is at the start of the item and not somewhere else

Last edited by amagalma; 03-22-2015 at 03:06 PM.
amagalma is offline   Reply With Quote
Old 03-22-2015, 03:00 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

How long would be the nudging ?
X-Raym is offline   Reply With Quote
Old 03-22-2015, 03:02 PM   #5
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

1ms would be ok
amagalma is offline   Reply With Quote
Old 03-22-2015, 03:27 PM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

it could be better with a GUI slider :P
X-Raym is offline   Reply With Quote
Old 03-22-2015, 04:01 PM   #7
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Nah... just a simple script that can be assigned to a key
amagalma is offline   Reply With Quote
Old 03-22-2015, 04:17 PM   #8
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Ok so maybe than having a 1ms that would be very low and wil create a tons of undo point,
maybe something "get edit cursor pos, get track under mouse, analyse offset between the edit cursor and the first selected item after the edit cursor, calc the offset, define the offset for all selected items" ?

Last edited by X-Raym; 03-22-2015 at 04:23 PM.
X-Raym is offline   Reply With Quote
Old 03-22-2015, 04:29 PM   #9
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Wait.

You want
  • the left edges to move (aka, position)
  • to length to be expand accordingly (preserving right edges position)
  • the source to move with left edges
Is that it ?

Erf I don't know if I will have time to help you, I have work to do --'
X-Raym is offline   Reply With Quote
Old 03-22-2015, 06:36 PM   #10
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

What I want is what happens when you run the action to grow the left side of an item but with the snap offset staying at the same place, not moving to the left!
amagalma is offline   Reply With Quote
Old 03-22-2015, 06:55 PM   #11
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

I found the solution!!! .. but someone has to code the script!...

Ok.. see what happens.. if you run action 41250 "Nudge items left by last nudge dialog settings" the snap offset does not move if it is not exactly 0!

So the script should do the following, in the following order:
1) check if snap offset is >0
YES: run action 41250
NO:
2) a) Set snap offset to 0:00.000001 (this in reality does not move the snap offset but makes it larger than 0)
b) then run action 41250

amagalma is offline   Reply With Quote
Old 03-22-2015, 07:08 PM   #12
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

It should be something like that:
Code:
GetMediaItemInfo_Value(MediaItem*, "D_SNAPOFFSET");

D_SNAPOFFSET > 0 ? (
  Main_OnCommand(41250, 0);
) : (
SetMediaItemInfo_Value(MediaItem*, "D_SNAPOFFSET", 0.000001 );
  Main_OnCommand(41250, 0);
);
Could you please correct it? And make it work on multiple items.
For that I know that something like CountSelectedItems is required and then something like for i=up to the number of the items.. so that the script loops as many times as there are items.. right?
amagalma is offline   Reply With Quote
Old 03-22-2015, 07:09 PM   #13
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

I just gave it a try. Is this what you are looking for?

https://stash.reaper.fm/23703/Grow%20...p%20offset.eel

It should grow the left edge of the selected items without moving the snap offsets. Let me know if there are any weird bugs or anything, didn't extensively test it yet.

EDIT: I hand't seen your last 2 posts, was already uploading and typing my post. Let me know if the one I uploaded doesn't work and I'll try to take a look at the code you posted and the actions you mentioned.
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Old 03-22-2015, 07:16 PM   #14
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Oh Man!! You did it!!! It works like a charm!! Thank you so much!!!

After looking at your script (wow, you did a lot of work!), I feel so embarassed about my nonsense code...
amagalma is offline   Reply With Quote
Old 03-22-2015, 07:19 PM   #15
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

Quote:
Originally Posted by amagalma View Post
Oh Man!! You did it!!! It works like a charm!! Thank you so much!!!

After looking at your script (wow, you did a lot of work!), I feel so embarassed about my nonsense code...
Glad it worked =]

Hahahah Nah, those two functions I keep around to reuse every now and then, they always come in handy. The code was actually only 3 or 4 lines in the middle of my messy loop. And actually now that I looked at it again they are overkill, no need to store and restore selected tracks or edit cursor.

EDIT: Ok, updated the script to remove the unnecessary functions. Should be updated in the original link, or here:
https://stash.reaper.fm/23703/Grow%20...p%20offset.eel
__________________
My Reapack Repo - Reapack Extension

Last edited by Claudiohbsantos; 03-22-2015 at 07:25 PM.
Claudiohbsantos is offline   Reply With Quote
Old 03-22-2015, 07:28 PM   #16
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Nice website and portfolio you have there! Well done!

Thanks for the optimized version!
amagalma is offline   Reply With Quote
Old 03-23-2015, 05:46 AM   #17
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Claudio
Your optimized version may be more optimized, you don't need to save the item selection and restore it, you could simply loop between selected items

---
I wanted to push it a step further, in order to have
  • Variable Length
  • Less undo points
  • Snap
  • Trim in several direction
So here is my proposition on this subject, for pre-release v5.
  1. place edit cursor
  2. select items
  3. mouse hover one item
  4. execute the script via shortcut => it expands the left edges (preserving all we want), and do the same modifications for all objects (with same offset as mouse hover item)
Various security are in place so that you don't loose the snap offset position.


Demo:


Download Link:
Look at my signature!
Folder will be Item Editing.
Actual script name:
  • X-Raym_Expand left edge of item under mouse to edit cursor keeping snap offset position and apply to other selected items.eel


Hope you will like it!
X-Raym is offline   Reply With Quote
Old 03-23-2015, 06:02 AM   #18
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Nice X-Raym!! Merci beaucoup!!

Nice website too! ) .. I could not find the script though, maybe you have not uploaded yet?

I 'll link to both scripts in my first post
amagalma is offline   Reply With Quote
Old 03-23-2015, 06:26 AM   #19
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@amagalma
Derien ça me fait plaisir!
Thanks for the website :P

(the script is inside my REAPER scripts collection zip in the subfolder Item Editing. Just click on download button, extract the zip, and fin the file, named as mentioned in previous post :P
I don't share individual links as I wouldn't be able to update each individual posts if I change the link for a reason or another, so I just share this page. easier for everyone).
X-Raym is offline   Reply With Quote
Old 03-23-2015, 11:34 AM   #20
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

@X-Raym
Cool one! Well done. And yeah, I realized that basic thing as I was about to fall asleep, but then it was too late to power everything on and fix it.

@ amagalma
Thanks

Edit: Just updated the file with the optimization X-Raym mentioned, the same link should still be valid and take to the new version. Much cleaner now!
__________________
My Reapack Repo - Reapack Extension

Last edited by Claudiohbsantos; 03-23-2015 at 11:41 AM.
Claudiohbsantos is offline   Reply With Quote
Old 03-23-2015, 01:00 PM   #21
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Claudiohbsantos
Thanks

@all
I want to push the concept even further.
Here what is look like so far:


Ideally, it would be able to detect the ripple editing state. None would be just like the actual version of the script.
I'm on it :P
X-Raym is offline   Reply With Quote
Old 03-23-2015, 05:10 PM   #22
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Here it is:
Scripts (Lua): Move L/R edge of item under mouse to edit cursor (with ripple edit)

It is ripple state dependent
X-Raym is offline   Reply With Quote
Old 03-23-2015, 06:28 PM   #23
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Wow! This seems complicated!
amagalma is offline   Reply With Quote
Old 03-23-2015, 07:35 PM   #24
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Complex to code to use :P
There is just two actions, that act just the way you wanted (preserving position and snap) for left and right.
But, they can consider riple editing state.
The offset is measure from the distance between edge from item under mouse and edit cursor.
X-Raym is offline   Reply With Quote
Old 04-10-2015, 05:31 PM   #25
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default Expand selected items length to start and end of their source

I have an another script for you, guys

It look like Set items length to source media lengths or Xenakios: Reset item length and media offset, but it keeps item position and snap offsets.

Demo:
The demo show comparaison with the two other scripts.



File Name:
  • X-Raym_Expand selected items length to start and end of their source.eel
Download:
See my signature for my script collection.


Cheers !
X-Raym is offline   Reply With Quote
Old 04-11-2015, 01:00 AM   #26
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Oh! Nice! :-) Thank you very much X-Raym! :-)
amagalma is offline   Reply With Quote
Old 06-04-2015, 02:00 PM   #27
mezzo
Human being with feelings
 
Join Date: Sep 2014
Posts: 28
Default

Thanks! It's Great!Very useful for me.

Sorry,but I can't find simply action for item:

"Trim left(right) edge of Item to grid" (such as "Trim left edge of Item to edit cursor" /41305/,but for align to grid).It exist?It would be very useful(IMHO)for aligning MIDI items.Thanks!
mezzo is offline   Reply With Quote
Old 06-04-2015, 02:57 PM   #28
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Mezzo
Yes there is several way to do that !
  • activate snap, place edit cursor on the grid and use my scripts X-Raym_Trim left edge of item under mouse to edit cursor without changing fade-in end.eel or X-Raym_Trim right edge of item under mouse to edit cursor without changing fade-out start.eel from the post : Scripts (EEL): Move L/R edge of item under mouse to edit cursor (with ripple edit)
  • activate snap and click and drag the item to grid
  • use the Nudge/set items... action
It may also be a couple of other ways :P
X-Raym is offline   Reply With Quote
Old 06-05-2015, 02:12 AM   #29
mezzo
Human being with feelings
 
Join Date: Sep 2014
Posts: 28
Default

@X-Raym

Thanks! "Nudge/set items..." and his "Save dialog settings" is a good way (for me) :-)
mezzo 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 10:58 PM.


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