-- Rykord Vertical Track FX List -- --NOTES-- -- want to make buttons resizable -- start…
- User
-- Rykord Vertical Track FX List -- --NOTES--
-- want to make buttons resizable -- start window on a specific position (maybe preset position, maybe last position)
--NONCODE SKELETON
--SKELETON--
-- windowposition ✅ -- window size
-- if CountSelectedTracks == 1 -- for fx (0,i) -- create blue button with the name of the fx ✅ -- if left click the button opens the fx window ✅ -- if right click the button deletes the fx ✅ -- if left drag the button is draggable and drags the fx ✅ -- if alt left click the fx is bypassed
-- gray button to add fx with spacing from other buttons and other color -- if pressed ✅ -- inserts fx at i + 1 ✅-- if CountSelectedTracks > 1
-- black buttton saying "MULTIPLE TRACKS ARE SELECTED", button is unclickable-- if CountSelectedTracks == 0 -- black button saying "SELECT A TRACK", button is unclickable
-- let keyboard shortcuts through
--FUNCTIONS-- local profiler = dofile(reaper.GetResourcePath() .. '/Scripts/ReaTeam Scripts/Development/cfillion_Lua profiler.lua') reaper.defer = profiler.defer
function print(...) reaper.ShowConsoleMsg(table.concat({...}, "\t") .. "\n") end
function hasStateChanged() local selected_track = reaper.GetSelectedTrack(0, 0) local fx_count = (selected_track and reaper.TrackFX_GetCount(selected_track)) or 0
if selected_track ~= prev_selected_track or fx_count ~= prev_fx_count then prev_selected_track = selected_track prev_fx_count = fx_count return true end return falseend
function IsAltKeyDown() local keyState = reaper.JS_Mouse_GetState(0) local altIsPressed = keyState & 8
return altIsPressed ~= 0end
function main()
if hasStateChanged() then local _, open = reaper.ImGui_Begin(ctx, "FX LIST", true) reaper.ImGui_PushFont(ctx, font_1) reaper.ImGui_SetNextWindowPos(ctx, x_position, y_position) if dock_position then reaper.ImGui_SetNextWindowDockID(ctx, -8) --CURRENT DOCK POSITION IS UNDER (DOCKID == -7)! end window_width, window_height = reaper.ImGui_GetWindowSize(ctx) button_width = window_width * 0.4 --SHOULD THESE BE GLOBAL? button_height = window_height * 0.12 --SHOULD THESE BE GLOBAL? reaper.ImGui_PushStyleVar(ctx, reaper.ImGui_StyleVar_FrameRounding(), 8) fx_list() reaper.ImGui_PopStyleVar(ctx, 1) reaper.ImGui_PopFont(ctx) if open then reaper.ImGui_End(ctx) reaper.defer(main) else local last_x_position, last_y_position = reaper.ImGui_GetWindowPos(ctx) reaper.SetExtState("RYKORD_TRACK_FX", "x_pos", last_x_position, true) reaper.SetExtState("RYKORD_TRACK_FX", "y_pos", last_y_position, true) local last_dock_position = reaper.ImGui_GetWindowDockID(ctx) reaper.SetExtState("RYKORD_TRACK_FX", "dock_position", last_dock_position, true) reaper.ImGui_End(ctx) end - Assistant
To optimize your script so that is not unnecessarily redrawn, you can add a condition to check if the current track selection or FX count have changed since the last frame. If neither has changed, you can skip the recreation and drawing process. This approach leverages the state tracking you have already implemented with .
- User
the thing is, i want the gui to stay. Is that called redrawing?
- Assistant