feat: Lua REPL for interactive scripting in mesh viewers#5
Open
mtao wants to merge 2 commits intofeature/image-infrastructurefrom
Open
feat: Lua REPL for interactive scripting in mesh viewers#5mtao wants to merge 2 commits intofeature/image-infrastructurefrom
mtao wants to merge 2 commits intofeature/image-infrastructurefrom
Conversation
Implements a 3-layer Lua REPL system: Layer 1 - Core engine (LuaRepl): sol::state via pimpl, execute/history/ output buffer, print() capture, expression-then-statement evaluation, post-execute callback hook, and lua_state() accessor. Layer 2 - Geometry bindings: load_bindings(sol::state_view) registering BoundingBox3 usertype, bounding_box(mesh), and read_obj(path) that constructs quiver::Mesh<2> with vertex_positions/vertex_normals attributes. Layer 3 - Visualization frontends + scene glue: - ImGui panel: draw_lua_repl() free function with scrollable output, history navigation (up/down), and input field. - Qt widget: LuaReplWidget with QPlainTextEdit output + QLineEdit input, command_executed signal, and history navigation. - Scene wiring: both GLFW and Qt viewers create LuaRepl, load quiver + geometry bindings, set post-execute callback that calls MeshData::rediscover_attributes() on all scene meshes. Also adds MeshData::rediscover_attributes() for refreshing attribute lists after Lua scripts modify mesh data. Build-gated behind -Dlua=true meson option (default: false).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LuaReplwith sol2), geometry bindings (BoundingBox3,read_obj,bounding_box), and visualization frontends (ImGui panel + Qt widget)MeshDataattributes after script modificationsMeshData::rediscover_attributes()for syncing attribute lists when Lua scripts modify mesh dataArchitecture
core/LuaReplclass: sol::state via pimpl, execute/history/output buffer, print capturegeometry/load_bindings(): BoundingBox3 usertype, bounding_box(mesh), read_obj(path)visualization/draw_lua_repl()free function with scrollable output + history navigationvisualization/LuaReplWidgetwith QPlainTextEdit output + QLineEdit inputvisualization/tools/Build
Gated behind
-Dlua=truemeson option (default: false). Depends on sol2 and lua subprojects (redirect wraps to quiver's subprojects).Testing
All 65 tests pass. No new test suite yet — the REPL is an interactive tool best validated manually by loading a mesh and running Lua commands.