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.

Maya Live link tests on Windows too: the server test runs on the named pipe, and the shelf script's own client (tests/maya/link_peer.py) pairs with the app's server and carries a mesh and streamed Points both ways

islandmed55ebc644f231
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 619b853d..629eff65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -661,6 +661,9 @@ if(SCULPTFORGE_BUILD_TESTS)
add_executable(sculptforge_tests ${SCULPTFORGE_TEST_SOURCES})
target_include_directories(sculptforge_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests)
target_compile_definitions(sculptforge_tests PRIVATE SF_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/data")
+ if(Python3_EXECUTABLE) # the Maya shelf script as a real Live link client (tests/test_maya_live.cpp)
+ target_compile_definitions(sculptforge_tests PRIVATE SF_PYTHON_EXE="${Python3_EXECUTABLE}")
+ endif()
target_link_libraries(sculptforge_tests PRIVATE sculptforge_core sculptforge_ai sculptforge_phone sculptforge_mcp sculptforge_appshared)
sculptforge_pch(sculptforge_tests)
if(SCULPTFORGE_BUILD_APP) # the action registry (key chords, shortcut overrides) needs SDL's key names
diff --git a/tests/flaky.md b/tests/flaky.md
index 4caf420a..7aebaa7d 100644
--- a/tests/flaky.md
+++ b/tests/flaky.md
@@ -12,6 +12,7 @@ deletes it; remove its lines once fixed.
| 2026-11-06 | ui_stroke_background | laptop (heavy.sh, -j3) | ed1b0099 |
| 2026-11-06 | ui_stroke_background_preview | laptop (heavy.sh, -j3) | ed1b0099 |
| 2026-11-06 | ui_stroke_persistent_upload | laptop (heavy.sh, -j3) | ed1b0099 |
+| 2026-11-06 | ui_idle_redraw | Linux aarch64, -j3 | bf383ffe |
## Owned
diff --git a/tests/maya/link_peer.py b/tests/maya/link_peer.py
new file mode 100644
index 00000000..f2a4e16a
--- /dev/null
+++ b/tests/maya/link_peer.py
@@ -0,0 +1,43 @@
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# python3 -I tests/maya/link_peer.py "sflink1 CODE ENDPOINT"
+#
+# The Maya shelf script's Live link client without Maya, for tests/test_maya_live.cpp (maya_link_python_client):
+# pairs with the app's server through the real endpoint (Unix socket, or on Windows the named pipe), sends one mesh
+# as Maya would, then waits for the Points the test streams back and checks they fold. Exit 0 = all well.
+import os
+import sys
+import time
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, os.path.join(HERE, "..", "..", "integrations", "maya"))
+import sculptforge_maya as sm # noqa: E402
+
+CUBE = {"name": "pCube1",
+ "positions": [-1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1],
+ "face_sizes": [4, 4, 4, 4, 4, 4],
+ "indices": [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4], "uvs": []}
+
+
+def main():
+ code, endpoint = sm.parse_pairing(sys.argv[1])
+ conn = sm._PipeConn(endpoint) if os.name == "nt" else sm._SocketConn(endpoint)
+ inbox = sm.LinkInbox()
+ client = sm.LinkClient(conn, code, inbox.add, client="link_peer")
+ client.send(sm.encode_mesh(CUBE))
+ moved = {}
+ deadline = time.monotonic() + 15
+ while time.monotonic() < deadline and len(moved) < 4:
+ for name, mesh, points in inbox.take():
+ if name == "pCube1" and points is not None and points[0] == 8:
+ moved.update(points[1])
+ time.sleep(0.02)
+ client.close()
+ ok = sorted(moved) == [0, 1, 2, 7] and moved[7] == (9.0, 9.0, 2.0) and moved[1] == (1.0, 0.0, 0.0)
+ print("link_peer: %s (%s)" % ("ok" if ok else "FAILED", sorted(moved.items())))
+ return 0 if ok else 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tests/test_maya_live.cpp b/tests/test_maya_live.cpp
index 1487cc34..4f0075d5 100644
--- a/tests/test_maya_live.cpp
+++ b/tests/test_maya_live.cpp
@@ -50,6 +50,15 @@ bool waitFor(const std::function<bool()>& f, int ms = 3000) {
return f();
}
+void setTestEnv(const char* name, const std::string& value) {
+#ifdef _WIN32
+ _putenv_s(name, value.c_str());
+#else
+ if (value.empty()) unsetenv(name);
+ else setenv(name, value.c_str(), 1);
+#endif
+}
+
bool readFrame(link::AiLinkConn& c, link::MayaLinkType& type, std::string& payload) {
char header[link::kMayaLinkHeaderBytes];
size_t got = 0;
@@ -305,18 +314,19 @@ TEST(maya_link_refuses_malformed) {
CHECK(!parseMayaLinkMesh(huge, out, err));
}
-#ifndef _WIN32
TEST(maya_link_server_pairs_and_streams) {
using namespace link;
const fs::path dir = fs::temp_directory_path() / ("sf_maya_link_" + std::to_string(std::random_device{}() % 100000));
fs::create_directories(dir);
- setenv("SF_AI_LIVE_DIR", dir.string().c_str(), 1);
+ setTestEnv("SF_AI_LIVE_DIR", dir.string());
std::string err;
const std::string endpoint = localEndpoint("maya-link", err);
- CHECK(!endpoint.empty() && endpoint.find("maya-link.sock") != std::string::npos);
+ CHECK(!endpoint.empty() && endpoint.find("maya-link") != std::string::npos);
MayaLinkServer server;
CHECK(server.start(endpoint, err));
+#ifndef _WIN32
CHECK(aiLinkFileMode(endpoint) == 0600);
+#endif
// A second server on the same endpoint: refused (another window has it on).
MayaLinkServer second;
CHECK(!second.start(endpoint, err));
@@ -410,8 +420,55 @@ TEST(maya_link_server_pairs_and_streams) {
CHECK(last == "disconnected: timed out");
}
server.stop();
+#ifndef _WIN32
CHECK(aiLinkFileMode(endpoint) < 0); // the socket file is gone when the link is off
- unsetenv("SF_AI_LIVE_DIR");
+#endif
+ setTestEnv("SF_AI_LIVE_DIR", "");
+ fs::remove_all(dir);
+}
+
+#ifdef SF_PYTHON_EXE
+// The Maya shelf script's own client (tests/maya/link_peer.py: LinkClient over the Unix socket, or on Windows the
+// named pipe through PeekNamedPipe) against the app's server: pairing, a mesh from "Maya", streamed Points back.
+TEST(maya_link_python_client) {
+ using namespace link;
+ const fs::path dir = fs::temp_directory_path() / ("sf_maya_peer_" + std::to_string(std::random_device{}() % 100000));
+ fs::create_directories(dir);
+ setTestEnv("SF_AI_LIVE_DIR", dir.string());
+ std::string err;
+ const std::string endpoint = localEndpoint("maya-link", err);
+ MayaLinkServer server;
+ CHECK(server.start(endpoint, err));
+ const fs::path script = fs::path(SF_TEST_DATA_DIR) / ".." / "maya" / "link_peer.py";
+ const std::string pairing = mayaLinkPairingText(server.code(), endpoint);
+ int exitCode = -1;
+ std::thread peer([&] {
+ std::string cmd = std::string("\"") + SF_PYTHON_EXE + "\" -I \"" + script.string() + "\" \"" + pairing + "\"";
+#ifdef _WIN32
+ cmd = "\"" + cmd + "\""; // (cmd /c drops the outer pair of quotes)
+#endif
+ exitCode = std::system(cmd.c_str());
+ });
+ std::vector<MayaLinkMesh> got;
+ CHECK(waitFor([&] {
+ for (auto& m : server.takeReceived()) got.push_back(std::move(m));
+ return !got.empty();
+ }, 20000));
+ CHECK(got.size() == 1 && got[0].name == "pCube1" && got[0].faceSizes.size() == 6);
+ CHECK(server.clientName() == "link_peer");
+ // Two Points for the same object, then a third: the client folds what it hasn't applied yet.
+ for (uint32_t k = 0; k < 3; ++k) {
+ MayaLinkPoints p;
+ p.name = "pCube1";
+ p.vertexCount = 8;
+ p.indices = {k, 7};
+ p.positions = {float(k), 0, 0, 9, 9, float(k)};
+ server.send(p);
+ }
+ peer.join();
+ CHECK(exitCode == 0);
+ server.stop();
+ setTestEnv("SF_AI_LIVE_DIR", "");
fs::remove_all(dir);
}
#endif
@@ -461,7 +518,7 @@ TEST(maya_live_bench) {
// Carried through a real link: this test plays Maya, sending to the app's server.
const fs::path dir = fs::temp_directory_path() / "sf_maya_bench_link";
fs::create_directories(dir);
- setenv("SF_AI_LIVE_DIR", dir.string().c_str(), 1);
+ setTestEnv("SF_AI_LIVE_DIR", dir.string());
const std::string endpoint = localEndpoint("maya-link", err);
MayaLinkServer server;
CHECK(server.start(endpoint, err));
@@ -498,7 +555,7 @@ TEST(maya_live_bench) {
CHECK(parseMayaLinkPoints(payloadOf(pf), pb, err));
std::printf(" stroke: Points encode+parse %4.1f ms (%.1f MB)\n", ms(t), double(pf.size()) / 1e6);
server.stop();
- unsetenv("SF_AI_LIVE_DIR");
+ setTestEnv("SF_AI_LIVE_DIR", "");
fs::remove_all(dir);
}
}