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 feat/goz: GoZ interoperability with ZBrush, plus STL

islandmed16a2ee2fae63
diff --cc CMakeLists.txt
index d334da0a,f1a38649..613bda07
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -109,10 -106,7 +112,11 @@@ if(SCULPTFORGE_BUILD_APP
src/app/main.cpp
src/app/App.cpp
src/app/Demo.cpp
+ src/app/PanelMasking.cpp
+ src/app/PanelPolygroups.cpp
+ src/app/PanelBrushes.cpp
+ src/app/PanelPolypaint.cpp
+ src/app/PanelGoz.cpp
src/render/GL.cpp
src/render/Camera.cpp
src/render/Renderer.cpp
diff --cc src/app/App.h
index 82a2c08f,0f717a17..cf803699
--- a/src/app/App.h
+++ b/src/app/App.h
@@@ -231,57 -230,23 +231,74 @@@ private
std::mutex pendingMutex_;
std::vector<PendingFile> pendingFiles_;
+ // Masking (PanelMasking.cpp): Ctrl strokes paint mask, Ctrl+Alt erases;
+ // Ctrl+click on the background inverts it, Ctrl+drag there clears it.
+ void drawMaskingSection();
+ void beginMaskStroke(float x, float y);
+ void maskCanvasMove(float x, float y);
+ void maskCanvasRelease();
+ bool strokeMask_ = false; // the current stroke edits the mask
+ float maskStrength_ = 1.0f;
+ int maskIterations_ = 1;
+ float cavityThreshold_ = 0.02f;
+ int maskGroup_ = 0;
+ float maskCanvasX_ = 0.0f, maskCanvasY_ = 0.0f;
+ bool maskCanvasMoved_ = false;
+ // Polygroups & visibility (PanelPolygroups.cpp): Ctrl+Shift click/drag.
+ bool polygroupMouseDown(float x, float y, SDL_Keymod mod); // true if it took the click
+ void polygroupMouseUp();
+ void drawPolygroupsSection();
+ void drawPolygroupOverlay();
+ bool hideRectActive_ = false;
+ float hideRectX_ = 0.0f, hideRectY_ = 0.0f;
+ float polygroupAngle_ = 30.0f;
+ // Stroke types, alphas and the extra brushes (PanelBrushes.cpp).
+ void drawBrushOptions();
+ void snakeHookTo(float x, float y);
+ void dragRectTo(float x, float y);
+ glm::vec3 screenUpVector(float angle) const; // camera up rotated by `angle` around the view axis
+ static void SDLCALL onAlphaChosen(void* userdata, const char* const* files, int filter);
+ StrokeType strokeType_ = StrokeType::Dots;
+ LazyMouse lazyMouse_;
+ Spray spray_;
+ float sprayScatter_ = 1.0f; // jitter radius as a fraction of brush size
+ glm::vec2 dragAnchor_{0.0f}; // DragRect: where the click landed (window pixels)
+ glm::vec3 dragAnchorHit_{0.0f};
+ float dabRadiusScale_ = 1.0f, dabStrengthScale_ = 1.0f, dabAngle_ = 0.0f; // per-dab overrides
+ bool alphaInvert_ = false;
+ std::mutex alphaMutex_;
+ std::string pendingAlphaPath_; // set by the file dialog thread
+ // Polypaint and MatCap materials (PanelPolypaint.cpp)
+ bool paintMode_ = false; // Paint brush: colour only, no sculpting (ZBrush Rgb on, Zadd off)
+ bool paintRgb_ = false; // also paint the colour while sculpting (ZBrush Rgb + Zadd)
+ bool strokePaint_ = false, strokeSculpt_ = true;
+ bool showPolypaintPanel_ = false; // off by default (keeps the viewport and demo videos clear)
+ void registerPaintUiCommands();
+ void drawPolypaintPanel();
+ void paintAt(const DabParams& p);
+ void pickColorUnderCursor();
+ // First paint stroke on a mesh without polypaint: undo restores this snapshot so the attribute goes away again.
+ std::unique_ptr<Mesh> paintSnapshot_;
+ void beginPaintStroke();
+ void finishPaintStroke(UndoRecord& record);
+ const BrushRecipe* strokeRecipe() const; // recipe the current stroke sculpts with (none for Smooth / paint only)
+ // ZBrush GoZ bridge and GoZ/STL files (PanelGoz.cpp).
+ void drawGozMenu();
+ void pollGoz();
+ void runGozCommand(const std::string& name, const Args& args = {});
+ static void SDLCALL onGozFileChosen(void* userdata, const char* const* files, int filter);
+ enum class GozFile { Import, Export, ExportStl, Count };
+ struct GozDialog {
+ App* app;
+ GozFile kind;
+ };
+ GozDialog gozDialogs_[int(GozFile::Count)];
+ std::vector<std::pair<GozFile, std::string>> gozPendingFiles_; // guarded by pendingMutex_
+ char gozFolder_[512] = ""; // custom GoZ root (empty = the platform default)
+ bool gozAutoReceive_ = false; // import whenever ZBrush rewrites GoZ_ObjectList.txt
+ long long gozListTime_ = 0; // last seen modification time of the object list
+ Uint64 gozLastPollNs_ = 0;
+ bool gozInitialised_ = false;
};
} // namespace sf
diff --cc src/core/Commands.cpp
index e1466e71,5fbe391a..aa9e882a
--- a/src/core/Commands.cpp
+++ b/src/core/Commands.cpp
@@@ -602,9 -605,7 +610,10 @@@ CommandRegistry::CommandRegistry()
return {true, s.str()};
}});
+ registerMaskingCommands(*this);
+ registerPolygroupCommands(*this);
+ registerPaintCommands(*this); // core/Polypaint.cpp
+ registerGozCommands(*this); // goz_import/export/send/receive, export_stl (io/GozCommands.cpp)
}
void CommandRegistry::add(Command cmd) { commands_.push_back(std::move(cmd)); }