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.

Transform status reads as a sentence: 'Moved 2,562 vertices' (Turned / Scaled / Transformed), no raw pivot floats; Gizmo counts grouped the same way

islandmed417a0973ea87
diff --git a/src/app/Gizmo.cpp b/src/app/Gizmo.cpp
index 9ce95a5b..8e6c76f0 100644
--- a/src/app/Gizmo.cpp
+++ b/src/app/Gizmo.cpp
@@ -695,7 +695,7 @@ void App::gizmoRelease() {
if (!sym.empty() && doc_.mesh.hasMask() && gizmo_.useMask) args["symmetry"] = sym;
if (gizmo_.all) args["all"] = true;
else if (gizmo_.folder && doc_.activePartInfo().folder) args["folder"] = true;
- status_ = std::string(label) + " " + readout + ": " + std::to_string(moved) + " vertices";
+ status_ = std::string(label) + " " + readout + ": " + vertexCountText(moved);
consoleEcho("transform", args, {true, status_});
updateTitle();
}
diff --git a/src/core/MeshTransform.cpp b/src/core/MeshTransform.cpp
index b347f29a..67d4425b 100644
--- a/src/core/MeshTransform.cpp
+++ b/src/core/MeshTransform.cpp
@@ -383,6 +383,12 @@ void TransformSession::cancel(Mesh& mesh, BVH& bvh) {
*this = TransformSession();
}
+std::string vertexCountText(size_t n) {
+ std::string digits = std::to_string(n);
+ for (int i = int(digits.size()) - 3; i > 0; i -= 3) digits.insert(size_t(i), 1, ',');
+ return digits + (n == 1 ? " vertex" : " vertices");
+}
+
bool partMovesWhole(const Document& doc, int index, bool useMask) {
const bool instance = doc.linkCount(index) > 1 || doc.parts[size_t(index)].moved();
return instance && !(useMask && doc.partMesh(index).hasMask());
diff --git a/src/core/MeshTransform.h b/src/core/MeshTransform.h
index 60d9f65a..90939f0a 100644
--- a/src/core/MeshTransform.h
+++ b/src/core/MeshTransform.h
@@ -123,6 +123,8 @@ public:
// True when a transform moves Part `index` as a whole, by its Part::transform: a linked copy (#94) or a Part
// moved that way before, unless `useMask` and it has a mask (then the mask's part of its mesh moves).
bool partMovesWhole(const Document& doc, int index, bool useMask);
+// "2,562 vertices" (the count grouped by thousands) for transform status lines.
+std::string vertexCountText(size_t n);
// Transforms Part `index` of `doc` (active or not) as one undoable step on that Part (a linked copy as a whole
// unless masked: partMovesWhole); on the active Part's mesh it records into the active sculpt layer
// (doc.activeLayer). Returns the number of vertices that moved.
diff --git a/src/core/TransformCommands.cpp b/src/core/TransformCommands.cpp
index 16df8f58..785e9221 100644
--- a/src/core/TransformCommands.cpp
+++ b/src/core/TransformCommands.cpp
@@ -49,12 +49,6 @@ bool vecArg(const Args& a, const std::string& key, glm::vec3& out, bool uniform,
return false;
}
-std::string fmt(const glm::vec3& v) {
- char buf[96];
- std::snprintf(buf, sizeof buf, "%g,%g,%g", double(v.x), double(v.y), double(v.z));
- return buf;
-}
-
CommandResult runTransform(Document& doc, const Args& a) {
std::string err;
glm::vec3 translate(0.0f), rotate(0.0f), scale(1.0f), orient(0.0f);
@@ -118,9 +112,12 @@ CommandResult runTransform(Document& doc, const Args& a) {
if (moved == 0)
return {false, useMask && doc.mesh.hasMask() ? "Nothing moved: everything is masked (masked=0 ignores the mask)"
: "Nothing moved: the Part is empty or hidden"};
- std::string msg = "Transformed " + std::to_string(moved) + " vertices";
+ // "Moved 2,562 vertices": the verb says what changed (the pivot is in the command's own arguments).
+ const bool moves = t.translate != glm::vec3(0.0f), turns = t.rotate != glm::quat(1, 0, 0, 0),
+ scales = t.scale != glm::vec3(1.0f);
+ const char* verb = int(moves) + int(turns) + int(scales) > 1 ? "Transformed" : moves ? "Moved" : turns ? "Turned" : "Scaled";
+ std::string msg = std::string(verb) + " " + vertexCountText(moved);
if (targets.size() > 1) msg += " in " + std::to_string(targets.size()) + " Parts";
- msg += " about " + fmt(t.pivot);
return {true, msg};
}
diff --git a/tests/test_transform.cpp b/tests/test_transform.cpp
index 5318bb0b..407f7a32 100644
--- a/tests/test_transform.cpp
+++ b/tests/test_transform.cpp
@@ -60,13 +60,26 @@ Mesh makeArm(int subdivisions = 4) {
TEST(transform_translate_is_exact) {
Document d = makeDoc(makeIcosphere(3));
const auto before = d.mesh.positions;
- CHECK(run(d, "transform", {{"translate", std::string("0.25,-1,3")}}).ok);
+ const CommandResult moved = run(d, "transform", {{"translate", std::string("0.25,-1,3")}});
+ CHECK(moved.ok);
+ CHECK(moved.message == "Moved " + vertexCountText(before.size())); // a plain sentence, no raw pivot floats
bool exact = true;
for (size_t v = 0; v < before.size(); ++v) exact = exact && d.mesh.positions[v] == before[v] + glm::vec3(0.25f, -1.0f, 3.0f);
CHECK(exact);
CHECK(d.undo.canUndo());
}
+TEST(transform_status_counts_read_as_text) {
+ CHECK(vertexCountText(1) == "1 vertex");
+ CHECK(vertexCountText(642) == "642 vertices");
+ CHECK(vertexCountText(2562) == "2,562 vertices");
+ CHECK(vertexCountText(1234567) == "1,234,567 vertices");
+ Document d = makeDoc(makeIcosphere(3));
+ CHECK(run(d, "transform", {{"rotate", std::string("0,90,0")}}).message.rfind("Turned ", 0) == 0);
+ CHECK(run(d, "transform", {{"scale", 2.0}}).message.rfind("Scaled ", 0) == 0);
+ CHECK(run(d, "transform", {{"scale", 0.5}, {"translate", std::string("1,0,0")}}).message.rfind("Transformed ", 0) == 0);
+}
+
TEST(transform_matches_the_formula) {
Document d = makeDoc(makeIcosphere(3));
const auto before = d.mesh.positions;
diff --git a/tests/ui/gizmo.sfui b/tests/ui/gizmo.sfui
index 59c7bdec..771f6926 100644
--- a/tests/ui/gizmo.sfui
+++ b/tests/ui/gizmo.sfui
@@ -173,7 +173,7 @@ expect_value guide_open == 0
click "Reset##gizmo.reset_pivot"
type "Gizmo/##gizmo_rotate_z" 90
click "Gizmo/Apply"
-expect_status Transformed
+expect_status Turned
expect_value size_y > 5.9
expect_value can_undo == 1
shot numeric