4PointCutting: Restore arranger viewport after edit
This commit is contained in:
		
							parent
							
								
									41572c4f84
								
							
						
					
					
						commit
						66bca38638
					
				| @ -12,6 +12,8 @@ local stored_timeSelStart = 0 | ||||
| local stored_timeSelEnd = 0 | ||||
| local stored_sel_tracks = {} | ||||
| local stored_sel_items = {} | ||||
| local stored_view_start = 0 | ||||
| local stored_view_end = 0 | ||||
| local mark_srcin_pos = -1 | ||||
| local mark_srcin_id = -1 | ||||
| local mark_srcout_pos = -1 | ||||
| @ -26,6 +28,12 @@ function msg(m) | ||||
|     reaper.ShowConsoleMsg(tostring(m) .. "\n") | ||||
| end | ||||
| 
 | ||||
| -- Round number | ||||
| function round(num, numDecimalPlaces) | ||||
|     local mult = 10^(numDecimalPlaces or 0) | ||||
|     return math.floor(num * mult + 0.5) / mult | ||||
| end | ||||
| 
 | ||||
| -- Selects the source tracks, or, if not stored in rpp, selects all tracks | ||||
| function select_src_tracks() | ||||
|     local tracks_str = '' | ||||
| @ -104,6 +112,9 @@ end | ||||
| 
 | ||||
| -- Do stuff before actual edits... | ||||
| reaper.Undo_BeginBlock() | ||||
| --store viewport off arranger | ||||
| stored_view_start, stored_view_end = reaper.GetSet_ArrangeView2(0, false, 0, 0) | ||||
| 
 | ||||
| -- Store cursor position, time selection, selected tracks, selected items | ||||
| stored_cursorPos = reaper.GetCursorPosition() | ||||
| stored_timeSelStart, stored_timeSelEnd = reaper.GetSet_LoopTimeRange(false, true, 0, 1, false) | ||||
| @ -140,5 +151,7 @@ for _, item in ipairs(stored_sel_items) do | ||||
|     reaper.SetMediaItemSelected(item, true) | ||||
| end | ||||
| reaper.GetSet_LoopTimeRange(true, true, stored_timeSelStart, stored_timeSelEnd, false) | ||||
| -- Restore view port of arranger | ||||
| reaper.GetSet_ArrangeView2(0, true, 0, 0, stored_view_start, stored_view_end) | ||||
| 
 | ||||
| reaper.Undo_EndBlock('4 point cut: Execute', 4) -- 4 is a flag for actions concerning items | ||||
| reaper.Undo_EndBlock('4 point cut: Execute', 4) -- 4 is a flag for actions concerning items | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user