Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools
Old 01-26-2025, 05:24 AM   #1
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default [fixed] ApplyNudge() doesn`t support Automation items

The issue discribed here

https://forum.cockos.com/showthread.php?t=297349

In short, ApplyNudge() is indeed move Automation item, but doesn`t crop it to item boundaries move at right position.

Quote:
Originally Posted by the brok View Post
Hi all,

here's what i don't understand and struggle to find a solution:

The case:
I have set the automation automation in the main toolbar so that it follows items. Now, when i use control to copy the item or i move it via mouse drag, everything is fine - the automation follows the item.

The problem:
- i have set up the key command "D" to duplicate the event based on bars relative with the following action:

Script: mpl_Duplicate items bar relative

Now for the item itself this action works fine.
But when there is underlying automation and i perform this keystroke which triggers the action, the automation events only go half way with the item - even though the toolbar preference for the automation is set to explicitly follow the items (the toolbar button is green - hence "move envelope points with media items" is activated - a right click on that toolbar button also reveals it as ticked).

Please see the animated gif in the attachment - you'll see what i mean. In the beginning i copy the event via control left mouse drag. after that i use the shortcut that i assigned to trigger the action.

What am i doing wrong?
Thanks so much in advance.


Mentioned script:
Code:
-- @description Duplicate items bar relative
-- @version 2.0
-- @author MPL
-- @website http://forum.cockos.com/showthread.php?t=188335
-- @changelog
--    # overall cleanup
--    # remove SWS dependency
--    # handle bar correctly
--    # handle time signatures and tempo variations

    ----------------------------------------------------------------------
  function main() 
    local it = reaper.GetSelectedMediaItem(0, 0)
    if not it then return end
    local it_last = reaper.GetSelectedMediaItem(0, reaper.CountSelectedMediaItems(0)-1) 
    
    local bound_st = reaper.GetMediaItemInfo_Value(it, "D_POSITION")
    local bound_end = reaper.GetMediaItemInfo_Value(it_last, "D_POSITION") +reaper.GetMediaItemInfo_Value(it_last, "D_LENGTH")
    
    local retval, measures, cml, fullbeats_st, cdenom = reaper.TimeMap2_timeToBeats( 0, bound_st )
    local retval, measures, cml, fullbeats_end, cdenom = reaper.TimeMap2_timeToBeats( 0, bound_end ) 
    
    local tsmarker = reaper.FindTempoTimeSigMarker( 0, bound_st )
    local retval1, timepos, measurepos, beatpos, bpm, timesig_num, timesig_denom, lineartempo = reaper.GetTempoTimeSigMarker( 0, tsmarker )
    if retval1 == false then
      local test_time = reaper.TimeMap2_beatsToTime( 0, 0, 1 )
       _, _, _, _, timesig_denom = reaper.TimeMap2_timeToBeats( 0, test_time )
    end
    local barshift = math.max(math.ceil((fullbeats_end-fullbeats_st) / timesig_denom),1)
    
    reaper.ApplyNudge( 0,--project, 
                0,--nudgeflag, 
                5,--nudgewhat, 
                16,--nudgeunits, 
                barshift,--value, 
                false,--reverse, 
                0)--copies )
  end
      
  reaper.Undo_BeginBlock2( 0 )
    main() 
  reaper.Undo_EndBlock2( 0, "Duplicate items bar relative", 0xFFFFFFFF )
__________________
My musicMPL Scripts discussionTelegram

Last edited by mpl; 06-15-2025 at 09:29 PM.
mpl is offline   Reply With Quote
Old 03-09-2025, 02:16 AM   #2
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default

Bump or just let me know "live with it" so I workaround this.
__________________
My musicMPL Scripts discussionTelegram
mpl is offline   Reply With Quote
Old 06-09-2025, 02:15 PM   #3
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,542
Default

Let me see if I understand this - you want ApplyNudge, when duplicating, to only duplicate the parts of the AI that overlap with the item, but not the parts that do not overlap?
Justin is offline   Reply With Quote
Old 06-09-2025, 08:07 PM   #4
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 5,400
Default

^^

according to him from a linked thread:
Quote:
Originally Posted by mpl View Post
EDIT: it is a ReaScript bug, because ApplyNudge() correctly support "automation follow events" for envelope points but not for automation items.

I noticed also that Nudge left and Nudge Right does not consider selected points or AIs, and i think it would be expected.

Anyway I believe user using "Script: mpl_Duplicate items bar relative" basically just wants to duplicate content, but since there is no simple and intuitive workflow to: marquee select any element → copy selection, this simple operation brings all sorts of unexpected behaviours.

Pasted from another thread:

Why are all the selected points not being selected in a single drag?



why Selected points dont move together?



why Selected AI and points dont move together and points even gets unselected after moving AI?



why Item and Ai and points dont move together since they all selected?



why selected item and AI don't copy together?




why Selected Item and Selected Ai dont stretch together?



why selected AI and Item edges dont move together?

__________________
🙏🏻

Last edited by deeb; 06-09-2025 at 09:12 PM.
deeb is online now   Reply With Quote
Old 06-10-2025, 12:28 AM   #5
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default

Quote:
Originally Posted by Justin View Post
Let me see if I understand this - you want ApplyNudge, when duplicating, to only duplicate the parts of the AI that overlap with the item, but not the parts that do not overlap?
right, just like if we move it by mouse drag when "automation follow items" enabled
__________________
My musicMPL Scripts discussionTelegram
mpl is offline   Reply With Quote
Old 06-10-2025, 05:10 AM   #6
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,542
Default

Quote:
Originally Posted by mpl View Post
right, just like if we move it by mouse drag when "automation follow items" enabled

hmm it does behave the same here, copying the whole AI; is there a setting I'm forgetting about that will cause it to only copy part of the AI?
Justin is offline   Reply With Quote
Old 06-11-2025, 09:58 AM   #7
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default

Quote:
Originally Posted by Justin View Post
hmm it does behave the same here, copying the whole AI; is there a setting I'm forgetting about that will cause it to only copy part of the AI?
Sorry I`m looking now and the problem is still here, but slightly different description. Forget about
Quote:
but doesn`t crop it to item boundaries.
It doesn`t crop AI when move and it is normal I think (although maybe it did cropping maybe somewhere while AI developement cycle so I remember it this way). However the behaviour of manual item drag and ApplyNudge is different:



Steps to reproduce:
1. create 1 bar long item
2. create exact same boundaries timing AI
3. enable "Automation follow items"

4a drag with mouse
> item is moved, AI is moved to same amount of time

4b run
Code:
    reaper.ApplyNudge( 0,--project, 
                0,--nudgeflag, 
                5,--nudgewhat, 
                16,--nudgeunits, 
                16,--value, 
                false,--reverse, 
                0)--copies )
> item is moved correctly, AI is not
__________________
My musicMPL Scripts discussionTelegram
mpl is offline   Reply With Quote
Old 06-13-2025, 05:39 PM   #8
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,542
Default

Quote:
Originally Posted by mpl View Post
Sorry I`m looking now and the problem is still here, but slightly different description. Forget about


It doesn`t crop AI when move and it is normal I think (although maybe it did cropping maybe somewhere while AI developement cycle so I remember it this way). However the behaviour of manual item drag and ApplyNudge is different:



Steps to reproduce:
1. create 1 bar long item
2. create exact same boundaries timing AI
3. enable "Automation follow items"

4a drag with mouse
> item is moved, AI is moved to same amount of time

4b run
Code:
    reaper.ApplyNudge( 0,--project, 
                0,--nudgeflag, 
                5,--nudgewhat, 
                16,--nudgeunits, 
                16,--value, 
                false,--reverse, 
                0)--copies )
> item is moved correctly, AI is not
Thanks, fixing!
Justin is offline   Reply With Quote
Old 06-14-2025, 01:19 AM   #9
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default

Quote:
Originally Posted by Justin View Post
Thanks, fixing!
Thank you, I also changed description a bit at first post.
__________________
My musicMPL Scripts discussionTelegram
mpl is offline   Reply With Quote
Old 06-14-2025, 02:28 AM   #10
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,542
Default

Quote:
Originally Posted by mpl View Post
Thank you, I also changed description a bit at first post.

yeah, in musical modes it was moving by "nudge amount in seconds" as QN, which was completely wrong!
Justin is offline   Reply With Quote
Old 06-15-2025, 09:30 PM   #11
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,526
Default

Thanks, it is fixed for 7.40+dev0615
__________________
My musicMPL Scripts discussionTelegram
mpl is offline   Reply With Quote
Reply

Thread Tools

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 04:39 AM.


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