Updated ozz-animation to version 0.14.1 @35b2efd4
This commit is contained in:
@@ -7,6 +7,7 @@ add_executable(test2ozz
|
||||
target_link_libraries(test2ozz
|
||||
ozz_animation_tools
|
||||
ozz_options)
|
||||
target_copy_shared_libraries(test2ozz)
|
||||
|
||||
set_target_properties(test2ozz
|
||||
PROPERTIES FOLDER "ozz/tests/animation_offline")
|
||||
@@ -18,6 +19,7 @@ file(WRITE "${ozz_temp_directory}/good.content1" "good content 1")
|
||||
file(WRITE "${ozz_temp_directory}/good.content2" "good content 2")
|
||||
file(WRITE "${ozz_temp_directory}/good.content_renamed" "good content renamed")
|
||||
file(WRITE "${ozz_temp_directory}/non_unique_names.content" "good content but not unique joint names")
|
||||
file(WRITE "${ozz_temp_directory}/partial.good.content0" "partial good content")
|
||||
|
||||
# Creates config test files.
|
||||
file(WRITE "${ozz_temp_directory}/valid_config.json" "{\"skeleton\":{\"filename\":\"${ozz_temp_directory}/skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"${ozz_temp_directory}/animation_valid_config.ozz\"}]}")
|
||||
@@ -179,6 +181,9 @@ set_tests_properties(test2ozz_anim_no_match PROPERTIES PASS_REGULAR_EXPRESSION "
|
||||
add_test(NAME test2ozz_anim_additive_wrong_ref COMMAND test2ozz "--file=${ozz_temp_directory}/good.content1" "--config={\"skeleton\":{\"filename\":\"${ozz_temp_directory}/skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"${ozz_temp_directory}/animation_${CMAKE_CURRENT_LIST_LINE}.ozz\",\"additive\":true,\"additive_reference\":\"anim\"}]}")
|
||||
set_tests_properties(test2ozz_anim_additive_wrong_ref PROPERTIES PASS_REGULAR_EXPRESSION "Invalid additive reference pose \"anim\"." DEPENDS test2ozz_skel_simple)
|
||||
|
||||
add_test(NAME test2ozz_anim_partial_good_content COMMAND test2ozz "--file=${ozz_temp_directory}/partial.good.content0" "--config={\"skeleton\":{\"filename\":\"${ozz_temp_directory}/skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"${ozz_temp_directory}/anim_good_part_content.ozz\"}]}")
|
||||
set_tests_properties(test2ozz_anim_partial_good_content PROPERTIES PASS_REGULAR_EXPRESSION "One of animation failed when import" DEPENDS test2ozz_skel_simple)
|
||||
|
||||
# Run test2ozz track import failing tests
|
||||
#----------------------------
|
||||
|
||||
@@ -194,6 +199,9 @@ set_tests_properties(test2ozz_anim_track_bad_type PROPERTIES PASS_REGULAR_EXPRES
|
||||
add_test(NAME test2ozz_anim_track_invalid_type COMMAND test2ozz "--file=${ozz_temp_directory}/good.content1" "--config={\"skeleton\":{\"filename\":\"${ozz_temp_directory}/skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"${ozz_temp_directory}/animation_${CMAKE_CURRENT_LIST_LINE}.ozz\",\"tracks\":[{\"properties\":[{\"joint_name\":\"joint1\",\"property_name\":\"property2\",\"type\":\"1\",\"filename\":\"${ozz_temp_directory}/anim_should_not_exist.ozz\"}]}]}]}")
|
||||
set_tests_properties(test2ozz_anim_track_invalid_type PROPERTIES PASS_REGULAR_EXPRESSION "Invalid value \"1\" for import track type property." DEPENDS test2ozz_skel_simple)
|
||||
|
||||
add_test(NAME test2ozz_anim_track_import_failed COMMAND test2ozz "--file=${ozz_temp_directory}/partial.good.content0" "--config={\"skeleton\":{\"filename\":\"${ozz_temp_directory}/skeleton.ozz\",\"import\":{\"enable\":false}},\"animations\":[{\"filename\":\"${ozz_temp_directory}/anim_good_part_content.ozz\",\"tracks\":[{\"properties\":[{\"joint_name\":\"joint0\",\"property_name\":\"property0\",\"type\":\"float1\",\"filename\":\"${ozz_temp_directory}/anim_should_not_exist.ozz\"}]}]}]}")
|
||||
set_tests_properties(test2ozz_anim_track_import_failed PROPERTIES PASS_REGULAR_EXPRESSION "One of track failed when import" DEPENDS test2ozz_skel_simple)
|
||||
|
||||
# Ensures nothing was outputted.
|
||||
add_test(NAME test2ozz_anim_output COMMAND ${CMAKE_COMMAND} -E copy "${ozz_temp_directory}/anim_should_not_exist.ozz" "${ozz_temp_directory}/anim_should_not_exist_too.ozz")
|
||||
set_tests_properties(test2ozz_anim_output PROPERTIES WILL_FAIL true)
|
||||
@@ -208,7 +216,8 @@ set_tests_properties(test2ozz_anim_output PROPERTIES
|
||||
test2ozz_anim_track_bad_joint_name
|
||||
test2ozz_anim_track_bad_ppt_name
|
||||
test2ozz_anim_track_bad_type
|
||||
test2ozz_anim_track_invalid_type")
|
||||
test2ozz_anim_track_invalid_type
|
||||
test2ozz_anim_track_import_failed")
|
||||
|
||||
# Run test2ozz animation import passing tests
|
||||
#----------------------------
|
||||
@@ -391,8 +400,10 @@ target_link_libraries(test_fuse_ozz_animation_tools
|
||||
ozz_options
|
||||
json
|
||||
gtest)
|
||||
#target_copy_shared_libraries(test_fuse_ozz_animation_tools)
|
||||
|
||||
set_target_properties(test_fuse_ozz_animation_tools PROPERTIES FOLDER "ozz/tests/animation_offline")
|
||||
target_compile_definitions(test_fuse_ozz_animation_tools PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:OZZ_BUILD_ANIMATIONTOOLS_LIB>)
|
||||
|
||||
add_test(NAME test_fuse_ozz_animation_tools_no_arg COMMAND test_fuse_ozz_animation_tools)
|
||||
set_tests_properties(test_fuse_ozz_animation_tools_no_arg PROPERTIES PASS_REGULAR_EXPRESSION "Required option \"file\" is not specified.")
|
||||
|
||||
@@ -45,12 +45,22 @@ class TestConverter : public ozz::animation::offline::OzzImporter {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char good_content[] = "good content";
|
||||
|
||||
char buffer[256];
|
||||
bool valid =
|
||||
file_->Read(buffer, sizeof(buffer)) >= sizeof(good_content) - 1 &&
|
||||
memcmp(buffer, good_content, sizeof(good_content) - 1) == 0;
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
bool valid = true;
|
||||
{
|
||||
const char good_content[] = "good content";
|
||||
valid = file_->Read(buffer, sizeof(buffer)) >= sizeof(good_content) - 1 &&
|
||||
memcmp(buffer, good_content, sizeof(good_content) - 1) == 0;
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
const char partial_good_content[] = "partial good content";
|
||||
valid = file_->Read(buffer, sizeof(buffer)) >= sizeof(partial_good_content) - 1 &&
|
||||
memcmp(buffer, partial_good_content, sizeof(partial_good_content) - 1) == 0;
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
@@ -172,6 +182,18 @@ class TestConverter : public ozz::animation::offline::OzzImporter {
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles one of animation is good
|
||||
{
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
const char content[] = "partial good content";
|
||||
if (file_->Read(buffer, sizeof(buffer)) >= sizeof(content) - 1 &&
|
||||
memcmp(buffer, content, sizeof(content) - 1) == 0) {
|
||||
names.push_back("bad");
|
||||
names.push_back("good");
|
||||
return names;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
@@ -223,6 +245,20 @@ class TestConverter : public ozz::animation::offline::OzzImporter {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{ // Handles one of animation is good
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
const char content[] = "partial good content";
|
||||
if (file_->Read(buffer, sizeof(buffer)) >= sizeof(content) - 1 &&
|
||||
memcmp(buffer, content, sizeof(content) - 1) == 0){
|
||||
|
||||
if (strcmp(_animation_name, "good") == 0){
|
||||
_animation->tracks.resize(_skeleton.num_joints());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -254,6 +290,21 @@ class TestConverter : public ozz::animation::offline::OzzImporter {
|
||||
(void)_sampling_rate;
|
||||
(void)_track;
|
||||
|
||||
{
|
||||
char buffer[256];
|
||||
const char content[] = "partial good content";
|
||||
if (strcmp(_animation_name, "good") == 0 ||
|
||||
strcmp(_animation_name, "bad") == 0) {
|
||||
file_->Seek(0, ozz::io::File::kSet);
|
||||
bool valid = file_->Read(buffer, sizeof(buffer)) >= sizeof(content) - 1;
|
||||
valid &= memcmp(buffer, content, sizeof(content) - 1) == 0;
|
||||
if (valid){
|
||||
return !((strcmp(_node_name, "joint0") == 0) &&
|
||||
(strcmp(_track_name, "property0") == 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// joint2 doesn't have the property
|
||||
bool found = (strcmp(_node_name, "joint0") == 0 ||
|
||||
strcmp(_node_name, "joint1") == 0) &&
|
||||
|
||||
Reference in New Issue
Block a user