Skip to content

Commit

Permalink
Copy animation name to output in ozz::animation::offline::AdditiveAni…
Browse files Browse the repository at this point in the history
…mationBuilder.
  • Loading branch information
guillaumeblanc authored Sep 30, 2021
1 parent 2541d20 commit ccff2b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/animation/offline/additive_animation_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -143,6 +144,7 @@ bool AdditiveAnimationBuilder::operator()(
}

// Rebuilds output animation.
_output->name = _input.name;
_output->duration = _input.duration;
_output->tracks.resize(_input.tracks.size());

Expand Down
11 changes: 6 additions & 5 deletions test/animation/offline/additive_animation_builder_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@
// //
//----------------------------------------------------------------------------//

#include "ozz/animation/offline/additive_animation_builder.h"

#include "gtest/gtest.h"

#include "ozz/animation/offline/additive_animation_builder.h"
#include "ozz/animation/offline/raw_animation.h"
#include "ozz/base/maths/gtest_math_helper.h"
#include "ozz/base/maths/math_constant.h"
#include "ozz/base/maths/transform.h"

#include "ozz/animation/offline/raw_animation.h"

using ozz::animation::offline::AdditiveAnimationBuilder;
using ozz::animation::offline::RawAnimation;

Expand Down Expand Up @@ -85,6 +82,7 @@ TEST(Build, AdditiveAnimationBuilder) {
AdditiveAnimationBuilder builder;

RawAnimation input;
input.name = "test";
input.duration = 1.f;
input.tracks.resize(3);

Expand Down Expand Up @@ -140,6 +138,7 @@ TEST(Build, AdditiveAnimationBuilder) {
{
RawAnimation output;
ASSERT_TRUE(builder(input, &output));
EXPECT_STREQ(output.name.c_str(), input.name.c_str());
EXPECT_EQ(output.num_tracks(), 3);

// 1st track.
Expand Down Expand Up @@ -199,6 +198,7 @@ TEST(BuildRefPose, AdditiveAnimationBuilder) {
RawAnimation input;
input.duration = 1.f;
input.tracks.resize(3);
input.name = "test";

// First track is empty
{
Expand Down Expand Up @@ -263,6 +263,7 @@ TEST(BuildRefPose, AdditiveAnimationBuilder) {
RawAnimation output;
ASSERT_TRUE(
builder(input, ozz::span<ozz::math::Transform>(ref_pose), &output));
EXPECT_STREQ(output.name.c_str(), input.name.c_str());
EXPECT_EQ(output.num_tracks(), 3);

// 1st track.
Expand Down

0 comments on commit ccff2b1

Please sign in to comment.