diff --git a/src/tydra/render-data.cc b/src/tydra/render-data.cc index 822ddcd7..b3d43551 100644 --- a/src/tydra/render-data.cc +++ b/src/tydra/render-data.cc @@ -3448,7 +3448,7 @@ bool RenderSceneConverter::ConvertMesh( // if (mesh.has_primvar("skel:jointIndices") && mesh.has_primvar("skel:jointWeights")) { - DCOUT("Convertg skin weights"); + DCOUT("Convert skin weights"); GeomPrimvar jointIndices; GeomPrimvar jointWeights; @@ -3678,6 +3678,7 @@ bool RenderSceneConverter::ConvertMesh( // TODO: key duplicate check dst.targets[bs->name] = shapeTarget; + DCOUT("Converted blendshape target: " << bs->name); } // @@ -5063,8 +5064,18 @@ bool MeshVisitor(const tinyusdz::Path &abs_path, const tinyusdz::Prim &prim, } } - // TODO: BlendShapes + // BlendShapes std::vector> blendshapes; + { + std::string local_err; + blendshapes = GetBlendShapes(visitorEnv->env->stage, prim, &local_err); + if (local_err.size()) { + if (err) { + (*err) += fmt::format("Failed to get BlendShapes prims. err = {}", local_err); + } + } + } + DCOUT("# of blendshapes : " << blendshapes.size()); RenderMesh rmesh; @@ -6003,6 +6014,23 @@ std::string DumpMesh(const RenderMesh &mesh, uint32_t indent) { << "\n"; ss << pprint::Indent(indent + 1) << "}\n"; } + if (mesh.targets.size()) { + ss << pprint::Indent(indent + 1) << "shapeTargets {\n"; + + for (const auto &target : mesh.targets) { + ss << pprint::Indent(indent + 2) << target.first << " {\n"; + ss << pprint::Indent(indent + 3) << "prim_name " << quote(target.second.prim_name) << "\n"; + ss << pprint::Indent(indent + 3) << "abs_path " << quote(target.second.abs_path) << "\n"; + ss << pprint::Indent(indent + 3) << "display_name " << quote(target.second.display_name) << "\n"; + ss << pprint::Indent(indent + 3) << "pointIndices " << quote(value::print_array_snipped(target.second.pointIndices)) << "\n"; + ss << pprint::Indent(indent + 3) << "pointOffsets " << quote(value::print_array_snipped(target.second.pointOffsets)) << "\n"; + ss << pprint::Indent(indent + 3) << "normalOffsets " << quote(value::print_array_snipped(target.second.normalOffsets)) << "\n"; + ss << pprint::Indent(indent + 2) << "}\n"; + } + + ss << pprint::Indent(indent + 1) << "}\n"; + + } if (mesh.material_subsetMap.size()) { ss << pprint::Indent(indent + 1) << "material_subsets {\n"; for (const auto &msubset : mesh.material_subsetMap) { diff --git a/src/tydra/scene-access.cc b/src/tydra/scene-access.cc index 7d0ef716..c5500a6c 100644 --- a/src/tydra/scene-access.cc +++ b/src/tydra/scene-access.cc @@ -2296,7 +2296,7 @@ bool IsPathIncluded(const CollectionMembershipQuery &query, const Stage &stage, } std::vector> -GetBlenedShapes( +GetBlendShapes( const tinyusdz::Stage &stage, const tinyusdz::Prim &prim, std::string *err) { diff --git a/src/tydra/scene-access.hh b/src/tydra/scene-access.hh index dff37a1b..cf974e7e 100644 --- a/src/tydra/scene-access.hh +++ b/src/tydra/scene-access.hh @@ -351,7 +351,7 @@ std::vector GetGeomSubsetChildren( // (`skel:blendShapes`, `skel:blendShapeTargets`) // std::vector> -GetBlenedShapes(const tinyusdz::Stage &stage, const tinyusdz::Prim &prim, +GetBlendShapes(const tinyusdz::Stage &stage, const tinyusdz::Prim &prim, std::string *err = nullptr); #if 0 // TODO