You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In my plugin, placing a group of timing lines and scroll velocities will add data into a table, which is then saved in a bookmark for future use. The purpose of this is to easily be able to delete or modify all of the placed timing lines and notes. However, problems arise when the user does an undo action; this does not undo any of the code, leading to a faulty tabular entry.
Describe the solution you'd like
The syntax I'm thinking is similar to how web APIs are constructed:
This syntax is very versatile and allows new features to be implemented very easily. Some ideas I have for emitted events and potential syntaxes would be the following:
state.on("load", loadFunction)
state.on("exit", exitFunction)
state.on("redo", redoFunction)
state.on("placeHitObject", function (hitObject) doSomething() end)
state.on("removeHitObject"), function (hitObject) doSomething() end)
Describe alternatives you've considered
Of course, it's possible to create keybind wrappers using imgui.IsKeyPressed() and imgui.IsKeyDown(), like the following example to detect undos:
if (imgui.IsKeyDown(LeftControl) andimgui.IsKeyPressed(keys.Z)) then-- execute undo actionend
However, there are a couple issues with this:
Other actions are possibly rebindable, and plugins are not exposed to the user's keybind settings
IsKeyPressed() is quite unreliable with many plugin tabs open, as conflicts between the editor and the plugin happen very often. SV makers can testify that sometimes, it takes 2-3 key presses to execute an action that should only take one.
Keybind wrappers are very limited, as there is no existing support for detecting clicks on a non-ImGui element.
Alternatively, we could detect current state and previously saved state and detect changes. In my AFFINE example, lineOffsets are actually saved. Technically, something like this could be possible:
functiondraw()
imgui.Begin("Window")
localpreviousLineCount=state.GetValue("lineCount") or0locallineCount=#map.TimingPointslocaldesiredLineDifference=-5-- Assume that the previous action of placing lines placed 5 of them. Thus, we are looking for when 5 lines are deleted.if (lineCount-previousLineCount==desiredLineDifference) then-- Since the number of lines that were deleted was equal to however -- many lines was placed, assume an undo occurredendstate.SetValue("lineCount", lineCount)
imgui.End()
end
Hopefully it's easy to see why this isn't viable at a large scale.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In my plugin, placing a group of timing lines and scroll velocities will add data into a table, which is then saved in a bookmark for future use. The purpose of this is to easily be able to delete or modify all of the placed timing lines and notes. However, problems arise when the user does an undo action; this does not undo any of the code, leading to a faulty tabular entry.
Describe the solution you'd like
The syntax I'm thinking is similar to how web APIs are constructed:
This syntax is very versatile and allows new features to be implemented very easily. Some ideas I have for emitted events and potential syntaxes would be the following:
Describe alternatives you've considered
Of course, it's possible to create keybind wrappers using
imgui.IsKeyPressed()
andimgui.IsKeyDown()
, like the following example to detect undos:However, there are a couple issues with this:
IsKeyPressed()
is quite unreliable with many plugin tabs open, as conflicts between the editor and the plugin happen very often. SV makers can testify that sometimes, it takes 2-3 key presses to execute an action that should only take one.Alternatively, we could detect current state and previously saved state and detect changes. In my AFFINE example, lineOffsets are actually saved. Technically, something like this could be possible:
Hopefully it's easy to see why this isn't viable at a large scale.
Additional context
No response
The text was updated successfully, but these errors were encountered: