Commit a9cca557 authored by TheNumbat's avatar TheNumbat
Browse files

fix writing spheres with no mesh data

parent 5ecaca3a
...@@ -443,6 +443,7 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors, ...@@ -443,6 +443,7 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors,
Skeleton &skeleton = new_obj.armature; Skeleton &skeleton = new_obj.armature;
aiNode *arm_node = mesh->mBones[0]->mArmature; aiNode *arm_node = mesh->mBones[0]->mArmature;
if(arm_node) {
{ {
aiVector3D t, r, s; aiVector3D t, r, s;
arm_node->mTransformation.Decompose(s, r, t); arm_node->mTransformation.Decompose(s, r, t);
...@@ -486,6 +487,7 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors, ...@@ -486,6 +487,7 @@ static void load_node(Scene &scobj, std::vector<std::string> &errors,
build_tree(root, root_node->mChildren[k]); build_tree(root, root_node->mChildren[k]);
} }
} }
}
node_to_obj[node] = new_obj.id(); node_to_obj[node] = new_obj.id();
scobj.add(std::move(new_obj)); scobj.add(std::move(new_obj));
...@@ -919,7 +921,7 @@ std::string Scene::write(std::string file, const Camera &render_cam, ...@@ -919,7 +921,7 @@ std::string Scene::write(std::string file, const Camera &render_cam,
face_idx++; face_idx++;
} }
} else if(obj.opt.shape_type == PT::Shape_Type::none) { } else {
const auto &verts = obj.mesh().verts(); const auto &verts = obj.mesh().verts();
const auto &elems = obj.mesh().indices(); const auto &elems = obj.mesh().indices();
...@@ -946,6 +948,7 @@ std::string Scene::write(std::string file, const Camera &render_cam, ...@@ -946,6 +948,7 @@ std::string Scene::write(std::string file, const Camera &render_cam,
face.mIndices[1] = elems[i + 1]; face.mIndices[1] = elems[i + 1];
face.mIndices[2] = elems[i + 2]; face.mIndices[2] = elems[i + 2];
} }
} }
std::string name(obj.opt.name); std::string name(obj.opt.name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment