Ignition Common

API Reference

3.14.0
SkeletonAnimation.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGNITION_COMMON_SKELETONANIMATION_HH_
18 #define IGNITION_COMMON_SKELETONANIMATION_HH_
19 
20 #include <map>
21 #include <utility>
22 #include <string>
23 
24 #include <ignition/math/Matrix4.hh>
25 #include <ignition/math/Pose3.hh>
26 
28 #include <ignition/common/graphics/Export.hh>
29 
30 namespace ignition
31 {
32  namespace common
33  {
35  class SkeletonAnimationPrivate;
36 
40  class IGNITION_COMMON_GRAPHICS_VISIBLE SkeletonAnimation
41  {
44  public: explicit SkeletonAnimation(const std::string &_name);
45 
48  public: ~SkeletonAnimation();
49 
50  // NOTE: this is not needed starting in ign-common4 since ign-common4 uses
51  // the IGN_UTILS_IMPL_PTR instead of a raw impl pointer. So, this
52  // method should not be included in forward ports from ign-common3 to
53  // ign-common4
58 
61  public: void SetName(const std::string& _name);
62 
65  public: std::string Name() const;
66 
69  public: unsigned int NodeCount() const;
70 
75  const;
76 
80  public: bool HasNode(const std::string &_node) const;
81 
86  public: void AddKeyFrame(const std::string &_node, const double _time,
87  const math::Matrix4d &_mat);
88 
93  public: void AddKeyFrame(const std::string &_node, const double _time,
94  const math::Pose3d &_pose);
95 
105  public: math::Matrix4d NodePoseAt(const std::string &_node,
106  const double _time, const bool _loop = true) const;
107 
117  const double _time, const bool _loop = true) const;
118 
128  const std::string &_node, const bool _loop = true) const;
129 
132  public: void Scale(const double _scale);
133 
136  public: double Length() const;
137 
139  private: SkeletonAnimationPrivate *data;
140  };
141  }
142 }
143 #endif
Node animation.
Definition: NodeAnimation.hh:37
Skeleton animation.
Definition: SkeletonAnimation.hh:41
void SetName(const std::string &_name)
Changes the name.
std::map< std::string, math::Matrix4d > PoseAt(const double _time, const bool _loop=true) const
Returns a dictionary of transformations indexed by name at a specific time if a node does not exist a...
std::string Name() const
Returns the name.
void AddKeyFrame(const std::string &_node, const double _time, const math::Matrix4d &_mat)
Adds or replaces a named key frame at a specific time.
bool HasNode(const std::string &_node) const
Looks for a node with a specific name in the animations.
SkeletonAnimation(const std::string &_name)
The Constructor.
double Length() const
Returns the duration of the animations.
math::Matrix4d NodePoseAt(const std::string &_node, const double _time, const bool _loop=true) const
Returns the key frame transformation for a named animation at a specific time if a node does not exis...
void AddKeyFrame(const std::string &_node, const double _time, const math::Pose3d &_pose)
Adds or replaces a named key frame at a specific time.
void Scale(const double _scale)
Scales every animation in the animations list.
unsigned int NodeCount() const
Returns the number of animation nodes.
NodeAnimation * NodeAnimationByName(const std::string &_name) const
Returns the node animation for given node name.
std::map< std::string, math::Matrix4d > PoseAtX(const double _x, const std::string &_node, const bool _loop=true) const
Returns a dictionary of transformations indexed by name where a named node transformation's translati...
~SkeletonAnimation()
The destructor. Clears the list without destroying the animations.
SkeletonAnimation & operator=(const SkeletonAnimation &_other)
Assignment operator.
Forward declarations for the common classes.