Old 11-27-2022, 02:56 AM   #641
BryanChi
Human being with feelings
 
Join Date: Jan 2019
Location: Taiwan
Posts: 439
Default

Hi Cfillion,
Is there a slider flag for Exponential? How come there's one for Logarithmic(ImGui_SliderFlags_Logarithmic), but not exponential?
Thanks!!
BryanChi is offline   Reply With Quote
Old 11-27-2022, 05:37 AM   #642
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

There isn't one, but you could do the math yourself and have the slider display the desired value using the format parameter.

Last edited by cfillion; 11-27-2022 at 06:00 AM.
cfillion is offline   Reply With Quote
Old 11-27-2022, 06:14 AM   #643
BryanChi
Human being with feelings
 
Join Date: Jan 2019
Location: Taiwan
Posts: 439
Default

ah ok! Really terrible at math but finally got it to work after random fiddling... : p
BryanChi is offline   Reply With Quote
Old 11-27-2022, 10:47 AM   #644
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

ReaImGui 0.8

TL;DR: Implemented bitmap images (PNG/JPEG), added a preferences page, improved documentation and widened GPU compatibility.



Code:
• Add a user settings page in Preferences > Plug-ins > ReaImGui:
  - Option to disable restoration of saved settings ("safe mode")
  - Option to select which graphics renderer to use
• Display indirect errors in a custom, more user-friendly dialog
• Implement bitmap image loading (PNG and JPEG from a file or memory) and image sets (per-DPI variants)
• macOS: add a Metal renderer (new default, requires El Capitan or newer)
• Share GPU textures with all windows in the same context (except on Linux due to a GDK 3 limitation)
• Update dear imgui to v1.89.1 (v1.89 release notes, v1.89.1)
• Windows: add a Direct3D 10 renderer (new default)
• Windows: disable minimizing and use the tool window style when decorations are enabled
• Windows: support mouse input everywhere in windows straddling multiple monitors with mixed DPI scales

Documentation:
• DRY-ify default argument values (code + doc using a single source of truth)
• Hide the "ImGui_" prefix
• More accurate line number ranges in links to source code
• Reorganize all functions in hierarchical, individually documented sections
• Rich-text formatting (Markdown <3)
• Syntax highlighting of code samples (if client-side Javascript is enabled)

API changes:
• Add {Attach,Detach} for linking the lifetime of any object with a context
• Add ConfigFlags_NavNoCaptureKeyboard
• Add ConfigVar_HoverDelay{Normal,Short} and ConfigVar_InputTextEnterKeepActive
• Add GetFramerate
• Add HoveredFlags_{Delay{Normal,Short},NoSharedDelay}
• Add Image{,Button} and DrawList_AddImage{,Quad,Rounded}
• Add InputTextFlags_EscapeClearsAll
• Add Key_Mouse*
• Add Mod_Shortcut (alias for _Ctrl on Linux & Windows and _Super, the Cmd key, on macOS)
• Remove {Attach,Detach}Font (replaced by generic {Attach,Detach} functions)
• Rename ModFlags_* and Key_Mod* to Mod_*
New rendering engines

Direct3D 10 on Windows adds compatibility with older computers that were previously unable to run ReaImGui due to their GPU not supporting OpenGL 3.1/3.2.

Metal on macOS 10.11 and newer allows ReaImGui to obey the monitor's color profile as set in System Preferences.

The existing cross-platform OpenGL 3 renderer remains available as an option.

User preferences



The option "Restore window position, size, dock state and table settings" setting allows running scripts in a "safe mode" without loading stored settings. The new dialog for indirect errors points to it:



Documentation changes

Functions are now organized in multi-level sections. The sections can themselves host documentation describing the functions within.
(Note that this additional information is not present in REAPER's auto-generated documentation.)





Breaking changes

Scripts including imgui.lua to request an API compatible with v0.7.2 or older are not affected by the removal of AttachFont, DetachFont and the renaming of keyboard modifier constants.

EDIT: Released a hotfix for missing shims for Key_Mod* in imgui.lua.

Last edited by cfillion; 11-27-2022 at 02:31 PM. Reason: fix v1.89.1's link–thanks Edgemeal!
cfillion is offline   Reply With Quote
Old 11-27-2022, 02:03 PM   #645
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by cfillion View Post
Code:
• Update dear imgui to v1.89.1 (v1.89 release notes, v1.89.1)
The link for v1.89.1 is broken, missing 1st 'h'

Thanks for the updates!
Edgemeal is offline   Reply With Quote
Old 11-27-2022, 03:07 PM   #646
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by cfillion View Post
User preferences

Interesting, (how) can extensions put stuff in Reaper preferences?
nofish is offline   Reply With Quote
Old 11-27-2022, 03:33 PM   #647
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by nofish View Post
Interesting, (how) can extensions put stuff in Reaper preferences?
It's prefs_page_register_t and plugin_register("prefpage") from reaper_plugin.h (see settings.cpp).
cfillion is offline   Reply With Quote
Old 11-27-2022, 04:17 PM   #648
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by cfillion View Post
It's prefs_page_register_t and plugin_register("prefpage") from reaper_plugin.h (see settings.cpp).
I think it's a first that someone ever used this. :P
nofish is offline   Reply With Quote
Old 11-27-2022, 10:59 PM   #649
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Quote:
Originally Posted by cfillion View Post
ReaImGui 0.8

TL;DR: Implemented bitmap images (PNG/JPEG)


Dreams came true ))) !
Thanks!
kartalex is offline   Reply With Quote
Old 11-28-2022, 05:31 AM   #650
edkashinsky
Human being with feelings
 
Join Date: Dec 2021
Posts: 61
Default Reaper crash on ReaImGui v.0.8.0

Hello, there! I've noticed that functions reaper.ImGui_AttachFont (and DetachFont) changed to reaper.ImGui_Attach in new version of API. But when I use this function on my Mac, reaper crashes. What am I doing wrong?
edkashinsky is offline   Reply With Quote
Old 11-28-2022, 03:51 PM   #651
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by edkashinsky View Post
But when I use this function on my Mac, reaper crashes
Released version 0.8.1 to fix this:

Code:
• imgui.lua: add shims for dear imgui 1.89's obsoleted window boundary extension via SetCursorPos/SetCursorScreenPos (ocornut/imgui#5548)
• macOS: fix the Metal renderer crashing (observed on macOS 12 ARM)

Last edited by cfillion; 11-28-2022 at 04:59 PM.
cfillion is offline   Reply With Quote
Old 11-29-2022, 03:51 AM   #652
edkashinsky
Human being with feelings
 
Join Date: Dec 2021
Posts: 61
Default

Quote:
Originally Posted by cfillion View Post
Released version 0.8.1 to fix this:

Code:
• imgui.lua: add shims for dear imgui 1.89's obsoleted window boundary extension via SetCursorPos/SetCursorScreenPos (ocornut/imgui#5548)
• macOS: fix the Metal renderer crashing (observed on macOS 12 ARM)
Now it works! Thank you @cfillion!
edkashinsky is offline   Reply With Quote
Old 11-29-2022, 01:39 PM   #653
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by cfillion View Post
User preferences
Random nitpicky find and not sure it's on Reaper's or your code side, but I noticed when having the ReaImGui page active the 'Find' button doesn't seem to work anymore (Win10) (it also doesn't find words which are actually present, not shown in the gif).

nofish is offline   Reply With Quote
Old 11-29-2022, 03:10 PM   #654
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by nofish View Post
Random nitpicky find and not sure it's on Reaper's or your code side, but I noticed when having the ReaImGui page active the 'Find' button doesn't seem to work anymore (Win10) (it also doesn't find words which are actually present, not shown in the gif).
Noticed that too but couldn't find the cause. Strangely, finding words present in the ReaImGui page works (only) from other pages.
cfillion is offline   Reply With Quote
Old 12-02-2022, 05:31 AM   #655
Sonorityscape
Human being with feelings
 
Sonorityscape's Avatar
 
Join Date: Aug 2016
Posts: 91
Default

Is it possible to include widget values (slider positions, text boxes, etc.) in a saved state from instance to instance?
Sonorityscape is offline   Reply With Quote
Old 12-02-2022, 06:44 AM   #656
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by Sonorityscape View Post
Is it possible to include widget values (slider positions, text boxes, etc.) in a saved state from instance to instance?
Not specific to ReaImGui: SetExtState, SetProjExtState, BR_Win32_WritePrivateProfileString or just writing to a file.
cfillion is offline   Reply With Quote
Old 12-03-2022, 02:48 AM   #657
McSound
Human being with feelings
 
McSound's Avatar
 
Join Date: Jun 2021
Location: Moscow, Russia
Posts: 282
Default

Now, with new image support, the only thing still left for me - full unicode support for button, menu, label, so they could display text in different languages) Please let it happen!

Last edited by McSound; 12-03-2022 at 02:59 AM.
McSound is online now   Reply With Quote
Old 12-03-2022, 06:12 AM   #658
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by McSound View Post
Now, with new image support, the only thing still left for me - full unicode support for button, menu, label, so they could display text in different languages) Please let it happen!
I want that too: I consider those font limitations to be blocking ReaImGui from reaching v1.0. (Part of it needs to be made on dear imgui's side for that to happen.) (The move from AttachFont to just Attach is in preparation for that, though it's unlikely to be soon.)
cfillion is offline   Reply With Quote
Old 12-03-2022, 10:04 AM   #659
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

After many tries I give up. How should I use ImGui_ConfigVar_WindowsMoveFromTitleBarOnly()? I've tried to put it as config flag inside ImGui_CreateContext. Also as a glag inside ImGui_Begin. Tried ImGui_SetConfigVar, but not sure I'm doing it right. Demo script uses it as a checkbox state, but it didn't help me to understand how to implement it.
vitalker is offline   Reply With Quote
Old 12-03-2022, 10:14 AM   #660
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Code:
reaper.ImGui_SetConfigVar(ctx, reaper.ImGui_ConfigVar_WindowsMoveFromTitleBarOnly(), 1)
cfillion is offline   Reply With Quote
Old 12-03-2022, 10:18 AM   #661
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Quote:
Originally Posted by cfillion View Post
Code:
reaper.ImGui_SetConfigVar(ctx, reaper.ImGui_ConfigVar_WindowsMoveFromTitleBarOnly(), 1)
Thank you so much! Finally I got it working. Does 1 mean toggle state, because I couldn't find it?
vitalker is offline   Reply With Quote
Old 12-03-2022, 10:19 AM   #662
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

1 means yes/true, 0 means no/false.

Last edited by cfillion; 12-03-2022 at 10:24 AM.
cfillion is offline   Reply With Quote
Old 12-03-2022, 11:39 AM   #663
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Quote:
Originally Posted by cfillion View Post
1 means yes/true, 0 means no/false.
Thank you, that's what I thought.
vitalker is offline   Reply With Quote
Old 12-03-2022, 12:48 PM   #664
McSound
Human being with feelings
 
McSound's Avatar
 
Join Date: Jun 2021
Location: Moscow, Russia
Posts: 282
Default

Quote:
Originally Posted by cfillion View Post
...it's unlikely to be soon.)
Ahh! That's a big bummer! But if it's not for editable text, we can always use an image with a sign on any language) This is at least something!
McSound is online now   Reply With Quote
Old 12-04-2022, 01:08 PM   #665
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Does anyone know a way to scale/zoom whole GUI content? Like if you have 200x200 px for 100%/1.0 and scale/zoom is 200%/2.0, you'll get 400x400 px and all the contents (fonts, buttons etc.) doubled in size. There is no anything like this in any existing scripts, even demo one. Rodilab in color palette has something like this only for color blocks, not fonts and any other things. I was looking for DPI, but found only getting DPI scale, nothing about setting. I was trying to find resizing functions, zooming functions and many other, no success.
vitalker is offline   Reply With Quote
Old 12-04-2022, 01:13 PM   #666
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

Quote:
Originally Posted by vitalker View Post
Does anyone know a way to scale/zoom whole GUI content? Like if you have 200x200 px for 100%/1.0 and scale/zoom is 200%/2.0, you'll get 400x400 px and all the contents (fonts, buttons etc.) doubled in size. There is no anything like this in any existing scripts, even demo one. Rodilab in color palette has something like this only for color blocks, not fonts and any other things. I was looking for DPI, but found only getting DPI scale, nothing about setting. I was trying to find resizing functions, zooming functions and many other, no success.
if you change the font size all widgets will be rescaled.
daniellumertz is online now   Reply With Quote
Old 12-04-2022, 01:17 PM   #667
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Quote:
Originally Posted by daniellumertz View Post
if you change the font size all widgets will be rescaled.
So it is enough to just rescale fonts? That's great, I didn't think of it. Thank you so much. Before starting rewriting my script to ReaImGui, I was using modified version of your mod of Eugen's GUI library and it was pretty clear how to scale things there, but CPU consuming is better with RIG. Thank you again, Daniel!
vitalker is offline   Reply With Quote
Old 12-04-2022, 09:06 PM   #668
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

Quote:
Originally Posted by vitalker View Post
So it is enough to just rescale fonts? That's great, I didn't think of it. Thank you so much. Before starting rewriting my script to ReaImGui, I was using modified version of your mod of Eugen's GUI library and it was pretty clear how to scale things there, but CPU consuming is better with RIG. Thank you again, Daniel!
Ohhh that script, it was my first task using reaimgui I wouldn't use it as a resource for anything >.< ... Mine modern scripts got much better and easier to maintain
daniellumertz is online now   Reply With Quote
Old 12-04-2022, 11:54 PM   #669
BryanChi
Human being with feelings
 
Join Date: Jan 2019
Location: Taiwan
Posts: 439
Default

Omg image is available now?! Sweet!! Thank you cfillion!
BryanChi is offline   Reply With Quote
Old 12-05-2022, 12:14 AM   #670
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Quote:
Originally Posted by daniellumertz View Post
Ohhh that script, it was my first task using reaimgui I wouldn't use it as a resource for anything >.< ... Mine modern scripts got much better and easier to maintain
No, no, I was talking about your GUI library, which is a mod to Eugen's GUI. And I've made some modifications to make it working: https://forum.cockos.com/showpost.ph...&postcount=101
vitalker is offline   Reply With Quote
Old 12-05-2022, 08:39 PM   #671
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

Quote:
Originally Posted by vitalker View Post
No, no, I was talking about your GUI library, which is a mod to Eugen's GUI. And I've made some modifications to make it working: https://forum.cockos.com/showpost.ph...&postcount=101
ahhhh yeahh, I like that GUI as well. I though about another script... After you make your mods post it there will be good to keep it kinda alive
daniellumertz is online now   Reply With Quote
Old 12-06-2022, 02:30 AM   #672
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,336
Default

Quote:
Originally Posted by daniellumertz View Post
ahhhh yeahh, I like that GUI as well. I though about another script... After you make your mods post it there will be good to keep it kinda alive
Well that mod was made specifially for one script, which is still in development (unfortunately had to switch to ReaImGui, because that library using so much of CPU), by I will. Thanks!
vitalker is offline   Reply With Quote
Old 12-06-2022, 06:05 AM   #673
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default

Win10, the font is scaled to 150%, and two error prompts pop up. If the font scaling is set to 100%, it can be used normally.
In addition, in Windows 8.1, I scaled the font to 125%, which was available in the test, but the mouse positioning of the button was biased.

instmark
ImGui assertion failed

The ImGui context was left in an invalid state and cannot continue.


Report this problem along with the error description below to the script or plugin developer.

(Disable state restoration in Preferences > Plug-ins > ReaImGui to reset saved settings.)
g.WithinFrameScope && "Forgot to call ImGu:NewFrame()?"

ReaScript err
insert Marker V2.lua:578: ImGui_PointConvertNative: ImGui assertion failed: ImRect(mon.MainPos, mon.MainPos + mon.MainSize).Contains(ImRect(mon.WorkPos, mon.WorkPos + mon.WorkSize)) && "Monitor work bounds not setup properly. If you don't have work area information, just copy MainPos/MainSize into them."

Line 578 code: x, y = reaper.ImGui_PointConvertNative(ctx, x, y)

Last edited by dangguidan; 12-06-2022 at 06:18 AM.
dangguidan is offline   Reply With Quote
Old 12-06-2022, 11:13 AM   #674
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by dangguidan View Post
Win10, the font is scaled to 150%, and two error prompts pop up. If the font scaling is set to 100%, it can be used normally.
In addition, in Windows 8.1, I scaled the font to 125%, which was available in the test, but the mouse positioning of the button was biased.

ImGui assertion failed: ImRect(mon.MainPos, mon.MainPos + mon.MainSize).Contains(ImRect(mon.WorkPos, mon.WorkPos + mon.WorkSize)) && "Monitor work bounds not setup properly. If you don't have work area information, just copy MainPos/MainSize into them."

Line 578 code: x, y = reaper.ImGui_PointConvertNative(ctx, x, y)
What is your monitor arrangement? (Position, resolution, scaling of each)

What is REAPER's HiDPI mode on both of your Windows versions? Preferences > Advanced UI/system tweaks.

Last edited by cfillion; 12-06-2022 at 11:21 AM.
cfillion is offline   Reply With Quote
Old 12-07-2022, 06:55 AM   #675
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default

Quote:
Originally Posted by cfillion View Post
What is your monitor arrangement? (Position, resolution, scaling of each)

What is REAPER's HiDPI mode on both of your Windows versions? Preferences > Advanced UI/system tweaks.
Main screen :27 inches , 2560*1440 Scale 150%
Subscreen : 17 inches , 1920*1080 Scale 150%
REAPER's HiDPI mode:Multimonitor aware

Now it is temporarily returned to v0.7.2 for normal use.
dangguidan is offline   Reply With Quote
Old 12-07-2022, 11:53 PM   #676
BryanChi
Human being with feelings
 
Join Date: Jan 2019
Location: Taiwan
Posts: 439
Default image tilt?

Thank you again for adding image support!
Just checking, tilting image is not possible at the moment?
BryanChi is offline   Reply With Quote
Old 12-08-2022, 12:36 AM   #677
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

DrawList_AddImageQuad can do rotation: it takes coordinates of the four corners.



Code:
dofile(reaper.GetResourcePath() ..
       '/Scripts/ReaTeam Extensions/API/imgui.lua')('0.8')

local ctx = reaper.ImGui_CreateContext('My script')
local img = reaper.ImGui_CreateImage('/path/to/image.png')

local function ImageAngle(ctx, img, angle, w, h)
  local x, y = reaper.ImGui_GetCursorScreenPos(ctx)
  local cx, cy = x + (w/2), y + (h/2)
  local rotate = function(x, y)
    x, y = x - cx, y - cy
    return (x*math.cos(angle) - y*math.sin(angle)) + cx,
           (x*math.sin(angle) + y*math.cos(angle)) + cy
  end
  local dl = reaper.ImGui_GetWindowDrawList(ctx)
  local p1_x, p1_y = rotate(x,   y)
  local p2_x, p2_y = rotate(x+w, y)
  local p3_x, p3_y = rotate(x+w, y+h)
  local p4_x, p4_y = rotate(x,   y+h)
  reaper.ImGui_DrawList_AddImageQuad(dl, img,
    p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y)
  reaper.ImGui_Dummy(ctx, w, h)
end

local function loop()
  rv, angle = reaper.ImGui_SliderAngle(ctx, 'angle', angle or 0)
  ImageAngle(ctx, img, angle, reaper.ImGui_Image_GetSize(img))
  reaper.defer(loop)
end

reaper.defer(loop)

Last edited by cfillion; 12-08-2022 at 01:11 AM.
cfillion is offline   Reply With Quote
Old 12-08-2022, 05:30 AM   #678
BryanChi
Human being with feelings
 
Join Date: Jan 2019
Location: Taiwan
Posts: 439
Default

Quote:
Originally Posted by cfillion View Post
DrawList_AddImageQuad can do rotation: it takes coordinates of the four corners.



Code:
dofile(reaper.GetResourcePath() ..
       '/Scripts/ReaTeam Extensions/API/imgui.lua')('0.8')

local ctx = reaper.ImGui_CreateContext('My script')
local img = reaper.ImGui_CreateImage('/path/to/image.png')

local function ImageAngle(ctx, img, angle, w, h)
  local x, y = reaper.ImGui_GetCursorScreenPos(ctx)
  local cx, cy = x + (w/2), y + (h/2)
  local rotate = function(x, y)
    x, y = x - cx, y - cy
    return (x*math.cos(angle) - y*math.sin(angle)) + cx,
           (x*math.sin(angle) + y*math.cos(angle)) + cy
  end
  local dl = reaper.ImGui_GetWindowDrawList(ctx)
  local p1_x, p1_y = rotate(x,   y)
  local p2_x, p2_y = rotate(x+w, y)
  local p3_x, p3_y = rotate(x+w, y+h)
  local p4_x, p4_y = rotate(x,   y+h)
  reaper.ImGui_DrawList_AddImageQuad(dl, img,
    p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, p4_x, p4_y)
  reaper.ImGui_Dummy(ctx, w, h)
end

local function loop()
  rv, angle = reaper.ImGui_SliderAngle(ctx, 'angle', angle or 0)
  ImageAngle(ctx, img, angle, reaper.ImGui_Image_GetSize(img))
  reaper.defer(loop)
end

reaper.defer(loop)
That's so cool!! We can make custom knobs now then, thank you again!
BryanChi is offline   Reply With Quote
Old 12-09-2022, 08:46 AM   #679
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Is there currently a way, to add an input field, that supports showing characters like the €-symbol?
The following code will add the typed €-symbol into the variable text but will not show it in the inputfield.

Code:
local ctx = reaper.ImGui_CreateContext('My script')
local sans_serif = reaper.ImGui_CreateFont('Tahoma', 23)
reaper.ImGui_Attach(ctx, sans_serif)

local function myWindow(w, h)
  -- shows only ? when typing the euro-symbol(ctrl+alt+E with german keymap), though it
  -- will be correctly entered into variable text..
  rv, text = reaper.ImGui_InputText(ctx, 'text field', text, nil)
end

local function loop()
  reaper.ImGui_PushFont(ctx, sans_serif)
  reaper.ImGui_SetNextWindowSize(ctx, 400, 80, reaper.ImGui_Cond_FirstUseEver())
  local visible, open = reaper.ImGui_Begin(ctx, 'My window', true)
  if visible then myWindow() reaper.ImGui_End(ctx) end
  reaper.ImGui_PopFont(ctx)
  
  if open then reaper.defer(loop) end
end

reaper.defer(loop)
How can I circumvent this?

Or is there a way to get the typed character(not keycode), so I could code my own input-field instead?

Edit:

I think I found a solution for my second question.
Code:
-- get the first unicode-charactercode from the character-queue
retval, unicode_char = reaper.ImGui_GetInputQueueCharacter(ctx, 0)

-- convert the code into a character
Converted=utf8.char(unicode_char)
But I would still prefer to use ImgGui's own input-fields...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 12-09-2022 at 08:58 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-09-2022, 09:11 AM   #680
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,970
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
How can I circumvent this?
https://github.com/cfillion/reaimgui...ent-1023143021

€ is U+20AC which is outside of what ReaImGui currently renders from the font file. Adding the Currency Symbols block (U+20A0 to U+20CF, only up to 35 extra glyphs) would be easy enough for the next version.
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 11:59 AM.


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