Old 04-20-2021, 06:54 PM   #401
benmrx
Human being with feelings
 
benmrx's Avatar
 
Join Date: Aug 2010
Posts: 396
Default

Quote:
Originally Posted by daniellumertz View Post
Welcome to the reaper scripts please keep posting if you do something that would like to sharing
Will do!

Quote:
Originally Posted by Vagelis View Post
@Benrmx I have asked the devs multiple times to add these functions as native modifiers but never happened. Big thanks for these scripts
Hope these work out for you!
benmrx is offline   Reply With Quote
Old 04-21-2021, 01:30 AM   #402
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,797
Default

Quote:
Originally Posted by benmrx View Post
Hope these work out for you!
The script extend RE vertically is very useful, could you possibly add to reduce it as well to the track where the mouse is? And could you maybe add horizontal extend/reduce? Then it would work exactly as Cubase AS. Thanks again
Vagelis is offline   Reply With Quote
Old 04-25-2021, 02:46 PM   #403
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by amagalma View Post
Version that respects Snap to Grid setting:

amagalma_Create Razor Edit from edit cursor & last touched track (or selected envelope) to track (or envelope) under mouse cursor respecting Snap to Grid.lua


Assign scripts to key shortcuts.





Yes, until RE is official no RE scripts on ReaPack from me.
Is there a way to make it work with mouse left click + modifier (shift)?

Maybe someone can help with this: https://forum.cockos.com/showthread....42#post2436642
Skorobagatko is offline   Reply With Quote
Old 04-28-2021, 03:52 PM   #404
MrTsonts
Human being with feelings
 
MrTsonts's Avatar
 
Join Date: Apr 2019
Location: Ukraine, Kyiv
Posts: 173
Default

Quote:
Originally Posted by Embass View Post


Code:
-- copy children items to all identically named parent items
-- author: embass
-- v0.1
local mouse_x, mouse_y = reaper.GetMousePosition()
local media_item_count = reaper.CountSelectedMediaItems(0);
if media_item_count ~= 1 then  
	reaper.TrackCtl_SetToolTip("Select 1 media item", mouse_x + 15, mouse_y, true)
	return -- terminate script
end
local media_item = reaper.GetSelectedMediaItem(0, 0); if media_item == nil then return end -- terminate script
local media_item_len = reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH"); if media_item_len == 0 then return end -- terminate script
local media_item_start = reaper.GetMediaItemInfo_Value(media_item, "D_POSITION")
local media_item_end = media_item_start + media_item_len
local track = reaper.GetMediaItem_Track(media_item); if track == nil then return end -- terminate script
if reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH") ~= 1 then 
	reaper.TrackCtl_SetToolTip("Select item on parent track", mouse_x + 15, mouse_y, true)
	return -- terminate script 
end
local track_count = reaper.CountTracks(0)
if track_count == reaper.GetMediaTrackInfo_Value(track, "IP_TRACKNUMBER") then return end -- terminate script, item on last track
local take = reaper.GetActiveTake(media_item); if take == nil then return end -- terminate script
local take_name = reaper.GetTakeName(take); if take_name == nil then return end -- terminate script
local media_items = {} -- media items with the same name
for i = 0, reaper.CountTrackMediaItems(track) - 1 do
	local media_item = reaper.GetTrackMediaItem(track, i)
	if reaper.GetMediaItemInfo_Value(media_item, "D_LENGTH") > 0 then
		local take = reaper.GetActiveTake(media_item)
		if take ~= nil then
			if take_name == reaper.GetTakeName(take) then
				table.insert(media_items, media_item)
			end
		end
	end
end
if #media_items < 2 then return end -- terminate script
function get_children_tracks(parent_track) --> children tracks
	local children_tracks = {}
	local track_count = reaper.CountTracks(0)
	local parent_track_depth = reaper.GetTrackDepth(parent_track)     
	local track_index = reaper.GetMediaTrackInfo_Value(parent_track, "IP_TRACKNUMBER") -- next track index
	for i = track_index, track_count - 1 do
		local track = reaper.GetTrack(0, i)
		local track_depth = reaper.GetTrackDepth(track)
		if track_depth > parent_track_depth then table.insert(children_tracks, track)
		else break -- exit loop
		end
	end
	return children_tracks
end
local children_tracks = get_children_tracks(track); if #children_tracks == 0 then return end -- terminate script
local track1 = children_tracks[1] -- first child
local edit_cursor_pos = reaper.GetCursorPosition() -- save
local trim_state = reaper.GetToggleCommandState(42421) -- Options: Always trim content behind razor edits
reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
	reaper.Main_OnCommand(40309, 0) -- Set ripple editing off
	if trim_state == 0 then reaper.Main_OnCommand(42421, 0); restore_trim = true end -- set trim content behind area
	local hidden_tracks = {} -- save
	for i, track in ipairs(children_tracks) do
		if not reaper.IsTrackVisible(track, false) then
			hidden_tracks[track] = true
			reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 1) -- make visible
		end 
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	local str_track_razor_edits = string.format([[%s %s '']], media_item_start, media_item_end)
	for i, track in ipairs(children_tracks) do
		reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", str_track_razor_edits, true) -- set
	end
	reaper.Main_OnCommand(40060, 0) -- Item: Copy selected area of items
	reaper.SetOnlyTrackSelected(track1) -- set last touched track
	for i, item in ipairs(media_items) do
		if item ~= media_item then
			local item_start = reaper.GetMediaItemInfo_Value(item, "D_POSITION")
			reaper.SetEditCurPos(item_start, false, false)
			reaper.Main_OnCommand(42398, 0) --Item: Paste items/tracks
		end
	end
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	reaper.SelectAllMediaItems(0, false) -- unselect all items
	reaper.SetEditCurPos(edit_cursor_pos, false, false) -- restore
	for track in pairs(hidden_tracks) do
		reaper.SetMediaTrackInfo_Value(track, "B_SHOWINTCP", 0) -- hide
	end
	reaper.SetOnlyTrackSelected(track) -- parent track
	reaper.SetMediaItemSelected(media_item, true) -- restore media item selection
	if restore_trim then reaper.Main_OnCommand(42421, 0) end -- restore
reaper.Undo_EndBlock("Copy items", -1)
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
Hello. I am very sorry, but your script began to work incorrectly. Can it be repaired?

MrTsonts is offline   Reply With Quote
Old 04-29-2021, 02:52 AM   #405
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by Embass View Post
does this work on OSX ?
I run the script but seems that black magic didnt happen


I alrdy assign Razor Edit to my mouse modifier and import those 3 scripts too.
perhaps thrrs somethin else I need to configure 1st ?
todoublez is offline   Reply With Quote
Old 05-03-2021, 05:06 AM   #406
Pink Wool
Human being with feelings
 
Pink Wool's Avatar
 
Join Date: Apr 2020
Posts: 1,501
Default

Quote:
Originally Posted by Pink Wool View Post
I'm sorry but I tried looking through the thread and couldn't figure out if this script has been released or not?
I assume no?

(•_•)
Pink Wool is offline   Reply With Quote
Old 05-06-2021, 03:38 PM   #407
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: HH
Posts: 916
Default

Quote:
Originally Posted by sonictim View Post


I'm not sure what to tell you.. there it is in my reapack... As I mentioned before, the script is attached in the post above, so you don't need reapack to get it...
thank you, great script! Is there a way that crossfades created with your script follow the default crossfade shape set in the preferences?

EDIT:

Ah, forget it. Found the global variables.

Last edited by Zeno; 05-06-2021 at 03:54 PM.
Zeno is offline   Reply With Quote
Old 05-06-2021, 04:17 PM   #408
OLSHALOM
Human being with feelings
 
Join Date: Sep 2019
Location: Austria
Posts: 443
Default

Quote:
Originally Posted by todoublez View Post
does this work on OSX ?
I run the script but seems that black magic didnt happen


I alrdy assign Razor Edit to my mouse modifier and import those 3 scripts too.
perhaps thrrs somethin else I need to configure 1st ?

On 10.13.6, it's a yes for me.

I do it like this:
select a track which should be the destination.track
Run action: Script: [em] set destination track (swipe comping) .lua
Run action: Script: Enable swipe comping mode (toggle).lua
(I think the order of the two actions doesn't matter)
make a razor-selections.
OLSHALOM is offline   Reply With Quote
Old 05-06-2021, 11:04 PM   #409
sonictim
Human being with feelings
 
sonictim's Avatar
 
Join Date: Feb 2020
Location: Los Angeles
Posts: 463
Default

Quote:
Originally Posted by Zeno View Post
thank you, great script! Is there a way that crossfades created with your script follow the default crossfade shape set in the preferences?

EDIT:

Ah, forget it. Found the global variables.
Originally I wanted it to work as you described, but couldn’t figure out how to do it. I since have figured it out, but global variables seem to be working fine fir me and haven’t bothered to change it. Glad it works fir you too!
__________________
My Reapack Repository: I write scripts for my own personal use.
I offer no support, but if you find one that helps you, go for it!
sonictim is offline   Reply With Quote
Old 05-06-2021, 11:07 PM   #410
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by OLSHALOM View Post
On 10.13.6, it's a yes for me.

I do it like this:
select a track which should be the destination.track
Run action: Script: [em] set destination track (swipe comping) .lua
Run action: Script: Enable swipe comping mode (toggle).lua
(I think the order of the two actions doesn't matter)
make a razor-selections.
Thx for the info !
todoublez is offline   Reply With Quote
Old 05-07-2021, 12:27 AM   #411
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

Quote:
Originally Posted by todoublez View Post
Thx for the info !
you might want to check my version of it.

https://forum.cockos.com/showpost.ph...&postcount=329
daniellumertz is online now   Reply With Quote
Old 05-07-2021, 07:58 AM   #412
todoublez
Human being with feelings
 
todoublez's Avatar
 
Join Date: Aug 2019
Location: beijing
Posts: 612
Default

Quote:
Originally Posted by daniellumertz View Post
you might want to check my version of it.

https://forum.cockos.com/showpost.ph...&postcount=329
Impressive !
I'll go try that out !
todoublez is offline   Reply With Quote
Old 06-05-2021, 07:13 AM   #413
nikki5000
Human being with feelings
 
Join Date: Nov 2020
Posts: 138
Default

Quote:
Originally Posted by Embass View Post

thank you for the great script!!

Question: At the moment you can only swipe comp using the „Create Razor Edit Area“ Mouse Modifier from the Arrange section.

Would it be possible to modify the script so you can use the mouse modifier from the Track section instead?

This would be so helpful!
nikki5000 is offline   Reply With Quote
Old 07-16-2021, 10:07 AM   #414
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,770
Default Quick Swiping Takes

Does anyone know if it is possible to create quick swipe comping on a SINGLE TRACK of TAKES ? I'm looking for 2 features.

1. swipe/highlight with mouse on a section of a take to select that section to play.

2. click on point in take to switch selection from another take to current clicked take

I have wanted this feature for many years and it seems now there are more reaper functions that might make this possible. I'm happy to test in any way. Thanks.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is online now   Reply With Quote
Old 07-18-2021, 12:50 AM   #415
nikki5000
Human being with feelings
 
Join Date: Nov 2020
Posts: 138
Default

Quote:
Originally Posted by Coachz View Post
Does anyone know if it is possible to create quick swipe comping on a SINGLE TRACK of TAKES ? I'm looking for 2 features.

1. swipe/highlight with mouse on a section of a take to select that section to play.

2. click on point in take to switch selection from another take to current clicked take

I have wanted this feature for many years and it seems now there are more reaper functions that might make this possible. I'm happy to test in any way. Thanks.
great point! This would be the best feature!
nikki5000 is offline   Reply With Quote
Old 07-18-2021, 02:36 AM   #416
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Quote:
Originally Posted by Coachz View Post
Does anyone know if it is possible to create quick swipe comping on a SINGLE TRACK of TAKES ? I'm looking for 2 features.

1. swipe/highlight with mouse on a section of a take to select that section to play.

2. click on point in take to switch selection from another take to current clicked take

I have wanted this feature for many years and it seems now there are more reaper functions that might make this possible. I'm happy to test in any way. Thanks.
Yes its possible. I've made it in my TrackVersions script way before RE was implemented (even my Area51). Can be ported

https://forum.cockos.com/showpost.ph...&postcount=258
Sexan is offline   Reply With Quote
Old 07-18-2021, 03:24 AM   #417
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Quote:
Originally Posted by daniellumertz View Post
I did a GUI for Embass script comping!

I changed somethings also in how it works and leave as optional to work just like Embass + GUI or using mine version (the principal difference is that mine copy using RE options so if you have envelope follow RE it will be pasted to! )

Showcase:

DSL Mode (notice it use RE options so envelopes may be comp with items) (notice a RE on a silent part will select a silent part)


Embass mode: (won't select envelopes or silent areas (is this best ?(I don't know (that is why I leave the two modes(just for you(decide))))))



Now you can also comp to more than one track



Install:
Import my repository in reapack https://raw.githubusercontent.com/da...ster/index.xml

or download the files here https://github.com/daniellumertz/Dan...t%20Comp%20GUI

You NEED SWS to work with! https://www.sws-extension.org/
You NEED JS extension to work with! https://forum.cockos.com/showthread.php?t=212174
You NEED ImGUI to work with! https://forum.cockos.com/showthread.php?t=250419
(You DON'T need embass script it was incoporated into mine!)

Nitpick:
In Dsl Mode if you accidently selected more than one track with the razor edit it will also copy it to the track bellow your dest track. Embass and DSL mode create 2 undopoints instead of one, didn't found how to overcome this.

installed but I get this: Comp Razor Edit Embass.lua:371: 'reaper.ImGui_CreateContext': expected 2 arguments maximum
permeke is offline   Reply With Quote
Old 07-18-2021, 04:21 AM   #418
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,770
Default

Quote:
Originally Posted by Sexan View Post
Yes its possible. I've made it in my TrackVersions script way before RE was implemented (even my Area51). Can be ported

https://forum.cockos.com/showpost.ph...&postcount=258
Thanks for the link but can you please show an example with multiple takes?
__________________
Track Freezing Scripts

Coachz Repo
Coachz is online now   Reply With Quote
Old 07-18-2021, 09:08 AM   #419
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

Quote:
Originally Posted by permeke View Post
installed but I get this: Comp Razor Edit Embass.lua:371: 'reaper.ImGui_CreateContext': expected 2 arguments maximum
Hey! This is because imgui recived a update recently I will correct this ! Thanks for pointing out, it was in my todo will try to do today, then you only need to resync with reapack and all will be good
daniellumertz is online now   Reply With Quote
Old 07-18-2021, 09:12 AM   #420
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

awesome
permeke is offline   Reply With Quote
Old 07-18-2021, 10:47 AM   #421
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,597
Default

Quote:
Originally Posted by Coachz View Post
Thanks for the link but can you please show an example with multiple takes?
It would be done similar with takes ,same principle used:
1. Track which take is under cursor or selected
2. Get media source, clone it
3. Create lane above or below it (some hacking needed)
4. Add media item to that lane
5. Copy new source to it, trim to selection

I just wanted to show that its possible to do it. I did not have any RE at my disposal and made it with time selection (extreme voodoo and lane hacking).
Sexan is offline   Reply With Quote
Old 07-18-2021, 10:57 AM   #422
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,770
Default

Quote:
Originally Posted by Sexan View Post
It would be done similar with takes ,same principle used:
1. Track which take is under cursor or selected
2. Get media source, clone it
3. Create lane above or below it (some hacking needed)
4. Add media item to that lane
5. Copy new source to it, trim to selection

I just wanted to show that its possible to do it. I did not have any RE at my disposal and made it with time selection (extreme voodoo and lane hacking).
Ahh, my mistake, I thought the scripting was done. Is there anyway to get you interested in making this script ? I would be happy to test !

__________________
Track Freezing Scripts

Coachz Repo
Coachz is online now   Reply With Quote
Old 07-18-2021, 11:28 AM   #423
Dark River
Human being with feelings
 
Join Date: Jul 2018
Location: NC
Posts: 99
Default Error running the script

Quote:
Originally Posted by daniellumertz View Post
you might want to check my version of it.

https://forum.cockos.com/showpost.ph...&postcount=329
Hi Daniell, I installed your embass mod a few weeks ago - very cool!

Today I installed the latest dev version of Reaper (July 17th) as Portable (complete with RePack, SWS, JS API and ImGUI UserPlugins) to check out the 'media lanes' feature and thought I'd try your comping script there.

Running the script I received the following error:

Comp Razor Edit Embass.lua:371: 'reaper.ImGui_CreateContext': expected 2 arguments maximum

I then went back to my full install of Reaper (6.32) to see what might be different - but I am now getting the same error there.

Something is amiss...

Thanks in advance for your attention.

dark river

EDIT: OH! I just saw your reply to this issue in the thread above - sorry to miss that - thank you.
__________________
Windows 7, i7, 16GB ram, RME RayDAT
Windows 10, i7, 16GB ram, Focusrite 2i2
Dark River is online now   Reply With Quote
Old 07-18-2021, 12:00 PM   #424
nikki5000
Human being with feelings
 
Join Date: Nov 2020
Posts: 138
Default

Quote:
Originally Posted by Coachz View Post
Ahh, my mistake, I thought the scripting was done. Is there anyway to get you interested in making this script ? I would be happy to test !

I would love to pay for a script that offers the same Take / swipe comping functionalities as Logic:

1. see the number of the take you are recording
2. automatically convert takes to track “comp” folder after recording
3. click on point in take to switch selection from another take to current clicked take
4. swipe/highlight with mouse on a section of a take to select that section to play.
5. Copy selected area to the comp destination track using RE of the „track“ mouse modifier and/or media item bottom half (embass only offers the arrange modifier)
6. auto-mute unselected areas in this comp folder
7. fast way to collapse/uncollapse the comp folder

Last edited by nikki5000; 07-18-2021 at 01:16 PM.
nikki5000 is offline   Reply With Quote
Old 07-18-2021, 01:37 PM   #425
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

That is all right Dark River and permeke. I updated the code, sync reapack packages. and it should work, if not please reply to me!
daniellumertz is online now   Reply With Quote
Old 07-18-2021, 01:50 PM   #426
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Oh yes Sir, it's working and it's pretty good !!

thanks
permeke is offline   Reply With Quote
Old 07-18-2021, 02:08 PM   #427
Dark River
Human being with feelings
 
Join Date: Jul 2018
Location: NC
Posts: 99
Default

All good here. Thankyou Daniel
__________________
Windows 7, i7, 16GB ram, RME RayDAT
Windows 10, i7, 16GB ram, Focusrite 2i2
Dark River is online now   Reply With Quote
Old 08-05-2021, 01:57 PM   #428
OLSHALOM
Human being with feelings
 
Join Date: Sep 2019
Location: Austria
Posts: 443
Default Razor-selection for grouped items (independent from parent-tracks)

Would it be possible to have a script which let you razor-select an area in all grouped-items,
even when the tracks are no childs of the same parent-track, or are child tracks of independent parent-tracks, or the tracks are not lined up below each other.


Workflow:

-make a razor-selection on one item
-on all other items grouped with this one the razor-selection appears too.

Next step would be great:
Would it then be possible, to move this razor-selections to each parent-track for each child-track?


I can put money in for it.
If anybody is interested to do this, please let me know.
OLSHALOM is offline   Reply With Quote
Old 12-06-2021, 07:53 AM   #429
AZpercussion
Human being with feelings
 
Join Date: Oct 2019
Location: Moscow / Tbilisi
Posts: 909
Default

From yesterday we have API functions to work with media item lanes, existing in pre-realise still.
So I decide to make small update for BirdBird's function GetRazorEdits.
I left the old code there for backward compatibility.
Now we have areaTop and areaBottom table values to work with.

Code:
function GetRazorEdits()
    local trackCount = reaper.CountTracks(0)
    local areaMap = {}
    for i = 0, trackCount - 1 do
        local track = reaper.GetTrack(0, i)
        local mode = reaper.GetMediaTrackInfo_Value(track,"I_FREEMODE")
        if mode ~= 0 then
        ----NEW WAY----
        
          local ret, area = reaper.GetSetMediaTrackInfo_String(track, 'P_RAZOREDITS_EXT', '', false)
          
        if area ~= '' then
            --PARSE STRING and CREATE TABLE
            local TRstr = {}
            
            for s in area:gmatch('[^,]+')do
              table.insert(TRstr, s)
            end
            
            for i=1, #TRstr do
            
              local rect = TRstr[i]
              TRstr[i] = {}
              for j in rect:gmatch("%S+") do
                table.insert(TRstr[i], j)
              end
              
            end
        
            --FILL AREA DATA
            local i = 1
            while i <= #TRstr do
                --area data
                local areaStart = tonumber(TRstr[i][1])
                local areaEnd = tonumber(TRstr[i][2])
                local GUID = TRstr[i][3]
                local areaTop = tonumber(TRstr[i][4])
                local areaBottom = tonumber(TRstr[i][5])
                local isEnvelope = GUID ~= '""'

                --get item/envelope data
                local items = {}
                local envelopeName, envelope
                local envelopePoints
                
                if not isEnvelope then
                    items = GetItemsInRange(track, areaStart, areaEnd, areaTop, areaBottom)
                else
                    envelope = reaper.GetTrackEnvelopeByChunkName(track, GUID:sub(2, -2))
                    local ret, envName = reaper.GetEnvelopeName(envelope)

                    envelopeName = envName
                    envelopePoints = GetEnvelopePointsInRange(envelope, areaStart, areaEnd)
                end

                local areaData = {
                    areaStart = areaStart,
                    areaEnd = areaEnd,
                    areaTop = areaTop,
                    areaBottom = areaBottom,
                    
                    track = track,
                    items = items,
                    
                    --envelope data
                    isEnvelope = isEnvelope,
                    envelope = envelope,
                    envelopeName = envelopeName,
                    envelopePoints = envelopePoints,
                    GUID = GUID:sub(2, -2)
                }

                table.insert(areaMap, areaData)

                i=i+1
            end
          end
        else  
        
        ---OLD WAY for backward compatibility-------
        
          local ret, area = reaper.GetSetMediaTrackInfo_String(track, 'P_RAZOREDITS', '', false)
          
          if area ~= '' then
            --PARSE STRING
            local str = {}
            for j in string.gmatch(area, "%S+") do
                table.insert(str, j)
            end
        
            --FILL AREA DATA
            local j = 1
            while j <= #str do
                --area data
                local areaStart = tonumber(str[j])
                local areaEnd = tonumber(str[j+1])
                local GUID = str[j+2]
                local isEnvelope = GUID ~= '""'
        
                --get item/envelope data
                local items = {}
                local envelopeName, envelope
                local envelopePoints
                
                if not isEnvelope then
                    items = GetItemsInRange(track, areaStart, areaEnd)
                else
                    envelope = reaper.GetTrackEnvelopeByChunkName(track, GUID:sub(2, -2))
                    local ret, envName = reaper.GetEnvelopeName(envelope)
        
                    envelopeName = envName
                    envelopePoints = GetEnvelopePointsInRange(envelope, areaStart, areaEnd)
                end
        
                local areaData = {
                    areaStart = areaStart,
                    areaEnd = areaEnd,
                    
                    track = track,
                    items = items,
                    
                    --envelope data
                    isEnvelope = isEnvelope,
                    envelope = envelope,
                    envelopeName = envelopeName,
                    envelopePoints = envelopePoints,
                    GUID = GUID:sub(2, -2)
                }
        
                table.insert(areaMap, areaData)
        
                j = j + 3
            end
          end  ---OLD WAY END
        end
    end

    return areaMap
end
AZpercussion is offline   Reply With Quote
Old 04-20-2022, 07:19 AM   #430
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 923
Default



Code:
-- embass script (2022 04 20)
-- glue automation

-- 1. set area selection
-- 2. run script

local track_count = reaper.CountTracks(0); if track_count == 0 then return end -- exit

local tracks, N = {}, 0
for i = 0, track_count - 1 do
	local track = reaper.GetTrack(0, i)
	if reaper.IsTrackVisible(track, false) then
		local ok, str_track_razor_edits = reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", "", false) -- get 
    	if ok and str_track_razor_edits ~= "" then
    		local razor_edits, n = {}, 1  
			for area_start, area_end, env_guid in str_track_razor_edits:gmatch([[([%d%.]+) ([%d%.]+) "([^"]*)"]]) do
				if env_guid ~= "" then
					local env = reaper.GetTrackEnvelopeByChunkName(track, env_guid)
					if env ~= nil then
						local chunk_ok, env_chunk = reaper.GetEnvelopeStateChunk(env, "", false)
						if chunk_ok and string.find(env_chunk, "VIS 1") then -- env visible
							razor_edits[n] = string.format([[%s %s "%s" ]], area_start, area_end, env_guid); n=n+1
						end
					end
				end
			end
			if n > 1 then tracks[track] = table.concat(razor_edits, ""); N=N+1 end
    	end
	end
end

if N == 0 then return end -- exit

function set_razor_edits(tracks)
	for track, str_track_razor_edits in pairs(tracks) do		
		reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", str_track_razor_edits, true) -- set
	end
end

reaper.PreventUIRefresh(1)
reaper.Undo_BeginBlock()
	reaper.Main_OnCommand(42406, 0) -- Razor edit: Clear all areas
	set_razor_edits(tracks)
	reaper.Main_OnCommand(40061, 0) -- Item: Split items at time selection/area sel
	reaper.Main_OnCommand(42088, 0) -- Envelope: Delete automation items, preserve points
	set_razor_edits(tracks)
	reaper.Main_OnCommand(42082, 0) -- Envelope: Insert automation item
reaper.Undo_EndBlock("glue automation", -1)
reaper.PreventUIRefresh(-1)
reaper.UpdateArrange()
Embass is offline   Reply With Quote
Old 04-20-2022, 08:00 PM   #431
Embass
Human being with feelings
 
Embass's Avatar
 
Join Date: Jan 2014
Posts: 923
Default



Code:
-- embass script (2022 04 21)
-- razor area left click action

local actions = {

	-- you can get action id from action list

	-- context: media lane razor area
	[0] = "40214", -- Insert new MIDI item...

	-- context: env lane razor area
	[1] = "42082", -- Envelope: Insert automation item

}

local track, context = reaper.GetTrackFromPoint(reaper.GetMousePosition()); if track == nil then return end -- exit
local action = actions[context]; if action == nil then return end -- exit
action = reaper.NamedCommandLookup(action); if action == 0 then return end -- exit
reaper.Main_OnCommand(action, 0)
Embass is offline   Reply With Quote
Old 04-23-2022, 04:09 PM   #432
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Quote:
Originally Posted by daniellumertz View Post
That is all right Dark River and permeke. I updated the code, sync reapack packages. and it should work, if not please reply to me!
I get this now :

Comp Razor Edit Embass.lua:361: ImGui_InputText: ImGui assertion failed: id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"


any idea ?
permeke is offline   Reply With Quote
Old 04-23-2022, 05:19 PM   #433
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

Thanks for the report, try again!
daniellumertz is online now   Reply With Quote
Old 04-24-2022, 03:04 PM   #434
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

all clear, thanks
permeke is offline   Reply With Quote
Old 04-26-2022, 12:43 PM   #435
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 588
Default

Quote:
Originally Posted by Embass View Post
still something strange with it ( don't know if some other scripts also have this behaviour.

Tracks don't null after comping+ phase reverse on a track.
I did the test with two tracks, when I drag command an item to the comp track it perfectly nulls.
weird.
permeke is offline   Reply With Quote
Old 10-02-2022, 02:31 AM   #436
jubalakub
Human being with feelings
 
Join Date: Aug 2020
Posts: 11
Default

Quote:
Originally Posted by daniellumertz View Post
Thanks for the report, try again!
I also get the same error
"Comp Razor Edit Embass.lua:361: ImGui_InputText: ImGui assertion failed: id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!""

Edit: v1.4.2 fixed the errors thank you.

Last edited by jubalakub; 10-06-2022 at 01:14 AM.
jubalakub is offline   Reply With Quote
Old 10-20-2022, 04:07 AM   #437
mozart999uk
Human being with feelings
 
Join Date: Nov 2010
Posts: 1,722
Default

Guys and gals. Hope you don't mind me diverting the thread a little.

Is there a way / pref / script for razor edit that upon making a selection, automatically also selects all envelope points (within the razor selection) under a media item, when the envelope lanes are not visible?

So; make a razor edit on a media item, copy drag it to somewhere else and all the envelope points copy with it?

At the moment, the only way I can see, is to make visible all used envelope lanes on the track and include them in the razor selection...
mozart999uk is offline   Reply With Quote
Old 03-10-2023, 11:53 AM   #438
x-tropic
Human being with feelings
 
x-tropic's Avatar
 
Join Date: May 2020
Location: Yevpatoria
Posts: 30
Default fix

How to fix it?
Attached Images
File Type: png Снимок экрана 2023-03-10.png (135.6 KB, 46 views)
x-tropic is offline   Reply With Quote
Old 03-10-2023, 12:42 PM   #439
x-tropic
Human being with feelings
 
x-tropic's Avatar
 
Join Date: May 2020
Location: Yevpatoria
Posts: 30
Default

Quote:
Originally Posted by x-tropic View Post
How to fix it?
Sorry, it about this:

Code:
-- script by amagalma 8/10/20

-- Get time selection
local tsS, tsE = reaper.GetSet_LoopTimeRange2( 0, 0, 0, 0, 0, 0 )
if tsS == tsE then return end

local tsL = tsE - tsS

local t = {}
local sel_tracks = {}
local track_cnt = reaper.CountTracks(0)
local a = 0
local tr = 0
for i = 0, track_cnt - 1 do
  local track = reaper.GetTrack(0, i)
  -- Store selected tracks
  if reaper.IsTrackSelected( track ) then
    tr = tr + 1
    sel_tracks[tr] = track
    reaper.SetTrackSelected( track, false )
  end
  local _, area = reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", "", false)
  -- Store area selections
  if area ~= "" then
    a = a + 1
    local areaS, areaE = area:match("(%S+) (%S+)")
    areaS, areaE = tonumber(areaS), tonumber(areaE)
    t[a] = {tr = track, st = areaS, en = areaE, len = areaE-areaS, ar = area}
    reaper.GetSetMediaTrackInfo_String(track, "P_RAZOREDITS", "", true)
  end
end

if #t == 0 then return end

-- Store edit cursor position
local cur_pos = reaper.GetCursorPositionEx( 0 )

-- Do the thing
reaper.Undo_BeginBlock2( 0 )
reaper.PreventUIRefresh( 1 )

for n = 1, #t do
  reaper.GetSetMediaTrackInfo_String(t[n].tr, "P_RAZOREDITS", t[n].ar, true)
  reaper.SetOnlyTrackSelected( t[n].tr )
  reaper.Main_OnCommand(40914, 0) -- Set first selected track as last touched track
  reaper.Main_OnCommand(40307, 0) -- Cut selected area of items
  local times, fraction = math.modf(tsL/t[n].len)
  reaper.SetEditCurPos2( 0, tsS, false, false )
  if times > 0 then
    for i = 1, times do
      reaper.Main_OnCommand(42398, 0) -- Paste items/tracks
    end
  end
  if fraction > 0 then
    local _, area = reaper.GetSetMediaTrackInfo_String(t[n].tr, "P_RAZOREDITS", "", false)
    local a,c = area:match("(%S+) %S+ (%S+)")
    reaper.GetSetMediaTrackInfo_String(t[n].tr, "P_RAZOREDITS",
                    string.format("%f %f %s", a, a + (t[n].len * fraction), c), true)
    reaper.Main_OnCommand(40060, 0) -- Copy selected area of items
    reaper.Main_OnCommand(42398, 0) -- Paste items/tracks
  end
  reaper.GetSetMediaTrackInfo_String(t[n].tr, "P_RAZOREDITS", "", true)
end

-- Restore track selection
reaper.SetTrackSelected( t[#t].tr, false )
for i = 1, #sel_tracks do
  reaper.SetTrackSelected( sel_tracks[i], true )
end

-- Restore edit cursor position
reaper.SetEditCurPos2( 0, cur_pos, false, false )

-- Create undo
reaper.PreventUIRefresh( -1 )
reaper.UpdateArrange()
-- "Fill time selection with looped contents of razor edits"
reaper.Undo_EndBlock2( 0, "Duplicate contents of razor edits to fill tracks in loop points", 1|4|8 )
x-tropic is offline   Reply With Quote
Old 03-10-2023, 01:41 PM   #440
x-tropic
Human being with feelings
 
x-tropic's Avatar
 
Join Date: May 2020
Location: Yevpatoria
Posts: 30
Default 123

please help
Attached Images
File Type: gif bug2.gif (147.1 KB, 47 views)
x-tropic 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 05:37 PM.


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