Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Feature Requests

Reply
 
Thread Tools Display Modes
Old 04-04-2020, 03:04 PM   #1
Javier Robledo
Human being with feelings
 
Javier Robledo's Avatar
 
Join Date: Jul 2014
Posts: 637
Default Action For - Toggle Show/Hide all regions

Hi ¡¡¡

I do use regions a lot in my projects.

The main use is to define the section of the song.

When all regions are set, the screen results too dirty with all the regions lines, so it would be really nice to have an action like:

- Toggle Show/Hide all regions

Also markers if possible.

Thanks ¡¡¡

Javier Robledo is offline   Reply With Quote
Old 04-05-2020, 12:01 AM   #2
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Not really a solution (which is only up to REAPER devs), but you can remove/restore regions like that lua does:

(edited 11.04)
Code:
  function main()
    local retval, val = reaper.GetProjExtState( 0, 'hide regions', 'regparams')
    local has_hidden = val ~= ''
    
    s_out = ''
    sep = '|'
    local retval, num_markers, num_regions = reaper.CountProjectMarkers( 0 )
    if has_hidden == false then -- add to proj ext state
      for idx = num_markers+num_regions, 1, -1 do
        local retval, isrgn, pos, rgnend, name, markrgnindexnumber, color = reaper.EnumProjectMarkers3( 0, idx-1 )
        if isrgn then 
          if name == '' then name = '<empty>' end
          s_out = s_out..'<region>'..pos..sep..rgnend..sep..name..sep..markrgnindexnumber..sep..color..'</region>'
          reaper.DeleteProjectMarkerByIndex( 0, idx-1 )
        end
      end  
      reaper.SetProjExtState( 0, 'hide regions', 'regparams', s_out )
     else
      for regchunk in val:gmatch('<region>(.-)</region>') do
        local t = {}
        for var0 in regchunk:gmatch('[^%|]+') do if tonumber(var0) then var0 = tonumber(var0) end t[#t+1] = var0 end
                reaper.AddProjectMarker2( 0, true, t[1], t[2], t[3]:gsub('<empty>',''), t[4], t[5] )
      end
      reaper.SetProjExtState( 0, 'hide regions', 'regparams', '' )
    end
    --reaper.ShowConsoleMsg(s_out)
  end
  reaper.Undo_BeginBlock2( 0 )
  main()
  reaper.Undo_EndBlock2( 0, 'Remove/restore regions', -1 )

Last edited by mpl; 04-10-2020 at 10:40 PM.
mpl is offline   Reply With Quote
Old 04-07-2020, 08:43 AM   #3
Javier Robledo
Human being with feelings
 
Javier Robledo's Avatar
 
Join Date: Jul 2014
Posts: 637
Default

Hi mpl

Thanks a lot for your help ¡¡¡

It's works but does not resotre assigned colors.

You can have a look here: https://ibb.co/9vP1pvJ

Thanks Again

Javier Robledo is offline   Reply With Quote
Old 04-10-2020, 10:41 PM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Ah sorry, edited my post
mpl is offline   Reply With Quote
Old 04-11-2020, 01:27 AM   #5
Javier Robledo
Human being with feelings
 
Javier Robledo's Avatar
 
Join Date: Jul 2014
Posts: 637
Default

Quote:
Originally Posted by mpl View Post
Ah sorry, edited my post

THANKS A LOT ¡¡¡

Works Really Fine ¡¡¡

Javier Robledo is offline   Reply With Quote
Old 04-11-2020, 05:18 AM   #6
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,146
Default

Thanks to MPL for sharing

This can also be done with the following actions

SWS: Copy marker set to clipboard
SWS: Delete all regions / SWS: Delete all markers
SWS: Paste marker set from clipboard

combined into a step cycle action

Last edited by Buy One; 04-11-2020 at 06:48 AM.
Buy One is offline   Reply With Quote
Old 04-11-2020, 06:24 AM   #7
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Quote:
Originally Posted by Buy One View Post
Thanks to MPL for sharing

This can also be done with the following actions

SWS: Copy marker set to clipboard
SWS: Delete all regions
SWS: Paste marker set from clipboard

combined into a step cycle action
This isn`t persist btw. What I wrote is stored into RPP for further call, not to a clipboard.
mpl is offline   Reply With Quote
Old 04-11-2020, 06:44 AM   #8
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,146
Default

Quote:
Originally Posted by mpl View Post
This isn`t persist btw. What I wrote is stored into RPP for further call, not to a clipboard.
Thanks for clarifying, for someone who doesn't read the code it's not immediately obvious.

Last edited by Buy One; 04-11-2020 at 07:42 AM.
Buy One is offline   Reply With Quote
Old 04-11-2020, 07:09 AM   #9
akademie
Human being with feelings
 
Join Date: Mar 2007
Posts: 4,018
Default

Thanks mpl,
it can find its way to a better workflow for some, definitely.

Last edited by akademie; 04-11-2020 at 07:58 AM. Reason: typo
akademie is offline   Reply With Quote
Old 04-11-2020, 08:15 AM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

How stable is it with Ripple-Editing taking place after hiding?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-11-2020, 08:25 AM   #11
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,268
Default

the solution is to use items or empty items as placeholders for markers/regions. Because when you do ripple editing the items are also moved.
Like in my script Region Tracks.
heda is offline   Reply With Quote
Old 04-11-2020, 09:10 PM   #12
Javier Robledo
Human being with feelings
 
Javier Robledo's Avatar
 
Join Date: Jul 2014
Posts: 637
Default

Thanks Heda ¡¡¡

Javier Robledo 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 03:44 PM.


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