Skip to content

Commit

Permalink
VOXELFORMAT: handle stopExecution in some locations
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed Feb 4, 2025
1 parent a3ad45e commit b95884a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/modules/voxelformat/private/mesh/GodotSceneFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ static bool saveMaterial(const scenegraph::SceneGraphNode &node, io::SeekableWri
bool GodotSceneFormat::saveNode(const core::Map<int, int> &meshIdxNodeMap, const scenegraph::SceneGraph &sceneGraph,
const scenegraph::SceneGraphNode &node, io::SeekableWriteStream &stream,
const Meshes &meshes, int &subResourceId, WriterStage stage) const {
if (stopExecution()) {
return false;
}
if (stage == WriterStage::SUB_RESOURCE) {
if (node.isAnyModelNode()) {
auto iter = meshIdxNodeMap.find(node.id());
Expand All @@ -120,6 +123,10 @@ bool GodotSceneFormat::saveNode(const core::Map<int, int> &meshIdxNodeMap, const
glm::vec3 mins(0);
glm::vec3 maxs(1);

if (stopExecution()) {
break;
}

int vertexCount = 0;
io::BufferedReadWriteStream buffer;
meshExt.visitByMaterial(
Expand Down
5 changes: 4 additions & 1 deletion src/modules/voxelformat/private/mesh/MeshFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,14 @@ bool MeshFormat::saveGroups(const scenegraph::SceneGraph &sceneGraph, const core
});
}
for (;;) {
if (stopExecution()) {
break;
}
lock.lock();
const size_t size = meshes.size();
lock.unlock();
if (size < models) {
app::App::getInstance()->wait(10);
app::App::getInstance()->wait(100);
} else {
break;
}
Expand Down

0 comments on commit b95884a

Please sign in to comment.