[Fixed 2.7 B6] Missing Key Events With External Plugin Editors In 2.7

This error takes some effort to reproduce, but the behavior is very strange, and it only acts this way in 2.7, so I think it’s a bug in 2.7 lua.

How to reproduce:

  1. Install the code into 2.7.

  2. Bind Global:View:Toggle Plugin Windows to some key

  3. Open energy xt 2.5.4 external editor(I found about half of vsti’s gives this error, energy xt is one example)

  4. Press toggle key, external editor disappears, “start of function” is displayed in terminal showing that the function is called

  5. Press the toggle key again, external editor reappears, “start of function” printed again.

  6. Press the toggle key a third time, nothing happens, the function doesn’t even get called - no “start of function” message.

  7. Press the key a fourth time, now the function gets called again.

  8. Repeat above in 2.6, everything works as it should.

Maybe the error is connected to this.

Here’s the code:
[luabox]
–[[
Toggles plugin windows on or off
–]]

renoise.tool():add_keybinding {
name = “Global:View:Toggle Plugin Windows”,
invoke = function(repeated) toggle_plugins() end
}

local openInstruments = {}

function toggle_plugins()
print(“start of function”)
– save all instruments where external editor is opened
local tempOpenInstruments = {}

for i,v in ipairs(renoise.song().instruments) do
if (v.plugin_properties.plugin_loaded) then
if (v.plugin_properties.plugin_device.external_editor_visible) then
table.insert(tempOpenInstruments,i)
end
end
end

if ( #tempOpenInstruments>0 ) then
– there are open plugin windows

– save and close instruments
openInstruments={}
for i,v in ipairs(tempOpenInstruments) do
table.insert(openInstruments,v)
end

for i,v in ipairs(openInstruments) do
renoise.song().instruments[v].plugin_properties.plugin_device.external_editor_visible=false
end

else
– there are no open plugin windows, restore saved

– restore instruments
if (#openInstruments>=1) then
for i,v in ipairs(openInstruments) do
renoise.song().instruments[v].plugin_properties.plugin_device.external_editor_visible=true
end
end

openInstruments = {}
end

end
[/luabox]

Yes, its the same thing, but done from Lua.

Actually this got broken with the attempts to fix hanging notes in plugin editors. Looks like in overall things are even worse now. Sigh.