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: mid-stroke streaming stretches its interval on big meshes (25x the diff's cost, at least 100 ms), so it never takes more than ~4% of the main thread (the diff costs 16 ms at 28M triangles)

islandmed1d27a14a05c0
diff --git a/src/app/App.h b/src/app/App.h
index e9b1bc22..0291ce92 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -1431,6 +1431,7 @@ private:
};
std::unordered_map<uint32_t, MayaLinkSent> mayaLinkSent_; // by Part id
Uint64 mayaLinkStreamNs_ = 0;
+ Uint64 mayaLinkStreamEveryNs_ = link::kMayaLinkStreamNs; // stretched on big meshes: the diff stays ~4% of the time
int mayaLinkStreams_ = 0; // mid-stroke Points sent (UI tests: maya_link_streams)
// Phone link (PanelPhone.cpp, link/PhoneLink.h): File > Capture from phone. The server runs only while the
diff --git a/src/app/PanelMaya.cpp b/src/app/PanelMaya.cpp
index 733d311e..d73ed280 100644
--- a/src/app/PanelMaya.cpp
+++ b/src/app/PanelMaya.cpp
@@ -321,14 +321,18 @@ void App::pollMayaLink(Uint64 now) {
status_ = "Maya Live link: got " + std::to_string(count) + (count == 1 ? " object" : " objects") + " from Maya";
}
}
- // Mid-stroke: the active Part's moved vertices, at most every 100 ms (between the solver's batches).
- if (doc_.sculptor.strokeActive() && now - mayaLinkStreamNs_ >= link::kMayaLinkStreamNs && doc_.activePart >= 0) {
+ // Mid-stroke: the active Part's moved vertices, at most every 100 ms (between the solver's batches). The diff
+ // scans the whole Part (16 ms at 28M triangles): on big meshes the interval stretches to 25x its cost, so
+ // streaming never takes more than ~4% of the main thread.
+ if (doc_.sculptor.strokeActive() && now - mayaLinkStreamNs_ >= mayaLinkStreamEveryNs_ && doc_.activePart >= 0) {
mayaLinkStreamNs_ = now;
+ const Uint64 diffFrom = SDL_GetTicksNS();
const auto sent = mayaLinkSent_.find(doc_.activePartInfo().id);
if (sent != mayaLinkSent_.end() && sent->second.positions.size() == doc_.mesh.positions.size()) {
link::MayaLinkPoints points =
link::mayaLinkPointsBetween(mayaLinkName(doc_.activePart), sent->second.positions, doc_.mesh.positions);
for (uint32_t v : points.indices) sent->second.positions[v] = doc_.mesh.positions[v];
+ mayaLinkStreamEveryNs_ = std::max<Uint64>(link::kMayaLinkStreamNs, (SDL_GetTicksNS() - diffFrom) * 25);
if (!points.indices.empty()) {
mayaLink_->send(std::move(points));
++mayaLinkStreams_;