Skip to content

Commit

Permalink
VOXELFORMAT: THING: add media node to newly copied mv model nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed Jan 13, 2025
1 parent 990131e commit 988c9e8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/voxelformat/private/rooms/ThingFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,17 @@ bool ThingFormat::loadNode(const io::ArchivePtr &archive, const NodeSpec &nodeSp
palette.setColor(i, rgba);
}
}
addMediaImage(archive, nodeSpec, voxSceneGraph, parent);
const core::DynamicArray<int> &nodes = scenegraph::copySceneGraph(sceneGraph, voxSceneGraph, parent);
if (nodes.empty()) {
const core::DynamicArray<int> &nodeIds = scenegraph::copySceneGraph(sceneGraph, voxSceneGraph, parent);
voxSceneGraph.clear();
if (nodeIds.empty()) {
Log::error("ThingFormat: Failed to copy the scene graph from node %s", nodeSpec.modelName.c_str());
return false;
}
const int newParent = nodeIds.front();
addMediaImage(archive, nodeSpec, sceneGraph, newParent);
Log::debug("Load %i children for %s", (int)nodeSpec.children.size(), nodeSpec.modelName.c_str());
for (const NodeSpec &child : nodeSpec.children) {
if (!loadNode(archive, child, sceneGraph, ctx, nodes[0])) {
if (!loadNode(archive, child, sceneGraph, ctx, newParent)) {
return false;
}
}
Expand Down

0 comments on commit 988c9e8

Please sign in to comment.