Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Merge branch 'ui-lightbox'

islandmeda68611967abb
diff --cc CMakeLists.txt
index 00e7c37e,8b8559c2..8faba9ba
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -128,10 -128,10 +128,13 @@@ if(SCULPTFORGE_BUILD_APP
src/app/Actions.cpp
src/app/Ui.cpp
src/app/UiLayout.cpp
- src/app/LightBoxStubs.cpp
+ src/app/CommandPalette.cpp
+ src/app/Console.cpp
+ src/app/Config.cpp
+ src/app/LightBox.cpp
+ src/app/Thumbnails.cpp
+ src/app/Pickers.cpp
+ src/app/AssetLibrary.cpp
src/app/PanelMasking.cpp
src/app/PanelPolygroups.cpp
src/app/PanelBrushes.cpp
@@@ -308,14 -308,9 +311,14 @@@ endif(
if(SCULPTFORGE_BUILD_TESTS)
# tests/test_main.cpp plus every tests/test_*.cpp (add a file to add tests; see tests/TestHarness.h).
file(GLOB SCULPTFORGE_TEST_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_*.cpp)
- add_executable(sculptforge_tests ${SCULPTFORGE_TEST_SOURCES} src/cli/McpServer.cpp)
+ add_executable(sculptforge_tests ${SCULPTFORGE_TEST_SOURCES} src/cli/McpServer.cpp src/app/AssetLibrary.cpp)
target_include_directories(sculptforge_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests)
target_link_libraries(sculptforge_tests PRIVATE sculptforge_core sculptforge_ai)
+ if(SCULPTFORGE_BUILD_APP) # the action registry (key chords, shortcut overrides) needs SDL's key names
+ target_sources(sculptforge_tests PRIVATE src/app/Actions.cpp)
+ target_link_libraries(sculptforge_tests PRIVATE SDL3::SDL3)
+ target_compile_definitions(sculptforge_tests PRIVATE SF_TEST_ACTIONS)
+ endif()
if(MSVC)
target_compile_options(sculptforge_tests PRIVATE /utf-8)
endif()
diff --cc src/app/App.cpp
index 4b7a8f77,42326419..8218a3ff
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@@ -221,7 -218,7 +221,8 @@@ bool App::init(const AppOptions& option
for (int i = 0; i < int(FileAction::Count); ++i) dialogRequests_[i] = {this, FileAction(i)};
initBrushLibrary(); // before a project can bring its own brushes
initProject(); // before opening anything, so it lands in the recent files
+ initActions(); // the default shortcuts and every command, for keys, help and the command palette
+ initLightBox();
runCommand("new_sphere");
if (!options.openPath.empty()) openPath(options.openPath);
if (!options.script.empty()) {
@@@ -610,8 -608,47 +612,9 @@@ void App::onMouseUp()
}
void App::onKey(SDL_Keycode key, SDL_Keymod mod) {
- if (lightBoxKey(key, mod)) return;
- const bool ctrl = ctrlDown(mod);
- const bool shift = (mod & SDL_KMOD_SHIFT) != 0;
- if (ctrl) {
- switch (key) {
- case SDLK_Z: runCommand(shift ? "redo" : "undo"); break;
- case SDLK_Y: runCommand("redo"); break;
- case SDLK_D: runCommand("subdivide"); break;
- case SDLK_O: confirmDiscard([this] { openFileDialog(); }); break;
- case SDLK_S: saveProjectAs(shift); break;
- case SDLK_N: confirmDiscard([this] { runCommand("new_sphere"); }); break;
- case SDLK_E: saveFileDialog(FileAction::ExportGlb); break;
- case SDLK_U: sendToUnreal(); break;
- case SDLK_V: pasteBrush(); break; // a brush code or .sfbrush text
- default: break;
- }
- return;
- }
- switch (key) {
- case SDLK_LEFTBRACKET: radiusPx_ = std::max(2.0f, radiusPx_ / 1.1f); break;
- case SDLK_RIGHTBRACKET: radiusPx_ = std::min(800.0f, radiusPx_ * 1.1f); break;
- case SDLK_X: symmetry_.x = !symmetry_.x; break;
- case SDLK_W: renderSettings_.wireframe = !renderSettings_.wireframe; break;
- case SDLK_F: camera_.frame(sceneBounds()); break;
- case SDLK_F1: showHelp_ = !showHelp_; break;
- case SDLK_P:
- paintMode_ = !paintMode_;
- if (paintMode_) showPolypaintPanel_ = true; // colour picker at hand
- break;
- case SDLK_C: pickColorUnderCursor(); break;
- default:
- // 1-9 pick the first nine brushes, 0 the tenth.
- if (key >= SDLK_1 && key <= SDLK_9) {
- brush_ = BrushType(key - SDLK_1);
- paintMode_ = false;
- } else if (key == SDLK_0) {
- brush_ = BrushType(9);
- paintMode_ = false;
- }
- break;
- }
+ if (captureShortcutKey(key, mod)) return; // Ctrl+Alt+click a button, then press its new key
+ actions_.handleKey(key, mod); // the shortcut map: Config.cpp initActions()
++ initLightBox();
}
// ---------------------------------------------------------------------------
diff --cc src/app/App.h
index 341a93e7,5b20a995..8772aa32
--- a/src/app/App.h
+++ b/src/app/App.h
@@@ -4,9 -4,7 +4,10 @@@
#include "ai/BrushAssistant.h"
#include "app/Actions.h"
+ #include "app/AssetLibrary.h"
+#include "app/CommandPalette.h"
+#include "app/Config.h"
+#include "app/Console.h"
#include "app/LightBox.h"
#include "app/Pickers.h"
#include "app/Thumbnails.h"