|
17 | 17 | #include <momentum/io/gltf/gltf_io.h> |
18 | 18 | #include <momentum/io/marker/marker_io.h> |
19 | 19 |
|
| 20 | +// Forward declaration for unified save function |
| 21 | +namespace momentum { |
| 22 | +void saveCharacterToFile( |
| 23 | + const filesystem::path& filename, |
| 24 | + const Character& character, |
| 25 | + const MatrixXf& motion, |
| 26 | + const VectorXf& offsets, |
| 27 | + const std::vector<std::vector<Marker>>& markerSequence, |
| 28 | + float fps); |
| 29 | +} // namespace momentum |
| 30 | + |
20 | 31 | namespace pymomentum { |
21 | 32 |
|
22 | 33 | momentum::Character loadGLTFCharacterFromFile(const std::string& path) { |
@@ -217,6 +228,22 @@ void saveFBXCharacterToFileWithJointParams( |
217 | 228 | } |
218 | 229 | } |
219 | 230 |
|
| 231 | +void saveCharacterToFile( |
| 232 | + const std::string& path, |
| 233 | + const momentum::Character& character, |
| 234 | + const float fps, |
| 235 | + const std::optional<const Eigen::MatrixXf>& motion, |
| 236 | + const std::optional<const Eigen::VectorXf>& offsets, |
| 237 | + const std::optional<const std::vector<std::vector<momentum::Marker>>>& markers) { |
| 238 | + momentum::saveCharacterToFile( |
| 239 | + path, |
| 240 | + character, |
| 241 | + motion.has_value() ? motion.value().transpose() : Eigen::MatrixXf{}, |
| 242 | + offsets.value_or(Eigen::VectorXf{}), |
| 243 | + markers.value_or(std::vector<std::vector<momentum::Marker>>{}), |
| 244 | + fps); |
| 245 | +} |
| 246 | + |
220 | 247 | std::tuple<momentum::Character, RowMatrixf, Eigen::VectorXf, float> loadGLTFCharacterWithMotion( |
221 | 248 | const std::string& gltfFilename) { |
222 | 249 | const auto [character, motion, identity, fps] = momentum::loadCharacterWithMotion(gltfFilename); |
|
0 commit comments