diff --git a/src/fbx/FbxBlendShapesAccess.cpp b/src/fbx/FbxBlendShapesAccess.cpp index 141f8c4..ad8d263 100644 --- a/src/fbx/FbxBlendShapesAccess.cpp +++ b/src/fbx/FbxBlendShapesAccess.cpp @@ -27,11 +27,12 @@ FbxAnimCurve *FbxBlendShapesAccess::BlendChannel::ExtractAnimation(unsigned int FbxBlendShapesAccess::BlendChannel::BlendChannel( FbxMesh *mesh, const unsigned int blendShapeIx, const unsigned int channelIx, const FbxDouble deformPercent, - const std::vector &targetShapes) : mesh(mesh), + const std::vector &targetShapes, std::string name) : mesh(mesh), blendShapeIx(blendShapeIx), channelIx(channelIx), deformPercent(deformPercent), - targetShapes(targetShapes) + targetShapes(targetShapes), + name(name) {} std::vector FbxBlendShapesAccess::extractChannels(FbxMesh *mesh) const @@ -46,11 +47,17 @@ std::vector FbxBlendShapesAccess::extractCha if (fbxChannel->GetTargetShapeCount() > 0) { std::vector targetShapes; const double *fullWeights = fbxChannel->GetTargetShapeFullWeights(); + std::string name = std::string(fbxChannel->GetName()); + + if (verboseOutput) { + fmt::printf("\rblendshape channel: %s\n", name); + } + for (int targetIx = 0; targetIx < fbxChannel->GetTargetShapeCount(); targetIx ++) { FbxShape *fbxShape = fbxChannel->GetTargetShape(targetIx); targetShapes.emplace_back(fbxShape, fullWeights[targetIx]); } - channels.emplace_back(mesh, shapeIx, channelIx, fbxChannel->DeformPercent * 0.01, targetShapes); + channels.emplace_back(mesh, shapeIx, channelIx, fbxChannel->DeformPercent * 0.01, targetShapes, name); } } } diff --git a/src/fbx/FbxBlendShapesAccess.hpp b/src/fbx/FbxBlendShapesAccess.hpp index 484fd06..aea1352 100644 --- a/src/fbx/FbxBlendShapesAccess.hpp +++ b/src/fbx/FbxBlendShapesAccess.hpp @@ -64,7 +64,8 @@ public: const unsigned int blendShapeIx, const unsigned int channelIx, const FbxDouble deformPercent, - const std::vector &targetShapes + const std::vector &targetShapes, + const std::string name ); FbxAnimCurve *ExtractAnimation(unsigned int animIx) const; @@ -74,6 +75,7 @@ public: const unsigned int blendShapeIx; const unsigned int channelIx; const std::vector targetShapes; + const std::string name; const FbxDouble deformPercent; }; diff --git a/src/gltf/GltfModel.hpp b/src/gltf/GltfModel.hpp index ec4c05c..9ec17af 100644 --- a/src/gltf/GltfModel.hpp +++ b/src/gltf/GltfModel.hpp @@ -97,7 +97,7 @@ struct GltfModel template std::shared_ptr AddAccessorWithView( - BufferViewData &bufferView, const GLType &type, const std::vector &source) + BufferViewData &bufferView, const GLType &type, const std::vector &source, std::string name) { auto accessor = accessors.hold(new AccessorData(bufferView, type)); accessor->appendAsBinaryArray(source, *binary); @@ -110,7 +110,15 @@ struct GltfModel BufferData &buffer, const GLType &type, const std::vector &source) { auto bufferView = GetAlignedBufferView(buffer, BufferViewData::GL_ARRAY_NONE); - return AddAccessorWithView(*bufferView, type, source); + return AddAccessorWithView(*bufferView, type, source, std::string("")); + } + + template + std::shared_ptr AddAccessorAndView( + BufferData &buffer, const GLType &type, const std::vector &source, std::string name) + { + auto bufferView = GetAlignedBufferView(buffer, BufferViewData::GL_ARRAY_NONE); + return AddAccessorWithView(*bufferView, type, source, name); } template