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.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Library: a single click uses a brush, alpha, VDM or material (#142, NicTanghe)
islandmed635059e4819b
diff --git a/changes/feat-library-single-click.md b/changes/feat-library-single-click.mdnew file mode 100644index 00000000..8365587e--- /dev/null+++ b/changes/feat-library-single-click.md@@ -0,0 +1 @@+- Library: a single click now uses a brush, alpha, VDM or material (double-click still works; models, projects and folders still open with a double-click). Thanks @NicTanghe (#142).diff --git a/docs/guide/interface.md b/docs/guide/interface.mdindex a0172ac9..23b84c3a 100644--- a/docs/guide/interface.md+++ b/docs/guide/interface.md@@ -338,13 +338,13 @@ start-up (see [Preferences](#interface-preferences)).-| Tab | Shows | Double-click |+| Tab | Shows | Double-click (a click for brushes, alphas and materials) ||---|---|---|| **Project** | Projects (`.sfproj`) in your library and recently opened projects | Open the project || **Tool** | Sphere, Plane and Cube, and model files in your library | Open (replaces the scene) |-| **Brush** | Every brush: built-in, custom and `.sfbrush` files, and the VDM brushes (built-in ones too) | Select or load the brush |-| **Alpha** | Round, Square, Noise, the twelve built-in patterns and images in your Alphas folder | Use as the brush alpha |-| **Material** | The Lit Spheres (your own included) and Studio | Use the material |+| **Brush** | Every brush: built-in, custom and `.sfbrush` files, and the VDM brushes (built-in ones too) | Select or load the brush (one click) |+| **Alpha** | Round, Square, Noise, the twelve built-in patterns and images in your Alphas folder | Use as the brush alpha (one click) |+| **Material** | The Lit Spheres (your own included) and Studio | Use the material (one click) || **Image** | Reference images in your library | A menu: Generate 3D, relief, inflate, project onto the model, use as alpha || **Splats** | Gaussian splat captures (`.ply`, `.splat`) | Open the capture as a reference || **Snapshots** | The autosave and your snapshots, newest first | Open it |@@ -355,7 +355,7 @@ Working with the strip:- **Shift+double-click** a model, project or primitive to append it to the scene as a new Part instead ofreplacing the scene.- Drag sideways (or use the mouse wheel) to scroll through the strip. A drag of more than a few pixels scrubs,- so a plain click still selects.+ so a plain click still selects (and uses a brush, alpha or material).- Drag a tile down out of the Library onto the canvas to load it, like a double-click.- Folders open with a double-click; the first tile inside a folder goes back up. The arrows at the top go backand forward through tabs and folders, and the breadcrumb shows where you are.diff --git a/src/app/LibraryBrowser.cpp b/src/app/LibraryBrowser.cppindex 7a7553f5..ab210a3c 100644--- a/src/app/LibraryBrowser.cpp+++ b/src/app/LibraryBrowser.cpp@@ -449,6 +449,12 @@ ImTextureID LibraryBrowser::thumbnail(App& app, const AssetEntry& e) {// Actions// ---------------------------------------------------------------------------+// Kinds a single click applies (nothing to lose); the rest open, replace or navigate on a double-click.+static bool appliesOnClick(AssetKind k) {+ return k == AssetKind::BrushType || k == AssetKind::Recipe || k == AssetKind::BrushFile || k == AssetKind::Vdm ||+ k == AssetKind::Alpha || k == AssetKind::AlphaFile || k == AssetKind::Material;+}+void LibraryBrowser::activate(App& app, const AssetEntry& e, bool append) {switch (e.kind) {case AssetKind::Up: {@@ -964,8 +970,13 @@ void LibraryBrowser::draw(App& app, const CanvasRect& canvas) {const bool clicked = AssetTile(id.c_str(), tex, glyphFor(e.kind), e.name, tile, selected);if (ImGui::IsItemActivated()) pressTile_ = int(i);if (clicked && !scrubbed_) selected_ = key;+ // Brushes, alphas, VDMs and materials apply on a click (#142); the second click of a double-click+ // does not apply again. Files and folders still need a double-click (they replace or navigate).+ const bool oneClick = appliesOnClick(e.kind);+ if (clicked && !scrubbed_ && oneClick && io.MouseClickedLastCount[ImGuiMouseButton_Left] < 2)+ activate(app, e, false);const bool doubleClicked = ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left);- if (doubleClicked && !scrubbed_) {+ if (doubleClicked && !scrubbed_ && !oneClick) {selected_ = key;activate(app, e, (SDL_GetModState() & SDL_KMOD_SHIFT) != 0);}@@ -982,6 +993,7 @@ void LibraryBrowser::draw(App& app, const CanvasRect& canvas) {: e.kind == AssetKind::Mesh || e.kind == AssetKind::Primitive || e.kind == AssetKind::Project? "Double-click to open (replaces the scene); Shift+double-click appends it as a Part.": e.kind == AssetKind::Image ? "Double-click for what to do with the image."+ : oneClick ? "Click to use it.": "Double-click to use it.";if (e.size) details += "\n" + sizeText(e.size) + ", modified " + dateText(e.mtime);ui::HelpText(e.name.c_str(), nullptr, details.c_str(), e.path.empty() ? "Library" : e.path.c_str());diff --git a/tests/ui/library.sfui b/tests/ui/library.sfuiindex 6c8432fc..3ecfd212 100644--- a/tests/ui/library.sfui+++ b/tests/ui/library.sfui@@ -46,12 +46,19 @@ expect "Library/.."click "Library/###Back"expect "Library/Sphere"-# Materials and brushes load with a double-click too.+# Materials, brushes and alphas apply with a single click (#142); a double-click still works.click "Library/Material"expect "Library/Chrome"-double_click "Library/Chrome"+click "Library/Chrome"expect_status Material: Chrome+wait_idle 60+shot library-material-click+double_click "Library/Bronze"+expect_status Material: Bronzeclick "Library/Brush"+expect "Library/Clay"+click "Library/Clay"+expect_status Brush: Clayexpect "Library/Sharp Crease"double_click "Library/Sharp Crease"expect_status Brush: Sharp Crease@@ -74,6 +81,14 @@ click "Library/1"click "Library/###Back"expect "Library/Chrome"+# Alphas too: a click sets the brush alpha.+click "Library/Alpha"+expect "Library/Square"+click "Library/Square"+expect_status Alpha 'Square'+wait_idle 60+shot library-alpha-click+# QuickSave: a timestamped copy in the library's QuickSave folder, listed newest first.click "Library/Snapshots"expect_text Save Snapshot keeps timestamped copies