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

Reply
 
Thread Tools Display Modes
Old 11-13-2018, 12:23 PM   #1
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default How to refresh Region Render Matrix -- aka what the hell is (HWND hwnd)??

Hi guys,

I wrote a script to populate the Render Matrix with populated regions per track. Works great except sometimes I have to click on the Render Matrix dock to refresh it even though I have these at ehe end of my script:

Code:
  reaper.PreventUIRefresh(-1)
  reaper.DockWindowRefresh()
  reaper.Undo_EndBlock("Populated Region Render Matrix",-1)  
  reaper.UpdateArrange()
I think I need this command maybe?

reaper.DockWindowRefreshForHWND( hwnd )

What is HWND??

Thanks for any help.

P.S. I looked over the docs but must have overlooked something... couldn't find definitions of HWND... just references.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.

Last edited by Thonex; 11-13-2018 at 12:34 PM.
Thonex is offline   Reply With Quote
Old 11-13-2018, 12:55 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Have you tried using the (seemingly) equivalent function which doesn't take a HWND? (not sure if this works)

DockWindowRefresh()

Generally speaking afaik a HWND is a handle (or specific, 'typed' pointer) to a window ('window handle').
E.g. you can get the HWND of Reaper's main window with GetMainHwnd()

I don't know what kind of HWND DockWindowRefreshForHWND expects though.

Last edited by nofish; 11-13-2018 at 01:02 PM.
nofish is offline   Reply With Quote
Old 11-13-2018, 01:06 PM   #3
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by nofish View Post
Have you tried using the (seemingly) equivalent function which doesn't take a HWND? (not sure if this works)

DockWindowRefresh()
Thanks nofish,

Yeah... I tried that (see second line of code in my example on the OP).

No dice.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-13-2018, 01:08 PM   #4
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Missed that, sorry.
No other idea then unfortunately.
nofish is offline   Reply With Quote
Old 11-13-2018, 01:09 PM   #5
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by nofish View Post
Missed that, sorry.
No other idea then unfortunately.
No worries... I even tried putting that line as the last line of update code in the script... no luck.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-13-2018, 01:58 PM   #6
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

You can get the HWND of the Region Render Matrix window with this:
Code:
w = reaper.JS_Window_Find( "Region Render Matrix", true )
You need the js_ReaScriptAPI extension for this.

Then try:
Code:
reaper.DockWindowRefreshForHWND(w)
and see if it works...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 11-13-2018, 02:35 PM   #7
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by amagalma View Post
You can get the HWND of the Region Render Matrix window with this:
Code:
w = reaper.JS_Window_Find( "Region Render Matrix", true )
You need the js_ReaScriptAPI extension for this.

Then try:
Code:
reaper.DockWindowRefreshForHWND(w)
and see if it works...
Thank amagalma,

Yeah... I tried that too and I get the same behavior. I installed that JS extension as you said.. I get no errors, but I still have to hover over the Render Matrix window to get it to refresh.

I'm wondering if this is a Mac thing.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-13-2018, 04:33 PM   #8
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

I have a script pack with region render matrix and it updates fine,


see screenshot there:


https://www.extremraym.com/en/downlo...region-matrix/


Im awqy from the code I dont remember how I did the refresh part, but it is possible without the HWD thing.
X-Raym is offline   Reply With Quote
Old 11-13-2018, 04:58 PM   #9
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by X-Raym View Post
I have a script pack with region render matrix and it updates fine,


see screenshot there:


https://www.extremraym.com/en/downlo...region-matrix/


Im awqy from the code I dont remember how I did the refresh part, but it is possible without the HWD thing.
Nice one X-Raym!

Yeah... I already scripted my own version LOL.... works perfectly... except for the refresh. Now it's more of on OCD issue/mystery for me

So far I've tried:

• reaper.DockWindowRefreshForHWND(w) (using JS_Rescript extension)
• DockWindowRefresh()
• reaper.JS_Mouse_SetPosition( x, y ) where the x,y is right on top of the Region Render Matrix chart
• I even tried toggling show/hide Region Render Matrix... nothing works until I simply manually hover my mouse over the Region Render Matrix or manually toggle its show/hide.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.

Last edited by Thonex; 11-13-2018 at 06:10 PM.
Thonex is offline   Reply With Quote
Old 11-13-2018, 07:58 PM   #10
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

I made a similar script before,https://forum.cockos.com/showthread.php?t=212325

I just tried to edit the script and add a line at the end

Code:
reaper.Main_OnCommand(41888,0) --View: Show region render matrix window
It worked, only if you don't open the render matrix window before you run the script
dsyrock is offline   Reply With Quote
Old 11-13-2018, 08:57 PM   #11
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by dsyrock View Post
I made a similar script before,https://forum.cockos.com/showthread.php?t=212325

I just tried to edit the script and add a line at the end

Code:
reaper.Main_OnCommand(41888,0) --View: Show region render matrix window
It worked, only if you don't open the render matrix window before you run the script
Thanks dsyrock,

Yeah... I found that to be the case here too... but if you already have the Render matrix window open, you have to manually close and open it. Really odd.

Are you on Mac?
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-13-2018, 09:27 PM   #12
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by Thonex View Post
Thanks dsyrock,

Yeah... I found that to be the case here too... but if you already have the Render matrix window open, you have to manually close and open it. Really odd.

Are you on Mac?
Oh, I'm on PC. The refreshing doesn't mean a lot for me, because I usually open "Render to file" first, then select the region render matrix after.
dsyrock is offline   Reply With Quote
Old 11-14-2018, 03:00 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

I checked my code, Here is what you need :
  • reaper.TrackList_AdjustWindows( false )

I hope your RRM scripts will be different than mine :P
X-Raym is offline   Reply With Quote
Old 11-14-2018, 08:38 AM   #14
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Quote:
Originally Posted by X-Raym View Post
I checked my code, Here is what you need :
  • reaper.TrackList_AdjustWindows( false )

I hope your RRM scripts will be different than mine :P
GREAT! How did you find it can refresh the region render matrix window? It's hard to guess from it's name
dsyrock is offline   Reply With Quote
Old 11-14-2018, 08:55 AM   #15
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@dysrock


I always find a way :P
X-Raym is offline   Reply With Quote
Old 11-14-2018, 09:30 AM   #16
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by X-Raym View Post
I checked my code, Here is what you need :
  • reaper.TrackList_AdjustWindows( false )

I hope your RRM scripts will be different than mine :P
Hi X-Raym,

Fantastic solution... very clever!!

My code is most probably very different than yours LOL. I'd be surprised if we had the same approach... I used Time Selection and the built-in command "Select All Items in Time Selection on Selected Tracks" (or whatever it's called) to cycle through the regions. I was going to post it but saw you had a paid link and out of respect I decided not to... but if you are curious.... I can post mine.

The main function is about 50 lines of code.

Basically... I do this...

User Selects the tracks they want to monitor... and the range with Time Sections

Then I do this:

• Count regions and log all their start and end point.
• Count tracks
• Loop through all and deselect all matrix boxes. (to clear out the matrix)

then...
• create a nested loop of Regions and selected tracks
• set Time Selection to L/R boundaries of each Region and run command "Select All Items in Time Selection on Selected Tracks" (or whatever it's called)
• Then loop through selected items and check box for each track on that region.

Done.


Cheers.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.

Last edited by Thonex; 11-14-2018 at 11:37 AM.
Thonex is offline   Reply With Quote
Old 11-14-2018, 10:57 AM   #17
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

What you achieved could indeed be achieved with my scripts. So thanks for your consideration.



I confirm they worked differently, I avoid native actions as much as possible :P Also, mine worked with earlier version of REAPER which had a bug with unsetting a region in the RRM, so it has more fancy code to handle that (but nothing bad for performance), that's why my scripts were mostly interesting, it was this hack :P Now it is fixed, scripting for RRM is more friendly.
X-Raym is offline   Reply With Quote
Old 11-14-2018, 11:30 AM   #18
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by X-Raym View Post
I avoid native actions as much as possible :P
Interesting. I usually test and compare.

Many of my script have to work over thousands of measures with (sometimes) tens of thousands of Items. I found nothing faster for selecting items within a range across selected tracks than using that native action.

Also it's way easier for me to code
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 • Catalina • Mac Mini 2020 6 core i7 • 64GB RAM • OS: Catalina • 4K monitor • RME RayDAT card with Sync Card and extended Light Pipe.
Thonex is offline   Reply With Quote
Old 11-14-2018, 11:36 AM   #19
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Of course, it is a question of context, and I totally understand why it isbmore efficient in that particular case :P
X-Raym 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 04:09 AM.


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