Old 08-30-2021, 08:11 AM   #321
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

And the last question (for now ).. (script is ready! )
Is there a native ReaImgui way to set/toggle topmost z-order? Or do I have to do it with the JS_ReaScriptAPI?
__________________
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 08-30-2021, 02:04 PM   #322
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Released version 0.5.5:

Code:
• Demo: disable docking combo box when docking is unavailable
• macOS: fix topmost state being reset when REAPER regains focus
• Update Dear ImGui to v1.84.1 (release notes at https://github.com/ocornut/imgui/releases/tag/v1.84)

API changes:
• Add BeginDisabled/EndDisabled and StyleVar_DisabledAlpha
• Add DetachFont
• Add TableColumnFlags_Disabled and TableColumnFlags_NoHeaderLabel
• Add WindowFlags_TopMost [p=2468716][p=2471188][p=2476740]
• Remove ColorEditFlags__OptionsDefault
Quote:
Originally Posted by amagalma View Post
Is there a native ReaImgui way to set/toggle topmost z-order?
Now there is!
cfillion is offline   Reply With Quote
Old 08-31-2021, 12:34 AM   #323
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

Thank you so much!
__________________
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 08-31-2021, 02:13 AM   #324
aurelien
Human being with feelings
 
Join Date: Apr 2014
Posts: 61
Default

Thanks cfillion, it's an amazing tool!

Do you know if there's a plan to integrate the ImGuiTextFilter feature?

Aurélien.
aurelien is offline   Reply With Quote
Old 08-31-2021, 04:26 AM   #325
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,604
Default

When REAPER is restored from minimized window state the script window is no longer topmost, am I missing something?,..

Code:
local visible, open = reaper.ImGui_Begin(ctx, title, true, reaper.ImGui_WindowFlags_TopMost())
Thanks for the update!
Win10 x64 us_en, REAPER v6.35, reaimgui (imgui-x64) v0.5.5
Edgemeal is offline   Reply With Quote
Old 08-31-2021, 01:56 PM   #326
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 10,800
Default

Quote:
Originally Posted by Edgemeal View Post
When REAPER is restored from minimized window state the script window is no longer topmost, am I missing something?,..
I reported long ago that there's a similar problem with Reaper's 'native' pinning (https://forum.cockos.com/showpost.ph...1&postcount=12, the gif I did is still up), so might as well be a Windows/OS issue, not sure.
nofish is offline   Reply With Quote
Old 08-31-2021, 02:16 PM   #327
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,604
Default

Quote:
Originally Posted by nofish View Post
I reported long ago that there's a similar problem with Reaper's 'native' pinning (https://forum.cockos.com/showpost.ph...1&postcount=12, the gif I did is still up), so might as well be a Windows/OS issue, not sure.
Ah ya, SetWindowPos "HWND_TOPMOST" acts the same ways, thanks.
Edgemeal is offline   Reply With Quote
Old 09-01-2021, 12:07 AM   #328
bourehim
Human being with feelings
 
bourehim's Avatar
 
Join Date: Sep 2019
Location: Morocco
Posts: 15
Default Python and RealmGui Click to diplay text

Hello

I have this script in Python with RealmGui and I want to click a button to display a text, and display another text when I click another buttonso I can have that text visible while the script running,all I've got now is a button "click me" that shows a text "hello dear imgui!" that disappear immediately.
Here is the code:


sys.path.append(RPR_GetResourcePath() + "/Scripts/ReaTeam Extensions/API")
from imgui_python import *
from reaper_python import *

size = 20
ctx = ImGui_CreateContext("My script")
#size = GetAppVersion():match('OSX') and 12 or 14
font = ImGui_CreateFont("sans-serif", size)
ImGui_AttachFont(ctx, font)

def loop():
ImGui_PushFont(ctx, font)
ImGui_SetNextWindowSize(ctx, 400, 80, ImGui_Cond_FirstUseEver())
visible, open = ImGui_Begin(ctx, 'My script', True)
if visible:

if ImGui_Button(ctx, "Click me"):

ImGui_SameLine(ctx)
ImGui_Text(ctx, 'hello dear imgui!')

ImGui_End(ctx)

ImGui_PopFont(ctx)

if open:
RPR_defer("loop()")
else:
ImGui_DestroyContext(ctx)

RPR_defer("loop()")
__________________
My band is UORAX, don't go there if you're slightly depressed.

Last edited by bourehim; 09-01-2021 at 12:12 AM. Reason: I want to post code properly, but I couldn't
bourehim is offline   Reply With Quote
Old 09-01-2021, 12:36 AM   #329
bourehim
Human being with feelings
 
bourehim's Avatar
 
Join Date: Sep 2019
Location: Morocco
Posts: 15
Default

Quote:
Originally Posted by Rodilab View Post
Try this :

Code:
function runImGui()
  if not ctx then
    ctx = reaper.ImGui_CreateContext("TEST", 1200, 800)
  end
  
  if reaper.ImGui_IsCloseRequested(ctx) then
    reaper.ImGui_DestroyContext(ctx)
    ctx = nil
    return
  end

  reaper.ImGui_SetNextWindowPos(ctx, 0, 0)
  reaper.ImGui_SetNextWindowSize(ctx, reaper.ImGui_GetDisplaySize(ctx))
  reaper.ImGui_Begin(ctx, 'wnd', nil, reaper.ImGui_WindowFlags_NoDecoration())
  
  reaper.ImGui_TextColored(ctx, 99999999, "TEST")
  
  reaper.ImGui_End(ctx)
end
  
function loop()
  
  runImGui()
    
  reaper.defer(loop)
end

loop()

I have the same issue, but in a python script. I couldn't get the script mentioned here to work, could you post a fully working script as an example, either in lua or python. Thank you
__________________
My band is UORAX, don't go there if you're slightly depressed.
bourehim is offline   Reply With Quote
Old 09-01-2021, 06:28 AM   #330
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by bourehim View Post
I have this script in Python with RealmGui and I want to click a button to display a text, and display another text when I click another buttonso I can have that text visible while the script running,all I've got now is a button "click me" that shows a text "hello dear imgui!" that disappear immediately.
ImGui_Button returns true once after each click. Store whether to display the text in a variable:

Code:
show_text = False

def loop():
  global show_text

  # ...

  if ImGui_Button(ctx, "Click me"):
    show_text = True

  if show_text:
    ImGui_SameLine(ctx)
    ImGui_Text(ctx, 'hello dear imgui!')

  # ...

Last edited by cfillion; 09-01-2021 at 06:39 AM.
cfillion is offline   Reply With Quote
Old 09-01-2021, 10:41 AM   #331
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Released version 0.5.6:

Code:
• Demo: rename the 'Top most' checkbox to 'Always on top'
• Documentation: add ImGui_Font* to the list of ValidatePtr's supported types
• Documentation: fix the main content area not filling the browser window's full width
• Documentation: revert marking p_open arguments as non-optional
• Windows: disable topmost when the REAPER app is inactive
• Windows: fix topmost being reset when REAPER is unminimized [p=2476936]

API changes:
• Add the text filter API [p=2476922]
cfillion is offline   Reply With Quote
Old 09-01-2021, 11:08 AM   #332
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,604
Default

Quote:
Originally Posted by cfillion View Post
Released version 0.5.6:
• Windows: fix topmost being reset when REAPER is unminimized [p=2476936]
Confirmed, nice job!

Win10, REAPER v6.35/x64, reaimgui (imgui-x64) v0.5.6
Edgemeal is offline   Reply With Quote
Old 09-02-2021, 07:14 AM   #333
aurelien
Human being with feelings
 
Join Date: Apr 2014
Posts: 61
Default

Thanks cfillion, filters are working great!!
aurelien is offline   Reply With Quote
Old 09-02-2021, 12:38 PM   #334
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 94
Default

Hi, cfillion! Awesome update!

Is it possible to accept drag and drop from Windows Explorer into ImGUI?
And to drag and drop from ImGUI into Reaper Edit window?
kartalex is offline   Reply With Quote
Old 09-02-2021, 12:40 PM   #335
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by kartalex View Post
Is it possible to accept drag and drop from Windows Explorer into ImGUI?
Yes, see Widgets > Drag and Drop > Drag and drop files in the demo script.

Quote:
Originally Posted by kartalex View Post
And to drag and drop from ImGUI into Reaper Edit window?
No plans to add drag/dropping to outside of ReaImGui in the foreseeable future.

Last edited by cfillion; 09-02-2021 at 12:49 PM.
cfillion is offline   Reply With Quote
Old 09-02-2021, 01:17 PM   #336
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 94
Default

Quote:
Originally Posted by cfillion View Post
Yes, see Widgets > Drag and Drop > Drag and drop files in the demo script.
Oh, how could I miss that

Quote:
No plans to add drag/dropping to outside of ReaImGui in the foreseeable future.
Well.. It would be great feature. Anyway, ReaImGui is great)
kartalex is offline   Reply With Quote
Old 09-05-2021, 05:19 PM   #337
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 94
Default

Hi, cfillion!

Could you please help me?

Here's the code. I'm trying to get file list from directory in Popup window

It worked in some previous version of ReaImGUI

Now popup doesn't show up. I think it loses focus in some point..

Code:
path = reaper.GetResourcePath() .. '/Scripts/'

local ctx = reaper.ImGui_CreateContext('Template')

--------------------------------------------
--- GET LIST OF FILES IN DIRECTORY
-------------------------------------------
function GetListOfFiles(d)
    --QQ()
    local t = 1
    local tb = {}
    local p=io.popen('dir "' .. d .. '" /b')
    for dir in p:lines() do
        -- Note: To get list of files, only use /b instead of /b /ad
        tb[t] = dir
        t = t + 1
    end
    --MsgT(tb)
    return tb
end

function loop()
    reaper.ImGui_SetNextWindowPos(ctx, 0, 0, reaper.ImGui_Cond_FirstUseEver())
    reaper.ImGui_SetNextWindowSize(ctx, 200, 400, reaper.ImGui_Cond_Once())

    local visible, open = reaper.ImGui_Begin(ctx, 'Minimal GUI', true, flags)
    if  visible then


        rv = reaper.ImGui_Button(ctx, 'Load') 
        if rv then
            tbl2 = {}
            tbl2 = GetListOfFiles(path)
            reaper.ImGui_OpenPopup(ctx, 'load_popup') 
        end
        if reaper.ImGui_BeginPopup(ctx, 'load_popup') then
            reaper.ImGui_Text(ctx, 'Load Script')
            reaper.ImGui_Separator(ctx)
            for i, v in ipairs(tbl2) do                
                if reaper.ImGui_Selectable(ctx, v) then selected = i end
            end
            reaper.ImGui_EndPopup(ctx)
        end

        if tbl2 ~= nil and selected ~= nil then
            --dofile(path .. tbl2[selected])
            selected = nil
        end

        reaper.ImGui_End(ctx)

    end

    if open and (not reaper.ImGui_IsKeyDown(ctx, 27)) then
        reaper.defer(loop)
    else
        reaper.ImGui_DestroyContext(ctx)
    end 
end

reaper.defer(loop)
kartalex is offline   Reply With Quote
Old 09-05-2021, 05:54 PM   #338
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by kartalex View Post
Now popup doesn't show up. I think it loses focus in some point..
That would be because of the cmd.exe window that quickly pops up when using io.popen, taking focus away. Try using reaper.EnumerateFiles instead of using the command line (or, if using the command line is absolutely required for some reason, reaper.ExecProcess).
cfillion is offline   Reply With Quote
Old 09-05-2021, 06:02 PM   #339
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 94
Default

Quote:
Originally Posted by cfillion View Post
That would be because of the cmd.exe window that quickly pops up when using io.popen, taking focus away. Try using reaper.EnumerateFiles instead of using the command line (or, if using the command line is absolutely required for some reason, reaper.ExecProcess).
Oh, I see!
Thank you!!
kartalex is offline   Reply With Quote
Old 09-09-2021, 04:11 PM   #340
bourehim
Human being with feelings
 
bourehim's Avatar
 
Join Date: Sep 2019
Location: Morocco
Posts: 15
Default

I've got a script in python that shows guitar scales, I want to click a button to change the key or scale, I have created buttons to do that, but my first problem is that the guitar scales appears for a fraction of a second and disappear, that' inside ReaimGui window, in the console window it shows just fine.
the other problem which may not be ReaimGui related, is that I want to change the key without changing the previous scale and vise versa.
Here is the images and the script:

https://imgur.com/ZUm2u5Y

https://imgur.com/okUC6tj
Attached Files
File Type: zip ReaimGui_guitar_scales.py.zip (2.5 KB, 36 views)
__________________
My band is UORAX, don't go there if you're slightly depressed.
bourehim is offline   Reply With Quote
Old 09-09-2021, 06:14 PM   #341
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by bourehim View Post
I've got a script in python that shows guitar scales, I want to click a button to change the key or scale, I have created buttons to do that, but my first problem is that the guitar scales appears for a fraction of a second and disappear, that' inside ReaimGui window, in the console window it shows just fine.
the other problem which may not be ReaimGui related, is that I want to change the key without changing the previous scale and vise versa.
The problem is caused by the 'shownew' function setting key_input and scale_input to C Major every time it is called (every frame).

Their initial values should be set only once at startup:

Code:
key_input   = "C"
scale_input = "Major"

def shownew():
  global key_input
  global scale_input

  for keys in NOTES_FLAT:
    # rest of the code...
(Side note: the fretboard would display nicer using a monospace font: https://i.imgur.com/OPcrUaI.png )
cfillion is offline   Reply With Quote
Old 09-14-2021, 03:47 AM   #342
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

ReaImgui Demo -> Widgets -> Querying Status ->
Quote:
\ReaImGui_Demo.lua:2455: bad argument #7 to 'format' (number expected, got boolean)
__________________
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 09-14-2021, 08:56 AM   #343
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by amagalma View Post
ReaImgui Demo -> Widgets -> Querying Status ->
Thanks! "IsItemHovered(_AllowWhenDisabled) = %d" should have been "IsItemHovered(_AllowWhenDisabled) = %s".
cfillion is offline   Reply With Quote
Old 09-15-2021, 02:07 AM   #344
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

Thanks!

Is utf-8 currently not supported? I see question marks in place of characters.
__________________
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 09-15-2021, 05:36 AM   #345
bourehim
Human being with feelings
 
bourehim's Avatar
 
Join Date: Sep 2019
Location: Morocco
Posts: 15
Default

Their initial values should be set only once at startup:

Code:
key_input   = "C"
scale_input = "Major"

def shownew():
  global key_input
  global scale_input

  for keys in NOTES_FLAT:
    # rest of the code...
(Side note: the fretboard would display nicer using a monospace font: https://i.imgur.com/OPcrUaI.png )[/QUOTE]

Thank you so much, it worked perfectly, I can't believe that two variable misplacement made me almost give-up.
You're right about monospace, but I intend to make the fretboard display notes as buttons now that the script is working.
__________________
My band is UORAX, don't go there if you're slightly depressed.
bourehim is offline   Reply With Quote
Old 09-15-2021, 09:03 AM   #346
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by amagalma View Post
Is utf-8 currently not supported? I see question marks in place of characters.
UTF-8 is fully supported, however currently ReaImGui rasterizes only the most common glyphs and doesn't support fallback fonts (transparently switching to different font file when a character isn't contained in the provided font). '?' is shown as a fallback character instead (display only, the original UTF-8 input/output data is unaffected).

See https://forum.cockos.com/showthread.php?p=2468464.
cfillion is offline   Reply With Quote
Old 09-15-2021, 12:51 PM   #347
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

So, we wait for the official implementation? Until then is there any workaround? I did not try to attach a font, I was working with the built-in font. Maybe if I attach one, they 'll appear?

Regarding fonts... Is there any way to know if a certain font is installed?
__________________
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 09-15-2021, 01:03 PM   #348
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by amagalma View Post
So, we wait for the official implementation? Until then is there any workaround? I did not try to attach a font, I was working with the built-in font.
Ah, the built-in font. ProggyClean only contains glyphs for the Latin-1 character set (and at 13px, because it's a bitmap font).

Quote:
Originally Posted by amagalma View Post
Maybe if I attach one, they 'll appear?
Yes, if they are in the Basic Latin or Latin Supplement Unicode blocks and the font contains them.

Quote:
Is there any way to know if a certain font is installed?
To be certain that a specific font is used everywhere and is exactly the same, load it from a .ttf file (to be provided along with the script).

Last edited by cfillion; 09-15-2021 at 01:13 PM.
cfillion is offline   Reply With Quote
Old 09-15-2021, 01:59 PM   #349
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

Hmm... So no Greek then..
__________________
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 09-15-2021, 02:05 PM   #350
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by amagalma View Post
Hmm... So no Greek then..
Technically CreateFont could have a parameter to specify the range of glyphs to load from the font (loading everything can take too much time and video memory).

I'm not too warm to implementing that workaround because it will have to be removed when Dear ImGui implements usage-based glyph loading, breaking scripts that uses it.

Last edited by cfillion; 09-15-2021 at 02:33 PM.
cfillion is offline   Reply With Quote
Old 09-17-2021, 04:05 AM   #351
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

No problem.. We'll wait


---


Regarding colors, if anyone is interested, here is a nice function that returns an imgui_rgba color to its r,g,b,a values (0-255).
Code:
local function ImGuiColorToRGBA( rgba_color ) -- (0-255)
  return (255 & (rgba_color >> 24)), -- r
         (255 & (rgba_color >> 16)), -- g
         (255 & (rgba_color >> 8)),  -- b
         (255 & rgba_color)          -- a
end

-- 0x65 = 101, 0x23 = 35, 0x47 = 71, 0xA0 = 160
color = 0x652347A0

r,g,b,a = ImGuiColorToRGBA ( color )
And this to visible (alpha applied):
Code:
local function ImGuiColorToVisible( rgba_color ) -- (0-255)
  local a = (255 & rgba_color)
  local r = (255 & (rgba_color >> 24))*a/255
  local g = (255 & (rgba_color >> 16))*a/255
  local b = (255 & (rgba_color >> 8))*a/255
  local floor = math.floor
  return floor(r+0.5), floor(g+0.5), floor(b+0.5)
end
__________________
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; 09-17-2021 at 04:48 AM.
amagalma is offline   Reply With Quote
Old 09-17-2021, 06:33 AM   #352
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

I think this may come in handy to people using ReaImGui:



amagalma_ReaImGui Color Theme Creator

#Easily create color themes for ReaImGui development

- Click on a colored rectangle to set color
- Alt-Click text to reset to original color
- Click text to select multiple colors
- Drag colors to copy from one rectangle to the other
- Buttons are self-explanatory
- Size of GUI/font can be set inside the script

in ReaPack
__________________
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; 09-17-2021 at 11:05 AM.
amagalma is offline   Reply With Quote
Old 09-17-2021, 11:07 AM   #353
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

Regarding colors and fonts.. Is there a way to set them once without pushing and popping to the stack each defer cycle?
__________________
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 09-17-2021, 11:13 AM   #354
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,260
Default

ah ah ah ah! That is great!!! I saw they have something like this in ImGUI C++, great to have here too! I will try to understand how to use it now!

Thanks amagalma !!!


It is working perfect!
If I understood correctly I should run this part
Code:
 
    local style_colors = { -1, -2139062017, 252645360, 0, 336860400, 1852735616, 0, 692746890, 1117190758, 1117190827, 168430335, 692747007, 130, 606348543, 84215175, 1330597887, 1768516095, -2105376001, 1117190911, 1032184063, 1117190911, -579070362, 1117190911, 260569855, 1117190735, 1117190860, 1117190911, 1852735616, 442941383, 442941439, 1117190707, 1117190827, 1117190898, 777622748, 1117190860, 862563839, 286926584, 591621375, 1117190835, 858993663, -1667457793, -9545217, -424476417, -6749953, 808465407, 1330600447, 993739007, 0, -241, 1117190745, 748465638, 1117190911, -77, -858993613, -858993575 }
    for i = 1, 55 do
      reaper.ImGui_PushStyleColor(ctx, i-1, style_colors[i])
    end
Every start defer or at least inside "if visible then"
and the pop function just after the imgui_end() right??

like this

Code:
function GuiInit()
  ctx = reaper.ImGui_CreateContext('Item Sequencer') -- Add VERSION TODO
  FONT = reaper.ImGui_CreateFont('sans-serif', 15) -- Create the fonts you need
  reaper.ImGui_AttachFont(ctx, FONT)-- Attach the fonts you need
end

function loop()

  --window
  local window_flags = reaper.ImGui_WindowFlags_MenuBar() 
  reaper.ImGui_SetNextWindowSize(ctx, 250, 300, reaper.ImGui_Cond_Once())-- Set the size of the windows.  Use in the 4th argument reaper.ImGui_Cond_FirstUseEver() to just apply at the first user run, so ImGUI remembers user resize s2
  reaper.ImGui_PushFont(ctx, FONT) -- Says you want to start using a specific font

  --Theme from amagalma
  local style_colors = { -1, -2139062017, 252645360, 0, 336860400, 1852735616, 0, 692746890, 1117190758, 1117190827, 168430335, 692747007, 130, 606348543, 84215175, 1330597887, 1768516095, -2105376001, 1117190911, 1032184063, 1117190911, -579070362, 1117190911, 260569855, 1117190735, 1117190860, 1117190911, 1852735616, 442941383, 442941439, 1117190707, 1117190827, 1117190898, 777622748, 1117190860, 862563839, 286926584, 591621375, 1117190835, 858993663, -1667457793, -9545217, -424476417, -6749953, 808465407, 1330600447, 993739007, 0, -241, 1117190745, 748465638, 1117190911, -77, -858993613, -858993575 }
  for i = 1, 55 do
    reaper.ImGui_PushStyleColor(ctx, i-1, style_colors[i])
  end

  local visible, open  = reaper.ImGui_Begin(ctx, 'Robert Green Blue ', true, window_flags)

  if visible then

      --------
      --YOUR GUI HERE
      --------
      reaper.ImGui_Button(ctx, 'label', -1 )

      --------
      --END GUI HERE
      --------
      reaper.ImGui_End(ctx)
  end 

  reaper.ImGui_PopStyleColor(ctx, 55) -- Pop theme
  reaper.ImGui_PopFont(ctx) -- Pop Font

  if open then
      reaper.defer(loop)
  else
      reaper.ImGui_DestroyContext(ctx)
  end
end

GuiInit()
loop()
Thanks!!

Last edited by daniellumertz; 09-17-2021 at 11:29 AM.
daniellumertz is online now   Reply With Quote
Old 09-17-2021, 12:54 PM   #355
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,054
Default

Quote:
Originally Posted by daniellumertz View Post
If I understood correctly I should run this part
Code:
 
    local style_colors = { -1, -2139062017, 252645360, 0, 336860400, 1852735616, 0, 692746890, 1117190758, 1117190827, 168430335, 692747007, 130, 606348543, 84215175, 1330597887, 1768516095, -2105376001, 1117190911, 1032184063, 1117190911, -579070362, 1117190911, 260569855, 1117190735, 1117190860, 1117190911, 1852735616, 442941383, 442941439, 1117190707, 1117190827, 1117190898, 777622748, 1117190860, 862563839, 286926584, 591621375, 1117190835, 858993663, -1667457793, -9545217, -424476417, -6749953, 808465407, 1330600447, 993739007, 0, -241, 1117190745, 748465638, 1117190911, -77, -858993613, -858993575 }
    for i = 1, 55 do
      reaper.ImGui_PushStyleColor(ctx, i-1, style_colors[i])
    end
Every start defer or at least inside "if visible then"
and the pop function just after the imgui_end() right??

Correct! Maybe in the future I'll make a copy of the ReaImGui demo and add this as a utility, so one can directly see all the changes..


If you come up with a nice theme, share it
__________________
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 09-17-2021, 02:18 PM   #356
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,260
Default

I will thanks a lot! very well the way to adress the theme ! Putting in a table the values! Makes easier to do themes presets the user can select!
daniellumertz is online now   Reply With Quote
Old 09-18-2021, 11:01 AM   #357
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,683
Default

WOW~~
AMAZING STUFF!
__________________
FR: FX-Container --> https://forum.cockos.com/showthread.php?t=226533
Reflected is offline   Reply With Quote
Old 10-02-2021, 10:52 PM   #358
inframan
Human being with feelings
 
Join Date: Apr 2009
Posts: 45
Default

Quote:
Originally Posted by cfillion View Post
Adding bitmap image support is on the list of things I want to do. No ETA since it's going to be a lot of work...
Reaper imgui has been a HUGE help for my work - many, many thanks

I am now planning next phase of my personal toolset script development, it'd be really great to have some idea of whether image support is anticipated anytime in the near future, say, next 6 months or so. If no, I'll go one way; if yes, a different way.

Grateful for any indication on this, even if highly uncertain at present.

thanks !

(if I had any decent development skills I'd offer to pitch in, but honestly, I started learning to code from zero with lua a year or so back. Lua and reaper API is an awesome platform and adding imgui has been magic! )
inframan is offline   Reply With Quote
Old 10-04-2021, 12:15 AM   #359
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Quote:
Originally Posted by inframan View Post
it'd be really great to have some idea of whether image support is anticipated anytime in the near future, say, next 6 months or so. If no, I'll go one way; if yes, a different way.
I don't think I'll have enough free time to implement bitmaps in the near future.
cfillion is offline   Reply With Quote
Old 10-04-2021, 08:49 PM   #360
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 3,739
Default

Released version 0.5.7:

Code:
• Demo: fix crash in the Querying Status section [p=2480715]
• Fix visibility of popups and menus opened directly over REAPER's main window
• Support WindowFlags_TopMost in BeginPopup and BeginPopupModal
cfillion 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 07:30 PM.


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