Updated ozz-animation to version 0.14.1 @35b2efd4

This commit is contained in:
Martin Felis
2023-03-26 13:28:12 +02:00
parent bf3189ff49
commit 15871f349c
194 changed files with 3495 additions and 1957 deletions
@@ -1,4 +1,6 @@
add_library(ozz_animation_offline STATIC
add_library(ozz_animation_offline
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/export.h
decimate.h
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/raw_animation.h
raw_animation.cc
@@ -22,8 +24,10 @@ add_library(ozz_animation_offline STATIC
track_builder.cc
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/track_optimizer.h
track_optimizer.cc)
target_link_libraries(ozz_animation_offline
ozz_animation)
target_compile_definitions(ozz_animation_offline PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:OZZ_BUILD_ANIMOFFLINE_LIB>)
target_link_libraries(ozz_animation_offline ozz_animation)
set_target_properties(ozz_animation_offline PROPERTIES FOLDER "ozz")
@@ -31,7 +35,7 @@ install(TARGETS ozz_animation_offline DESTINATION lib)
fuse_target("ozz_animation_offline")
add_subdirectory(tools) # tools target need to be defined before other targets that uses them
add_subdirectory(fbx)
add_subdirectory(gltf)
add_subdirectory(tools)
@@ -89,6 +89,7 @@ bool AdditiveAnimationBuilder::operator()(const RawAnimation& _input,
}
// Rebuilds output animation.
_output->name = _input.name;
_output->duration = _input.duration;
_output->tracks.resize(_input.tracks.size());
@@ -143,6 +144,7 @@ bool AdditiveAnimationBuilder::operator()(
}
// Rebuilds output animation.
_output->name = _input.name;
_output->duration = _input.duration;
_output->tracks.resize(_input.tracks.size());
@@ -163,7 +163,7 @@ void CompressQuat(const ozz::math::Quaternion& _src,
ozz::animation::QuaternionKey* _dest) {
// Finds the largest quaternion component.
const float quat[4] = {_src.x, _src.y, _src.z, _src.w};
const size_t largest = std::max_element(quat, quat + 4, LessAbs) - quat;
const ptrdiff_t largest = std::max_element(quat, quat + 4, LessAbs) - quat;
assert(largest <= 3);
_dest->largest = largest & 0x3;
@@ -269,7 +269,7 @@ unique_ptr<Animation> AnimationBuilder::operator()(
// Declares and preallocates tracks to sort.
size_t translations = 0, rotations = 0, scales = 0;
for (int i = 0; i < num_tracks; ++i) {
for (uint16_t i = 0; i < num_tracks; ++i) {
const RawAnimation::JointTrack& raw_track = _input.tracks[i];
translations += raw_track.translations.size() + 2; // +2 because worst case
rotations += raw_track.rotations.size() + 2; // needs to add the
@@ -2,22 +2,20 @@ if(NOT ozz_build_fbx)
return()
endif()
add_library(ozz_animation_fbx STATIC
add_library(ozz_animation_fbx
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/fbx/export.h
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/fbx/fbx.h
fbx.cc
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/fbx/fbx_animation.h
fbx_animation.cc
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/fbx/fbx_skeleton.h
fbx_skeleton.cc)
target_include_directories(ozz_animation_fbx
PUBLIC $<BUILD_INTERFACE:${FBX_INCLUDE_DIRS}>)
target_compile_definitions(ozz_animation_fbx PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:OZZ_BUILD_ANIMATIONFBX_LIB>)
target_link_libraries(ozz_animation_fbx
ozz_animation_offline
debug ${FBX_LIBRARIES_DEBUG}
optimized ${FBX_LIBRARIES})
target_compile_options(ozz_animation_fbx
PUBLIC $<$<BOOL:${W_NULL_DEREFERENCE}>:-Wno-null-dereference>
PUBLIC $<$<BOOL:${W_PRAGMA_PACK}>:-Wno-pragma-pack>)
fbx::sdk)
set_target_properties(ozz_animation_fbx PROPERTIES FOLDER "ozz/tools")
install(TARGETS ozz_animation_fbx DESTINATION lib)
@@ -32,6 +30,7 @@ add_executable(fbx2ozz
target_link_libraries(fbx2ozz
ozz_animation_tools
ozz_animation_fbx)
target_copy_shared_libraries(fbx2ozz)
set_target_properties(fbx2ozz
PROPERTIES FOLDER "ozz/tools")
@@ -45,6 +44,7 @@ set(build_configurations
"/fbx/pab/locomotions.fbx\;{\"skeleton\":{\"filename\":\"pab_skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"pab_*.ozz\"}]}\;output:pab_walk.ozz\;output:pab_jog.ozz\;output:pab_run.ozz\;depend:pab_skeleton.ozz"
"/fbx/pab/crossarms.fbx\;{\"skeleton\":{\"filename\":\"pab_skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"pab_crossarms.ozz\"}]}\;output:pab_crossarms.ozz\;depend:pab_skeleton.ozz"
"/fbx/pab/crackhead.fbx\;{\"skeleton\":{\"filename\":\"pab_skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"pab_crackhead.ozz\"},{\"filename\":\"pab_crackhead_additive.ozz\",\"additive\":true}]}\;output:pab_crackhead_additive.ozz\;output:pab_crackhead.ozz\;depend:pab_skeleton.ozz"
"/fbx/pab/hand.fbx\;{\"skeleton\":{\"filename\":\"pab_skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"clip\":\"curl\",\"filename\":\"pab_curl_additive.ozz\",\"additive\":true,\"additive_reference\":\"skeleton\"},{\"clip\":\"splay\",\"filename\":\"pab_splay_additive.ozz\",\"additive\":true,\"additive_reference\":\"skeleton\"}]}\;output:pab_curl_additive.ozz\;output:pab_splay_additive.ozz\;depend:pab_skeleton.ozz"
# Robot user channels
"/fbx/robot.fbx\;\;config_file:${PROJECT_SOURCE_DIR}/samples/user_channel/config.json\;output:robot_skeleton.ozz\;output:robot_animation.ozz\;output:robot_track_grasp.ozz"
@@ -28,15 +28,12 @@
#include "ozz/animation/offline/fbx/fbx_animation.h"
#include "ozz/animation/offline/fbx/fbx.h"
#include "ozz/animation/offline/raw_animation.h"
#include "ozz/animation/offline/raw_animation_utils.h"
#include "ozz/animation/offline/raw_track.h"
#include "ozz/animation/runtime/skeleton.h"
#include "ozz/animation/runtime/skeleton_utils.h"
#include "ozz/base/log.h"
#include "ozz/base/maths/math_ex.h"
#include "ozz/base/maths/transform.h"
@@ -157,16 +154,16 @@ bool ExtractAnimation(FbxSceneLoader& _scene_loader, const SamplingInfo& _info,
if (node == nullptr) {
ozz::log::LogV() << "No animation track found for joint \""
<< _skeleton.joint_names()[i]
<< "\". Using skeleton bind pose instead." << std::endl;
<< "\". Using skeleton rest pose instead." << std::endl;
const math::Transform& bind_pose =
ozz::animation::GetJointLocalBindPose(_skeleton, i);
const math::Transform& rest_pose =
ozz::animation::GetJointLocalRestPose(_skeleton, i);
const math::SimdFloat4 t =
math::simd_float4::Load3PtrU(&bind_pose.translation.x);
math::simd_float4::Load3PtrU(&rest_pose.translation.x);
const math::SimdFloat4 q =
math::simd_float4::LoadPtrU(&bind_pose.rotation.x);
math::simd_float4::LoadPtrU(&rest_pose.rotation.x);
const math::SimdFloat4 s =
math::simd_float4::Load3PtrU(&bind_pose.scale.x);
math::simd_float4::Load3PtrU(&rest_pose.scale.x);
const math::Float4x4 local_matrix = math::Float4x4::FromAffine(t, q, s);
ozz::vector<math::Float4x4>& node_matrices = world_matrices[i];
@@ -201,7 +198,7 @@ bool ExtractAnimation(FbxSceneLoader& _scene_loader, const SamplingInfo& _info,
// Builds local space animation tracks.
// Allocates all tracks with the same number of joints as the skeleton.
// Tracks that would not be found will be set to skeleton bind-pose
// Tracks that would not be found will be set to skeleton rest-pose
// transformation.
_animation->tracks.resize(_skeleton.num_joints());
for (int i = 0; i < _skeleton.num_joints(); i++) {
@@ -28,7 +28,6 @@
#include "ozz/animation/offline/fbx/fbx_skeleton.h"
#include "ozz/animation/offline/raw_skeleton.h"
#include "ozz/base/log.h"
namespace ozz {
@@ -78,9 +77,12 @@ bool IsTypeSelected(const OzzImporter::NodeType& _types,
case FbxNodeAttribute::eLight:
return _types.light;
// Null
case FbxNodeAttribute::eNull:
return _types.null;
// Others
case FbxNodeAttribute::eUnknown:
case FbxNodeAttribute::eNull:
case FbxNodeAttribute::eCameraSwitcher:
case FbxNodeAttribute::eOpticalReference:
case FbxNodeAttribute::eOpticalMarker:
@@ -116,7 +118,7 @@ RecurseReturn RecurseNode(FbxNode* _node, FbxSystemConverter* _converter,
this_joint = &sibling->back(); // Will not be resized inside recursion.
this_joint->name = _node->GetName();
// Extract bind pose.
// Extract rest pose.
const FbxAMatrix node_global = _node->EvaluateGlobalTransform();
const FbxAMatrix node_local = _parent_global_inv * node_global;
@@ -7,6 +7,7 @@ add_executable(gltf2ozz
target_link_libraries(gltf2ozz PRIVATE
ozz_animation_tools)
target_copy_shared_libraries(gltf2ozz)
set_target_properties(gltf2ozz
PROPERTIES FOLDER "ozz/tools")
@@ -9745,7 +9745,7 @@ class binary_writer
static CharType to_char_type(std::uint8_t x) noexcept
{
static_assert(sizeof(std::uint8_t) == sizeof(CharType), "size of CharType must be equal to std::uint8_t");
static_assert(std::is_pod<CharType>::value, "CharType must be POD");
static_assert(std::is_standard_layout<CharType>::value && std::is_trivial<CharType>::value, "CharType must be POD");
CharType result;
std::memcpy(&result, &x, sizeof(x));
return result;
+37 -35
View File
@@ -358,7 +358,7 @@ bool SampleChannel(const tinygltf::Model& _model,
}
ozz::animation::offline::RawAnimation::TranslationKey
CreateTranslationBindPoseKey(const tinygltf::Node& _node) {
CreateTranslationRestPoseKey(const tinygltf::Node& _node) {
ozz::animation::offline::RawAnimation::TranslationKey key;
key.time = 0.0f;
@@ -373,7 +373,7 @@ CreateTranslationBindPoseKey(const tinygltf::Node& _node) {
return key;
}
ozz::animation::offline::RawAnimation::RotationKey CreateRotationBindPoseKey(
ozz::animation::offline::RawAnimation::RotationKey CreateRotationRestPoseKey(
const tinygltf::Node& _node) {
ozz::animation::offline::RawAnimation::RotationKey key;
key.time = 0.0f;
@@ -389,7 +389,7 @@ ozz::animation::offline::RawAnimation::RotationKey CreateRotationBindPoseKey(
return key;
}
ozz::animation::offline::RawAnimation::ScaleKey CreateScaleBindPoseKey(
ozz::animation::offline::RawAnimation::ScaleKey CreateScaleRestPoseKey(
const tinygltf::Node& _node) {
ozz::animation::offline::RawAnimation::ScaleKey key;
key.time = 0.0f;
@@ -430,8 +430,8 @@ bool CreateNodeTransform(const tinygltf::Node& _node,
ozz::math::SimdFloat4 translation, rotation, scale;
if (ToAffine(matrix, &translation, &rotation, &scale)) {
ozz::math::Store3PtrU(translation, &_transform->translation.x);
ozz::math::StorePtrU(translation, &_transform->rotation.x);
ozz::math::Store3PtrU(translation, &_transform->scale.x);
ozz::math::StorePtrU(rotation, &_transform->rotation.x);
ozz::math::Store3PtrU(scale, &_transform->scale.x);
return true;
}
@@ -521,30 +521,38 @@ class GltfImporter : public ozz::animation::offline::OzzImporter {
return success;
}
// Given a skin find which of its joints is the skeleton root and return it
// returns -1 if the skin has no associated joints
int FindSkinRootJointIndex(const tinygltf::Skin& skin) {
if (skin.joints.empty()) {
return -1;
}
if (skin.skeleton != -1) {
return skin.skeleton;
}
ozz::map<int, int> parents;
for (int node : skin.joints) {
// Find all unique root joints of skeletons used by given skins and add them
// to `roots`
void FindSkinRootJointIndices(const ozz::vector<tinygltf::Skin>& skins,
ozz::vector<int>& roots) {
static constexpr int no_parent = -1;
static constexpr int visited = -2;
ozz::vector<int> parents(m_model.nodes.size(), no_parent);
for (int node = 0; node < static_cast<int>(m_model.nodes.size()); node++) {
for (int child : m_model.nodes[node].children) {
parents[child] = node;
}
}
int root = skin.joints[0];
while (parents.find(root) != parents.end()) {
root = parents[root];
}
for (const tinygltf::Skin& skin : skins) {
if (skin.joints.empty()) {
continue;
}
return root;
if (skin.skeleton != -1) {
parents[skin.skeleton] = visited;
roots.push_back(skin.skeleton);
continue;
}
int root = skin.joints[0];
while (root != visited && parents[root] != no_parent) {
root = parents[root];
}
if (root != visited) {
roots.push_back(root);
}
}
}
bool Import(ozz::animation::offline::RawSkeleton* _skeleton,
@@ -591,14 +599,8 @@ class GltfImporter : public ozz::animation::offline::OzzImporter {
<< std::endl;
}
// Uses all skins root
for (auto& skin : skins) {
const int root = FindSkinRootJointIndex(skin);
if (root == -1) {
continue;
}
roots.push_back(root);
}
// Uses all skins roots.
FindSkinRootJointIndices(skins, roots);
}
// Remove nodes listed multiple times.
@@ -745,16 +747,16 @@ class GltfImporter : public ozz::animation::offline::OzzImporter {
const tinygltf::Node* node = FindNodeByName(joint_names[i]);
assert(node != nullptr);
// Pads the bind pose transform for any joints which do not have an
// Pads the rest pose transform for any joints which do not have an
// associated channel for this animation
if (track.translations.empty()) {
track.translations.push_back(CreateTranslationBindPoseKey(*node));
track.translations.push_back(CreateTranslationRestPoseKey(*node));
}
if (track.rotations.empty()) {
track.rotations.push_back(CreateRotationBindPoseKey(*node));
track.rotations.push_back(CreateRotationRestPoseKey(*node));
}
if (track.scales.empty()) {
track.scales.push_back(CreateScaleBindPoseKey(*node));
track.scales.push_back(CreateScaleRestPoseKey(*node));
}
}
@@ -144,9 +144,9 @@ unique_ptr<ozz::animation::Skeleton> SkeletonBuilder::operator()(
}
// Fills the SoaTransform structure.
math::Transpose4x3(translations,
&skeleton->joint_bind_poses_[i].translation.x);
math::Transpose4x4(rotations, &skeleton->joint_bind_poses_[i].rotation.x);
math::Transpose4x3(scales, &skeleton->joint_bind_poses_[i].scale.x);
&skeleton->joint_rest_poses_[i].translation.x);
math::Transpose4x4(rotations, &skeleton->joint_rest_poses_[i].rotation.x);
math::Transpose4x3(scales, &skeleton->joint_rest_poses_[i].scale.x);
}
return skeleton; // Success.
@@ -4,7 +4,8 @@ endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/extern/jsoncpp json)
add_library(ozz_animation_tools STATIC
add_library(ozz_animation_tools
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/tools/export.h
${PROJECT_SOURCE_DIR}/include/ozz/animation/offline/tools/import2ozz.h
import2ozz.cc
import2ozz_anim.h
@@ -15,10 +16,14 @@ add_library(ozz_animation_tools STATIC
import2ozz_skel.cc
import2ozz_track.h
import2ozz_track.cc)
target_compile_definitions(ozz_animation_tools PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:OZZ_BUILD_ANIMATIONTOOLS_LIB>)
target_link_libraries(ozz_animation_tools
ozz_animation_offline
ozz_options
json)
set_target_properties(ozz_animation_tools
PROPERTIES FOLDER "ozz/tools")
@@ -32,6 +37,7 @@ if(NOT EMSCRIPTEN)
target_link_libraries(dump2ozz
ozz_animation_tools
ozz_options)
target_copy_shared_libraries(dump2ozz)
# Uses a fake import file to dump reference and default configurations.
add_custom_command(TARGET dump2ozz POST_BUILD
@@ -39,4 +45,5 @@ if(NOT EMSCRIPTEN)
set_target_properties(dump2ozz
PROPERTIES FOLDER "ozz/tools")
endif()
@@ -137,11 +137,11 @@ unique_ptr<ozz::animation::Skeleton> LoadSkeleton(const char* _path) {
return skeleton;
}
vector<math::Transform> SkeletonBindPoseSoAToAoS(const Skeleton& _skeleton) {
// Copy skeleton bind pose to AoS form.
vector<math::Transform> SkeletonRestPoseSoAToAoS(const Skeleton& _skeleton) {
// Copy skeleton rest pose to AoS form.
vector<math::Transform> transforms(_skeleton.num_joints());
for (int i = 0; i < _skeleton.num_soa_joints(); ++i) {
const math::SoaTransform& soa_transform = _skeleton.joint_bind_poses()[i];
const math::SoaTransform& soa_transform = _skeleton.joint_rest_poses()[i];
math::SimdFloat4 translation[4];
math::SimdFloat4 rotation[4];
math::SimdFloat4 scale[4];
@@ -248,7 +248,7 @@ bool Export(OzzImporter& _importer, const RawAnimation& _input_animation,
bool succeeded = false;
if (enum_found && reference == AdditiveReferenceEnum::kSkeleton) {
const vector<math::Transform> transforms =
SkeletonBindPoseSoAToAoS(_skeleton);
SkeletonRestPoseSoAToAoS(_skeleton);
succeeded =
additive_builder(raw_animation, make_span(transforms), &raw_additive);
} else {
@@ -371,9 +371,12 @@ bool ImportAnimations(const Json::Value& _config, OzzImporter* _importer,
LoadSkeleton(skeleton_config["filename"].asCString()));
success &= skeleton.get() != nullptr;
if (!success)
return false;
// Loop though all existing animations, and export those who match
// configuration.
for (Json::ArrayIndex i = 0; success && i < animations_config.size(); ++i) {
for (Json::ArrayIndex i = 0; i < animations_config.size(); ++i) {
const Json::Value& animation_config = animations_config[i];
const char* clip_match = animation_config["clip"].asCString();
@@ -384,28 +387,45 @@ bool ImportAnimations(const Json::Value& _config, OzzImporter* _importer,
continue;
}
bool matched = false;
for (size_t j = 0; success && j < import_animation_names.size(); ++j) {
size_t num_not_clip_animation = 0, num_valid_animation = 0;
for (size_t j = 0; j < import_animation_names.size(); ++j) {
const char* animation_name = import_animation_names[j].c_str();
if (!strmatch(animation_name, clip_match)) {
continue;
}
++num_not_clip_animation;
const bool anisuccess = ProcessAnimation(*_importer, animation_name, *skeleton,
animation_config, _endianness);
if(anisuccess){
++num_valid_animation;
}
matched = true;
success = ProcessAnimation(*_importer, animation_name, *skeleton,
animation_config, _endianness);
size_t num_valid_track = 0;
const Json::Value& tracks_config = animation_config["tracks"];
for (Json::ArrayIndex t = 0; success && t < tracks_config.size(); ++t) {
success = ProcessTracks(*_importer, animation_name, *skeleton,
tracks_config[t], _endianness);
for (Json::ArrayIndex t = 0; t < tracks_config.size(); ++t) {
if (ProcessTracks(*_importer, animation_name, *skeleton,
tracks_config[t], _endianness)){
++num_valid_track;
}
}
if (num_valid_track != tracks_config.size()){
ozz::log::Log() << "One of track failed when import: \"" << animation_name
<< "\"" << std::endl;
success = false;
}
}
// Don't display any message if no animation is supposed to be imported.
if (!matched && *clip_match != 0) {
if (0 == num_not_clip_animation && *clip_match != 0) {
ozz::log::Log() << "No matching animation found for \"" << clip_match
<< "\"." << std::endl;
}
if (num_valid_animation != num_not_clip_animation){
ozz::log::Log() << "One of animation failed when import, animation index: \"" << i
<< "\"" << std::endl;
success = false;
}
}
return success;
@@ -28,6 +28,7 @@
#ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_ANIM_H_
#define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_ANIM_H_
#include "ozz/animation/offline/tools/export.h"
#include "ozz/base/endianness.h"
#include "ozz/base/platform.h"
@@ -43,14 +44,15 @@ namespace animation {
namespace offline {
class OzzImporter;
bool ImportAnimations(const Json::Value& _config, OzzImporter* _importer,
OZZ_ANIMTOOLS_DLL bool ImportAnimations(const Json::Value& _config,
OzzImporter* _importer,
const ozz::Endianness _endianness);
// Additive reference enum to config string conversions.
struct AdditiveReferenceEnum {
enum Value { kAnimation, kSkeleton };
};
struct AdditiveReference
struct OZZ_ANIMTOOLS_DLL AdditiveReference
: JsonEnum<AdditiveReference, AdditiveReferenceEnum::Value> {
static EnumNames GetNames();
};
@@ -27,24 +27,21 @@
#include "animation/offline/tools/import2ozz_config.h"
#include <json/json.h>
#include <cstring>
#include <fstream>
#include <sstream>
#include "animation/offline/tools/import2ozz_anim.h"
#include "animation/offline/tools/import2ozz_track.h"
#include "ozz/animation/offline/tools/import2ozz.h"
#include "ozz/animation/offline/animation_optimizer.h"
#include "ozz/animation/offline/tools/import2ozz.h"
#include "ozz/animation/offline/track_optimizer.h"
#include "ozz/base/containers/string.h"
#include "ozz/base/log.h"
#include "ozz/options/options.h"
#include <json/json.h>
bool ValidateExclusiveConfigOption(const ozz::options::Option& _option,
int _argc);
OZZ_OPTIONS_DECLARE_STRING_FN(
@@ -365,14 +362,14 @@ bool SanitizeAnimation(Json::Value& _root, bool _all_options) {
MakeDefault(_root, "additive_reference", "animation",
"Select reference pose to use to build additive/delta animation. "
"Can be \"animation\" to use the 1st animation keyframe as "
"reference, or \"skeleton\" to use skeleton bind pose.");
"reference, or \"skeleton\" to use skeleton rest pose.");
if (!AdditiveReference::IsValidEnumName(
_root["additive_reference"].asCString())) {
ozz::log::Err() << "Invalid additive reference pose \""
<< _root["additive_reference"].asCString() << "\". \""
<< "Can be \"animation\" to use the 1st animation keyframe "
"as reference, or \"skeleton\" to use skeleton bind "
"as reference, or \"skeleton\" to use skeleton rest "
"pose."
<< std::endl;
return false;
@@ -28,6 +28,7 @@
#ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_CONFIG_H_
#define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_CONFIG_H_
#include "ozz/animation/offline/tools/export.h"
#include "ozz/base/platform.h"
#include <json/json-forwards.h>
@@ -37,10 +38,10 @@ namespace animation {
namespace offline {
// Get the sanitized (all members are set, with the right types) configuration.
bool ProcessConfiguration(Json::Value* _config);
OZZ_ANIMTOOLS_DLL bool ProcessConfiguration(Json::Value* _config);
// Internal function used to compare enum names.
bool CompareName(const char* _a, const char* _b);
OZZ_ANIMTOOLS_DLL bool CompareName(const char* _a, const char* _b);
// Struct allowing inheriting class to provide enum names.
template <typename _Type, typename _Enum>
@@ -122,12 +122,13 @@ bool ImportSkeleton(const Json::Value& _config, OzzImporter* _importer,
// Setup node types import properties.
const Json::Value& types_config = import_config["types"];
OzzImporter::NodeType types = {0};
OzzImporter::NodeType types = {};
types.skeleton = types_config["skeleton"].asBool();
types.marker = types_config["marker"].asBool();
types.camera = types_config["camera"].asBool();
types.geometry = types_config["geometry"].asBool();
types.light = types_config["light"].asBool();
types.null = types_config["null"].asBool();
types.any = types_config["any"].asBool();
RawSkeleton raw_skeleton;
@@ -28,6 +28,7 @@
#ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_SKEL_H_
#define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_SKEL_H_
#include "ozz/animation/offline/tools/export.h"
#include "ozz/base/endianness.h"
#include "ozz/base/platform.h"
@@ -41,8 +42,9 @@ namespace offline {
class OzzImporter;
bool ImportSkeleton(const Json::Value& _config, OzzImporter* _importer,
const ozz::Endianness _endianness);
OZZ_ANIMTOOLS_DLL bool ImportSkeleton(const Json::Value& _config,
OzzImporter* _importer,
const ozz::Endianness _endianness);
} // namespace offline
} // namespace animation
@@ -28,12 +28,12 @@
#ifndef OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_TRACK_H_
#define OZZ_ANIMATION_OFFLINE_TOOLS_IMPORT2OZZ_TRACK_H_
#include "animation/offline/tools/import2ozz_config.h"
#include "ozz/animation/offline/tools/export.h"
#include "ozz/animation/offline/tools/import2ozz.h"
#include "ozz/base/endianness.h"
#include "ozz/base/platform.h"
#include "animation/offline/tools/import2ozz_config.h"
#include "ozz/animation/offline/tools/import2ozz.h"
namespace Json {
class Value;
}
@@ -44,12 +44,14 @@ class Skeleton;
namespace offline {
class OzzImporter;
bool ProcessTracks(OzzImporter& _importer, const char* _animation_name,
const Skeleton& _skeleton, const Json::Value& _config,
const ozz::Endianness _endianness);
OZZ_ANIMTOOLS_DLL bool ProcessTracks(OzzImporter& _importer,
const char* _animation_name,
const Skeleton& _skeleton,
const Json::Value& _config,
const ozz::Endianness _endianness);
// Property type enum to config string conversions.
struct PropertyTypeConfig
struct OZZ_ANIMTOOLS_DLL PropertyTypeConfig
: JsonEnum<PropertyTypeConfig, OzzImporter::NodeProperty::Type> {
static EnumNames GetNames();
};
@@ -29,7 +29,7 @@
"filename" : "*.ozz", // Specifies animation output filename. Use a '*' character to specify part(s) of the filename that should be replaced by the clip name.
"raw" : false, // Outputs raw animation.
"additive" : false, // Creates a delta animation that can be used for additive blending.
"additive_reference" : "animation", // Select reference pose to use to build additive/delta animation. Can be "animation" to use the 1st animation keyframe as reference, or "skeleton" to use skeleton bind pose.
"additive_reference" : "animation", // Select reference pose to use to build additive/delta animation. Can be "animation" to use the 1st animation keyframe as reference, or "skeleton" to use skeleton rest pose.
"sampling_rate" : 0, // Selects animation sampling rate in hertz. Set a value <= 0 to use imported scene default frame rate.
"optimize" : true, // Activates keyframes reduction optimization.
"optimization_settings" :