Old 03-17-2021, 03:23 AM   #41
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@StevieT
Yes, free in reapack :P





But there is still some missing steps


like palette sorting, and I dont think we can get font info from API so this is problematic to output a full color theme file but it should still help for customization for sure.
X-Raym is offline   Reply With Quote
Old 03-17-2021, 04:13 AM   #42
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by X-Raym View Post
@StevieT
Yes, free in reapack :P





But there is still some missing steps


like palette sorting, and I dont think we can get font info from API so this is problematic to output a full color theme file but it should still help for customization for sure.

Nice! .. Apart from the variable names, it would be nice to add their descriptions too. You can use this table if you like (I got it from the doc html with regex):

Lua table indexed with all theme variable names and containing their descriptions

Edit: I have updated the file and now it has directly the localized name. This will increase speed.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-17-2021 at 05:54 AM.
amagalma is offline   Reply With Quote
Old 03-17-2021, 04:19 AM   #43
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Amagalma
How has this been generated ?


Also... it is nice indeed but... what about translation ? :P
X-Raym is offline   Reply With Quote
Old 03-17-2021, 05:07 AM   #44
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by X-Raym View Post
@Amagalma
How has this been generated ?
https://regexr.com/

Quote:
Also... it is nice indeed but... what about translation ? :P
Use Google! :P
__________________
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 03-17-2021, 05:24 AM   #45
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@amalgama
My question was more "where did you get the list",
of course some kind of regex and editor/tool is needed to parse a document but... what document did you parse in a first place ? 🧐
X-Raym is offline   Reply With Quote
Old 03-17-2021, 05:29 AM   #46
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

For the localization:
Code:
-- (include in the script the table I attached above)


function Localize_variable( variable_name )
  return reaper.LocalizeString(variable_description[variable_name], "theme")
end

I copied and pasted the list from the docs of the SetThemeColor function

regex:
Code:
expression:
\s+(\S+) : (.+) -+ [^\n]+\n
list:
["$1"] = '$2',\n
Edit: I have updated the file and now it has directly the localized name. This will increase speed.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-17-2021 at 05:53 AM.
amagalma is offline   Reply With Quote
Old 03-17-2021, 05:52 AM   #47
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@amagalma
Ok It is also wha I did to get the list of variable, I didnt even read the description. Though the localization doesnt work so there might be small diff between the doc and the real implementation?
We'll surely discuss that in another topic when I will have open a thread for this project and focus on ImGui stuff here :P


@cfillion
Does calling ImGui_PushStyleColor necessercaly means we have to call the Pop function not long after in a cycle defer loop ?
Can't we store style for many loops ? (I got error trying that)



This is how it is done in the exemple.
X-Raym is offline   Reply With Quote
Old 03-17-2021, 06:10 AM   #48
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Quote:
Originally Posted by X-Raym View Post
@amagalma
Ok It is also wha I did to get the list of variable, I didnt even read the description. Though the localization doesnt work so there might be small diff between the doc and the real implementation?
We'll surely discuss that in another topic when I will have open a thread for this project and focus on ImGui stuff here :P

Tested it with French langpack and it works. I uploaded it to the ReaScripts-Templates.


Yes, let's not derail this thread any more with this! Send me at Slack
__________________
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 03-17-2021, 03:42 PM   #49
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Do you think this could be a worthwhile addition to ReaImGui?
__________________
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 03-17-2021, 03:50 PM   #50
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

Quote:
Originally Posted by amagalma View Post
Do you think this could be a worthwhile addition to ReaImGui?
Man I would be so happy to have audio GUI
daniellumertz is offline   Reply With Quote
Old 03-17-2021, 06:13 PM   #51
ovnis
Human being with feelings
 
ovnis's Avatar
 
Join Date: Oct 2011
Posts: 2,924
Default

X-Raym, I have installed your XR theme but I can't find int inside the actions window!
ovnis is offline   Reply With Quote
Old 03-18-2021, 02:34 AM   #52
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Ovnis
Hi,
The demo script I'm showcasing isnt a specific theme adjuster script. It is an alternatuve to the theme tweaker action which is theme agnostic (same panel on every theme, just different value to populate it). It will.not be oacked in my theme zip file but in my free reapack repo scripts. It is not release yet.
I will open a thread for it so we can keep this Dear ImGui thread for what it is meant to,
But I dont share it for now cause I found a bug with blendmodes value, I want the script to be simple to use and not to have lots of warning and consideration.
We'll discuss about this in the new thread.
Best,

Last edited by X-Raym; 03-18-2021 at 02:35 AM. Reason: added infon
X-Raym is offline   Reply With Quote
Old 03-19-2021, 08:18 AM   #53
elcalen
Human being with feelings
 
elcalen's Avatar
 
Join Date: Sep 2019
Location: Finland
Posts: 755
Default

I can't seem to get this to work on Linux (Debian testing, Gnome 3.38.4). When I run the example scripts, I just get an invisible window that covers a portion of Reaper's main window, so I can only interact with Reaper around it. There's no error message or anything. I thought maybe it could be due to some missing library, but I can't figure out what I would be missing. (Anyone happen to know what specific packages would be required on Debian, that provide the correct libstdc++ version etc?)
elcalen is online now   Reply With Quote
Old 03-19-2021, 01:05 PM   #54
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by elcalen View Post
I can't seem to get this to work on Linux (Debian testing, Gnome 3.38.4). When I run the example scripts, I just get an invisible window that covers a portion of Reaper's main window, so I can only interact with Reaper around it. There's no error message or anything. I thought maybe it could be due to some missing library, but I can't figure out what I would be missing. (Anyone happen to know what specific packages would be required on Debian, that provide the correct libstdc++ version etc?)
Confirmed on GNOME, thanks! Here's a build that should fix this: reaper_imgui-x86_64.so.
cfillion is offline   Reply With Quote
Old 03-19-2021, 04:00 PM   #55
elcalen
Human being with feelings
 
elcalen's Avatar
 
Join Date: Sep 2019
Location: Finland
Posts: 755
Default

Quote:
Originally Posted by cfillion View Post
Confirmed on GNOME, thanks! Here's a build that should fix this: reaper_imgui-x86_64.so.
This version seems to work, thanks!
elcalen is online now   Reply With Quote
Old 03-19-2021, 10:48 PM   #56
Hypex
Human being with feelings
 
Join Date: Mar 2015
Location: Australia
Posts: 451
Default

I just found this accidentally now while looking up audio on the X-Raym API site. Then all these ImGui functions showed up!


Does that mean the dependable GetUserInputs() will soon be depreciated?


Is this now built into the Reaper API and available to all scripts?
Hypex is offline   Reply With Quote
Old 03-19-2021, 11:23 PM   #57
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Is there a way to quit a running ImGUI script? I'm trying to add a "Close" item to the menu
Arthur McArthur is offline   Reply With Quote
Old 03-20-2021, 02:08 AM   #58
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Arthur McArthur
Just make it not call the reaper.defer function


I use a boolean global var for that


Code:
  if not process then
    reaper.defer(Run)
  end

@Hypex
Quote:
GetUserInputs() will soon be depreciated?
Why would it be ?
This function is native, while ReaImGui is user made extension.
Also, GetUserInputs has some simplicity on code side which is valuable (labels auto align, save last post, compatibility with screen reader etc, out of the box)


ReaImGui on the other hand will help us make more complex tool (see screenshot of my theme wteaker with color palettes)
X-Raym is offline   Reply With Quote
Old 03-20-2021, 03:09 AM   #59
Hypex
Human being with feelings
 
Join Date: Mar 2015
Location: Australia
Posts: 451
Default

Quote:
Originally Posted by X-Raym View Post
Why would it be ?

The function list looked quite advanced, with support for all kinds of widgets, against a simple stack of text input gadgets.


Quote:
This function is native, while ReaImGui is user made extension.
Also, GetUserInputs has some simplicity on code side which is valuable (labels auto align, save last post, compatibility with screen reader etc, out of the box)

Yes, I found that out when testing, but got slightly excited when it suddenly turned up in an API list.



GetUserInputs is useful, with auto layout, though getting a bit dated with only one widget type supported. It's a good base to build on if it was extended with a few more basic widgets. But that's another story.


Quote:
ReaImGui on the other hand will help us make more complex tool (see screenshot of my theme wteaker with color palettes)

Yes I could see that and other examples. The GUI tends to stand out as it has a borderless design. Though I did notice it wants absolute dimensions for a window. I see this a lot in other layout engines and it surprises me as dynamic GUI sizes have been around 30 years or more now and all screens don't have the same screen or font size. So I tend to think absolute sizes should be calculated by the layout engine itself. But I digress.
Hypex is offline   Reply With Quote
Old 03-20-2021, 03:21 AM   #60
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@Hypex
Deprecated would mean it is not adviced to use it anymore, that it is encouraged to update to more modern functions before it gets deleted, and only left temporary for backward compatibility.

This is not the case here. GetUserInput is native. ReaImGui is user made. It is just another tool -but very good one for sure, it doesn't deprecate any other solution, especially native ones.



Even our other GUI framework for GFX like Scythe or eugen2777 are still worth consideration for other aspect, mainly cause gfx have resizable text and nice canvas usage for eg.
X-Raym is offline   Reply With Quote
Old 03-20-2021, 05:27 AM   #61
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by Arthur McArthur View Post
Is there a way to quit a running ImGUI script? I'm trying to add a "Close" item to the menu
reaper.ImGui_DestroyContext(the_ctx_to_close)
cfillion is offline   Reply With Quote
Old 03-20-2021, 08:20 AM   #62
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Quote:
Originally Posted by cfillion View Post
reaper.ImGui_DestroyContext(the_ctx_to_close)
When I run that I'm getting an assertion failed error, followed by a hard crash of REAPER. Here's the code:

Code:
r = reaper


function print(a)
  reaper.ShowConsoleMsg("\n " .. a)
end

-- save function, we're running it every time a control gets clicked
function save()
    name = "default"
    PresetManager.state.current_preset.name = name:gsub("%s+", "_")
    PresetManager:save_preset(name)
end

--------------------------------------- GUI ------------------------------------

local click_count, text = 0, ''
local ctx = reaper.ImGui_CreateContext('Media Explorer Organizer', 240, 500, 571, 111)

function loop()
    local rv

    if reaper.ImGui_IsCloseRequested(ctx) then
        reaper.ImGui_DestroyContext(ctx)
        return
    end
    
    
    local window_flags = reaper.ImGui_WindowFlags_MenuBar() |
                     reaper.ImGui_WindowFlags_NoDecoration()
    reaper.ImGui_SetNextWindowPos(ctx, 0, 0)
    reaper.ImGui_SetNextWindowSize(ctx, reaper.ImGui_GetDisplaySize(ctx))
    reaper.ImGui_Begin(ctx, 'Window', nil, window_flags)
    

    function HelpMarker(desc) -- Function to show a ?
        reaper.ImGui_TextDisabled(ctx, '(?)')
        if reaper.ImGui_IsItemHovered(ctx) then
            reaper.ImGui_BeginTooltip(ctx)
            reaper.ImGui_PushTextWrapPos(ctx,
                                         reaper.ImGui_GetFontSize(ctx) * 30.0)
            reaper.ImGui_Text(ctx, desc)
            reaper.ImGui_PopTextWrapPos(ctx)
            reaper.ImGui_EndTooltip(ctx)
        end
    end

    function ToolTip(text)
        if reaper.ImGui_IsItemHovered(ctx) then
            reaper.ImGui_BeginTooltip(ctx)
            reaper.ImGui_PushTextWrapPos(ctx,
                                         reaper.ImGui_GetFontSize(ctx) * 30.0)
            reaper.ImGui_Text(ctx, text)
            reaper.ImGui_PopTextWrapPos(ctx)
            reaper.ImGui_EndTooltip(ctx)
        end
    end

    ------------------ GUI START
    
    if reaper.ImGui_BeginMenuBar(ctx) then
        if reaper.ImGui_BeginMenu(ctx, 'File') then
            if reaper.ImGui_MenuItem(ctx, 'Save') then
            save()
            end
            if reaper.ImGui_MenuItem(ctx, 'Open') then
                
            end
            reaper.ImGui_Separator(ctx)
            
            if reaper.ImGui_MenuItem(ctx, 'Close') then
            reaper.ImGui_DestroyContext(ctx)    
            end
            reaper.ImGui_EndMenu(ctx)
        end
        reaper.ImGui_EndMenuBar(ctx)
    end
       
        reaper.ImGui_Spacing(ctx)      reaper.ImGui_Spacing(ctx)
    
    reaper.ImGui_End(ctx)

    reaper.defer(loop)
end
----------------------------
--HWND = reaper.ImGui_GetNativeHwnd(ctx)
--reaper.JS_Window_SetStyle(HWND, "POPUP")

reaper.defer(loop)
Arthur McArthur is offline   Reply With Quote
Old 03-20-2021, 08:50 AM   #63
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by Arthur McArthur View Post
When I run that I'm getting an assertion failed error, followed by a hard crash of REAPER. Here's the code:
Fixing the crash (nice catch!).

For the assertion failure, make sure to finalize all active ImGui controls (using the corresponding End* functions) before calling DestroyContext.

Code:
            if reaper.ImGui_MenuItem(ctx, 'Close') then
              reaper.ImGui_EndMenu(ctx)
              reaper.ImGui_EndMenuBar(ctx)
              reaper.ImGui_End(ctx)
              reaper.ImGui_DestroyContext(ctx)
              return -- stop execution here, ctx is no longer valid
            end
            reaper.ImGui_EndMenu(ctx)
        end
        reaper.ImGui_EndMenuBar(ctx)
    end
    
    reaper.ImGui_End(ctx)

    reaper.defer(loop)
end

reaper.defer(loop)

Last edited by cfillion; 03-20-2021 at 08:56 AM.
cfillion is offline   Reply With Quote
Old 03-20-2021, 09:37 AM   #64
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Great, thanks! On another note, is there a reason why this modal window won't be called when clicking on the settings menu item? I'm struggling getting modals to work.

Code:
local r = reaper


function print(a)
  reaper.ShowConsoleMsg("\n " .. a)
end

-- save function, we're running it every time a control gets clicked
function save()
    name = "default"
    PresetManager.state.current_preset.name = name:gsub("%s+", "_")
    PresetManager:save_preset(name)
end

process = false

function RemoveBorders()
  HWND = reaper.ImGui_GetNativeHwnd(ctx)
  reaper.JS_Window_SetStyle(HWND, "TILED")
  borderoffset = 10
end

borderoffset = 0
--------------------------------------- GUI ------------------------------------

local click_count, text = 0, ''
local ctx = reaper.ImGui_CreateContext('Media Explorer Organizer', 240, 500, 571, 111)

function loop()
    local rv

    if reaper.ImGui_IsCloseRequested(ctx) then
        reaper.ImGui_DestroyContext(ctx)
        return
    end
    
    
    local window_flags = reaper.ImGui_WindowFlags_MenuBar() |
                     reaper.ImGui_WindowFlags_NoDecoration()
    reaper.ImGui_SetNextWindowPos(ctx, 0, 0)
    reaper.ImGui_SetNextWindowSize(ctx, reaper.ImGui_GetDisplaySize(ctx))
    reaper.ImGui_Begin(ctx, 'Window', nil, window_flags)
    

    function HelpMarker(desc) -- Function to show a ?
        reaper.ImGui_TextDisabled(ctx, '(?)')
        if reaper.ImGui_IsItemHovered(ctx) then
            reaper.ImGui_BeginTooltip(ctx)
            reaper.ImGui_PushTextWrapPos(ctx,
                                         reaper.ImGui_GetFontSize(ctx) * 30.0)
            reaper.ImGui_Text(ctx, desc)
            reaper.ImGui_PopTextWrapPos(ctx)
            reaper.ImGui_EndTooltip(ctx)
        end
    end

    function ToolTip(text)
        if reaper.ImGui_IsItemHovered(ctx) then
            reaper.ImGui_BeginTooltip(ctx)
            reaper.ImGui_PushTextWrapPos(ctx,
                                         reaper.ImGui_GetFontSize(ctx) * 30.0)
            reaper.ImGui_Text(ctx, text)
            reaper.ImGui_PopTextWrapPos(ctx)
            reaper.ImGui_EndTooltip(ctx)
        end
    end

    ------------------ GUI START
    
    if reaper.ImGui_BeginMenuBar(ctx) then
        if reaper.ImGui_BeginMenu(ctx, 'File') then
            if reaper.ImGui_MenuItem(ctx, 'Save') then
            save()
            end
            if reaper.ImGui_MenuItem(ctx, 'Open') then
                
            end
            reaper.ImGui_Separator(ctx)
            
            if reaper.ImGui_MenuItem(ctx, 'Settings') then
            
            r.ImGui_OpenPopup(ctx, 'Delete?')
            
            local display_size = {r.ImGui_GetDisplaySize(ctx)}
                local center = { display_size[1] * 0.5, display_size[2] * 0.5 }
                r.ImGui_SetNextWindowPos(ctx, center[1], center[2], r.ImGui_Cond_Appearing(), 0.5, 0.5)
            
                if r.ImGui_BeginPopupModal(ctx, 'Delete?', nil, r.ImGui_WindowFlags_AlwaysAutoResize()) then
                  r.ImGui_Text(ctx, 'All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n')
                  r.ImGui_Separator(ctx)
            
                  r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FramePadding(), 0, 0)
                    r.ImGui_Checkbox(ctx, "Don't ask me next time")
                  r.ImGui_PopStyleVar(ctx)
            
                  if r.ImGui_Button(ctx, 'OK', 120, 0) then r.ImGui_CloseCurrentPopup(ctx) end
                  r.ImGui_SetItemDefaultFocus(ctx)
                  r.ImGui_SameLine(ctx)
                  if r.ImGui_Button(ctx, 'Cancel', 120, 0) then r.ImGui_CloseCurrentPopup(ctx) end
                  r.ImGui_EndPopup(ctx)
                end
            end
            
            reaper.ImGui_Separator(ctx)
            
            if reaper.ImGui_MenuItem(ctx, 'Close') then
            process = true 
            end
            reaper.ImGui_EndMenu(ctx)
        end
        
        reaper.ImGui_Dummy(ctx, 160 + borderoffset, 0)
        
        if reaper.ImGui_MenuItem(ctx, 'X') then
        process = true
        
        end
        
        reaper.ImGui_EndMenuBar(ctx)
    end
       
        reaper.ImGui_Spacing(ctx)      reaper.ImGui_Spacing(ctx)
    
    reaper.ImGui_End(ctx)
    if  not process then
    reaper.defer(loop)
    end
end
----------------------------

reaper.defer(loop)
Arthur McArthur is offline   Reply With Quote
Old 03-20-2021, 09:38 AM   #65
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@cfillion
But destroy context doesnt prevent the defer loop...




Also, anything wrong with not using the Not defer trick I mentioned ? (withour explicitely destroyin ImGui context ?)
X-Raym is offline   Reply With Quote
Old 03-20-2021, 09:41 AM   #66
Arthur McArthur
Human being with feelings
 
Arthur McArthur's Avatar
 
Join Date: Sep 2016
Location: Toronto
Posts: 744
Default

Quote:
Originally Posted by X-Raym View Post
@cfillion
Also, anything wrong with not using the Not defer trick I mentioned ? (withour explicitely destroyin ImGui context ?)
Your trick works for me, thanks X-Raym!
Arthur McArthur is offline   Reply With Quote
Old 03-20-2021, 10:47 AM   #67
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by Arthur McArthur View Post
Great, thanks! On another note, is there a reason why this modal window won't be called when clicking on the settings menu item? I'm struggling getting modals to work.
That "if r.ImGui_BeginPopupModal" only executes when the menu is open (because of the "if reaper.ImGui_BeginMenu"). Since the menu is closed at the same time, the modal doesn't get a chance to show up.

Code:
local open_settings = false
if r.ImGui_BeginMenuBar(ctx) then
  if r.ImGui_BeginMenu(ctx, 'File') then
    if r.ImGui_MenuItem(ctx, 'Settings') then
      open_settings = true
    end
    r.ImGui_EndMenu(ctx)
  end
  r.ImGui_EndMenuBar(ctx)
end

if open_settings then
  r.ImGui_OpenPopup(ctx, 'Delete?')
end
          
local display_size = {r.ImGui_GetDisplaySize(ctx)}
local center = { display_size[1] * 0.5, display_size[2] * 0.5 }
r.ImGui_SetNextWindowPos(ctx, center[1], center[2], r.ImGui_Cond_Appearing(), 0.5, 0.5)

if reaper.ImGui_BeginPopupModal(ctx, 'Delete?', nil, r.ImGui_WindowFlags_AlwaysAutoResize()) then
  r.ImGui_Text(ctx, 'All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n')
  r.ImGui_Separator(ctx)

  r.ImGui_PushStyleVar(ctx, r.ImGui_StyleVar_FramePadding(), 0, 0)
    r.ImGui_Checkbox(ctx, "Don't ask me next time")
  r.ImGui_PopStyleVar(ctx)

  if r.ImGui_Button(ctx, 'OK', 120, 0) then r.ImGui_CloseCurrentPopup(ctx) end
  r.ImGui_SetItemDefaultFocus(ctx)
  r.ImGui_SameLine(ctx)
  if r.ImGui_Button(ctx, 'Cancel', 120, 0) then r.ImGui_CloseCurrentPopup(ctx) end
  r.ImGui_EndPopup(ctx)
end
Quote:
Originally Posted by X-Raym View Post
@cfillion
But destroy context doesnt prevent the defer loop...

Also, anything wrong with not using the Not defer trick I mentioned ? (withour explicitely destroyin ImGui context ?)
The return statement does. Letting the ReaImGui context self-destruct after it's been unused for an entire timer cycle isn't wrong either.

Last edited by cfillion; 03-20-2021 at 11:12 AM.
cfillion is offline   Reply With Quote
Old 03-21-2021, 10:44 PM   #68
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Initial architecture of C++ native addons finished, and good handful of stuff ported.

Mostly thanks to cfillion.

Here's a demo of what's available. Note that 2 of the curve editors here are broken, the only one that works properly is the bezier (first one).

Released is:
- Toggle Button
- Bezier Curve Editor
- Markdown Support
- 36 ImGui style presets and an example toggle
- 2 broken curve editors

To install, put the two DLL's from the "artifacts" folder here inside your UserPlugins folder, and run the Lua script also provided in the "artifacts" folder to see this demo.

It conflicts with the official ReaImGui and has requirements that will be in next release so you'll need to back up your current ReaImGui DLL and replace it with the one in the archive:

https://github.com/GavinRay97/reaimgui-extra-personal



The text you see at the top is simply:
Code:
local markdown_string = [[
# Header 1
The following should be an unordered list:
- One
- Two
- Three
  - Testing for sub-list ability
  - Another sub-list item

The following should be bulleted list:
  *  One
  *  Two
  *  Three
    *  Testing for sub-list ability
    *  Another sub-list item
    
===================================================
]]

reaper.ImGui_Extra_Markdown(ctx, markdown_string)
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is offline   Reply With Quote
Old 03-22-2021, 01:33 AM   #69
Hypex
Human being with feelings
 
Join Date: Mar 2015
Location: Australia
Posts: 451
Default

@X-Raym

Given GetUserInput doesn't have a sequel like other functions, where they are depreciated by the sequel function, it makes sense for it to be relevant. I don't recall even seeing function sequels before I examined the Reaper API. It can look messed up but is a good way to extend functionality with backward compatibility.

Last edited by Hypex; 03-23-2021 at 01:25 AM.
Hypex is offline   Reply With Quote
Old 03-22-2021, 04:37 PM   #70
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Released version 0.2:

Code:
• Add a C++ header for using ReaImGui in third-party extensions on GitHub/releases
• Fix a crash when an ImGui assertion fails during DestroyContext [p=2421480]
• Fix InputTextMultiline, {Drag,Slider}Double{2..4} incorrectly sanitizing the flags
• Fix screen bound clamping when calculating the default window position
• Input*, Color{Edit,Picker}*: avoid copying data to the output buffers at every frame
• Linux: Fix undocked windows being invisible on GNOME [p=2421074]
• Lua demo: fix single selection when Ctrl is not held in Selectables > Multiple selection [p=2416937]
• Suspend garbage collection (and rendering) when a modal dialog is shown [p=2416033]
• Windows: fix the topmost "thumbstack" button not being displayed
• Windows: remove borders around the window when docked

API changes:
• Add ColorConvertRGBtoHSV
• Change ColorConvertHSVtoRGB to also output separate RGB channels values
• Remove redundant GetMouseWheelH function
• Update to Dear ImGui 1.82
  - DrawList_AddPolyline, _PathStroke: replace the `bool closed` argument with `int flags` (ImGui_DrawFlags_*)
  - DrawList_AddRect, _AddRectFilled and _PathRect: rename the `rounding_corners` argument to `flags`
  - DrawList_PathArcTo: changed default value of `num_segments` to 0 (adaptively tessellate)
  - Rename ImGui_InputTextFlags_AlwaysInsertMode to _AlwaysInsertMode
  - Replace ImGui_DrawCornerFlags_* with new DrawFlags
cfillion is offline   Reply With Quote
Old 03-22-2021, 04:58 PM   #71
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Quote:
Originally Posted by cfillion View Post
Released version 0.2:
Woo!!!

Also, File dialogue component ported today.
The below is just:
Code:
local selection_types = {file = 0, folder = 1}

file_dialogue_open, filepath_buf_ptr =
    reaper.ImGui_Extra_Lime2DFileDialogue(ctx, file_dialogue_open,
                                            filepath_buf_ptr,
                                            selection_types.file)
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)

Last edited by gxray; 03-22-2021 at 05:23 PM.
gxray is offline   Reply With Quote
Old 03-22-2021, 10:49 PM   #72
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Very cool! I can only imagine what we could code with this 5 years ago instead crappy rectangles and ugly buttons and spending 90% time for building unfriendly interface.
mpl is offline   Reply With Quote
Old 03-23-2021, 12:06 AM   #73
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

mpl, you are back, wow !!!
__________________
Macbook Pro INTEL | Reaper, always latest version | OSX Ventura | Presonus Studio 24c
My Reaper Tips&Tricks YouTube Channel: https://www.youtube.com/user/vanhaze2000/playlists
vanhaze is offline   Reply With Quote
Old 03-23-2021, 12:18 AM   #74
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,992
Default

hi mpl!! welcome would love to see some mpl scripts with this! Yeah very good to spend more time on the actual logic then in the GUI.

Hurray to cfillion ! For bringing this and for the recent update!

Hurray to gxray also for bringing other extensions to it ! In my opinion is really great reaper script are now able to import other amazing extensions of ImGUI
daniellumertz is offline   Reply With Quote
Old 03-23-2021, 01:21 AM   #75
germano
Human being with feelings
 
Join Date: Sep 2012
Location: Living in Portugal but Born in France
Posts: 64
Default

ReaImGui is a game-changing.

Thanks cfillion and gxray.

imnodes could be a precious extension (small dependency-free node editor extension).
https://github.com/Nelarius/imnodes
germano is offline   Reply With Quote
Old 03-23-2021, 03:06 AM   #76
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@mpl
Hi mpl! As you are one of those who push GFX to its highest level, I was thinking about how you would love such tools Glad you found it !
X-Raym is offline   Reply With Quote
Old 03-23-2021, 03:07 PM   #77
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Quote:
Originally Posted by germano View Post
ReaImGui is a game-changing.

Thanks cfillion and gxray.

imnodes could be a precious extension (small dependency-free node editor extension).
https://github.com/Nelarius/imnodes
ASK AND YE SHALL RECEIVE

This one took a while haha. Also I'm new to C++ and haven't tested this but I've ported the header based on types alone. Will test and polish over the coming days:

__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is offline   Reply With Quote
Old 03-23-2021, 03:32 PM   #78
germano
Human being with feelings
 
Join Date: Sep 2012
Location: Living in Portugal but Born in France
Posts: 64
Default

I am a fan of modularity and node based environments.
Giving that possibility to Reaper will open a great door in my point of view.

Thanks gxray.
germano is offline   Reply With Quote
Old 03-23-2021, 07:11 PM   #79
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Quote:
Originally Posted by germano View Post
I am a fan of modularity and node based environments.
Giving that possibility to Reaper will open a great door in my point of view.

Thanks gxray.
Don't thank me yet -- thank me when it's out published in a (mostly) working state

(Also, if you saw how much cfillion has had to hold my hand for everything "I" have "contributed" on this front, I reckon you'd be thanking him and not me ahaha)

That man is an absolute gem.

--

But agreed. There are a small handful of hugely impactful widget libraries that we have left to port I think.

One of them was a node-based editor and the other is a comprehensive graph/plot library.

I think cfillion has expressed some interest in seeing a solid + comprehensive graphing lib so who knows what may lie in the future there.

There's a small one called "imgui-plot" that's very simple (one method, "plot") + audio-targeted in the meantime, it's just kind of a pain to port because it takes a nested C++ struct as a config arg, which I can only think to model as like a 50 argument Lua function haha.

https://github.com/soulthreads/imgui-plot

There's also an ImGui piano keyboard display I'd like to port, that one should be quick because it's fairly static.

---

Edit: working prototype!!!

Source is here:
https://github.com/GavinRay97/reaimg...des-widget.cpp

It's currently in today's build .dll in the repo "artifacts" folder.

__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)

Last edited by gxray; 03-23-2021 at 09:25 PM.
gxray is offline   Reply With Quote
Old 03-28-2021, 09:00 PM   #80
PMan
Human being with feelings
 
Join Date: Aug 2019
Posts: 646
Default

Good to see you, MPL!
PMan 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:44 AM.


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