mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-22 12:07:45 +00:00
mdlpart: Improve exported GLTF hierarchy a bit
This commit is contained in:
parent
2dceeeaec3
commit
a73e80b531
1 changed files with 7 additions and 0 deletions
|
@ -232,6 +232,7 @@ void MDLPart::exportModel(const QString& fileName) {
|
|||
|
||||
auto& gltfSkin = gltfModel.skins.emplace_back();
|
||||
gltfSkin.name = gltfSkeletonNode.name;
|
||||
gltfSkin.skeleton = 0;
|
||||
for (int i = 1; i < gltfModel.nodes.size(); i++) {
|
||||
gltfSkin.joints.push_back(i);
|
||||
}
|
||||
|
@ -273,6 +274,8 @@ void MDLPart::exportModel(const QString& fileName) {
|
|||
gltfNode.name = models[0].name.toStdString() + " Part " + std::to_string(i) + ".0";
|
||||
gltfNode.skin = 0;
|
||||
|
||||
gltfSkeletonNode.children.push_back(gltfModel.nodes.size());
|
||||
|
||||
gltfNode.mesh = gltfModel.meshes.size();
|
||||
auto& gltfMesh = gltfModel.meshes.emplace_back();
|
||||
|
||||
|
@ -356,6 +359,10 @@ void MDLPart::exportModel(const QString& fileName) {
|
|||
}
|
||||
}
|
||||
|
||||
auto &scene = gltfModel.scenes.emplace_back();
|
||||
scene.name = models[0].name.toStdString();
|
||||
scene.nodes = {0};
|
||||
|
||||
tinygltf::TinyGLTF loader;
|
||||
loader.WriteGltfSceneToFile(&gltfModel, fileName.toStdString(), true, true, false, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue