diff --git a/application/sources/bone_generator.cc b/application/sources/bone_generator.cc index 0fa059da..2bc6cf35 100644 --- a/application/sources/bone_generator.cc +++ b/application/sources/bone_generator.cc @@ -67,9 +67,18 @@ void BoneGenerator::process() previewTriangleNormals, 0, &previewTriangleVertexNormals); + std::vector> vertexProperties(it.second.vertexColors.size()); + for (size_t i = 0; i < vertexProperties.size(); ++i) { + vertexProperties[i] = std::make_tuple(it.second.vertexColors[i], + (float)0.0, (float)1.0); + } (*m_bonePreviewMeshes)[it.first] = std::make_unique(it.second.vertices, it.second.triangles, - previewTriangleVertexNormals); + previewTriangleVertexNormals, + dust3d::Color::createWhite(), + (float)0.0, + (float)1.0, + &vertexProperties); } qDebug() << "The bone generation took" << countTimeConsumed.elapsed() << "milliseconds"; diff --git a/application/sources/document.cc b/application/sources/document.cc index 207c1544..b676484a 100644 --- a/application/sources/document.cc +++ b/application/sources/document.cc @@ -2058,6 +2058,8 @@ void Document::silentReset() partMap.clear(); componentMap.clear(); rootComponent = Document::Component(); + boneMap.clear(); + boneIdList.clear(); } void Document::reset() diff --git a/dust3d/rig/bone_generator.cc b/dust3d/rig/bone_generator.cc index 37f4c98d..3db17b44 100644 --- a/dust3d/rig/bone_generator.cc +++ b/dust3d/rig/bone_generator.cc @@ -171,6 +171,7 @@ void BoneGenerator::addBonePreviewTriangle(BonePreview& bonePreview, oldToNewVertexMap.insert(std::make_pair(triangle[i], bonePreview.vertices.size())); newTriangle[i] = bonePreview.vertices.size(); bonePreview.vertices.push_back(m_vertices[triangle[i]]); + bonePreview.vertexColors.push_back(Color(1.0, 1.0, 1.0)); } else { newTriangle[i] = findVertex->second; } diff --git a/dust3d/rig/bone_generator.h b/dust3d/rig/bone_generator.h index 709f7d34..17f540fa 100644 --- a/dust3d/rig/bone_generator.h +++ b/dust3d/rig/bone_generator.h @@ -62,6 +62,7 @@ public: struct BonePreview { std::vector vertices; std::vector> triangles; + std::vector vertexColors; }; BoneGenerator();