Overte C++ Documentation
AnimationObject.h
1 //
2 // AnimationObject.h
3 // libraries/animation/src/
4 //
5 // Created by Andrzej Kapolka on 4/17/14.
6 // Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
7 // Copyright 2022-2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
14 #ifndef hifi_AnimationObject_h
15 #define hifi_AnimationObject_h
16 
17 #include <QObject>
18 
19 #include <FBXSerializer.h>
20 #include "Scriptable.h"
21 
22 class ScriptEngine;
23 
24 /*@jsdoc
25  * Information about an animation resource, created by {@link AnimationCache.getAnimation}.
26  *
27  * @class AnimationObject
28  * @hideconstructor
29  *
30  * @hifi-interface
31  * @hifi-client-entity
32  * @hifi-avatar
33  * @hifi-server-entity
34  * @hifi-assignment-client
35  *
36  * @property {string[]} jointNames - The names of the joints that are animated. <em>Read-only.</em>
37  * @property {AnimationFrameObject[]} frames - The frames in the animation. <em>Read-only.</em>
38  */
40 class AnimationObject : public QObject, protected Scriptable {
41  Q_OBJECT
42  Q_PROPERTY(QStringList jointNames READ getJointNames)
43  Q_PROPERTY(QVector<HFMAnimationFrame> frames READ getFrames)
44 
45 public:
46 
47  /*@jsdoc
48  * Gets the names of the joints that are animated.
49  * @function AnimationObject.getJointNames
50  * @returns {string[]} The names of the joints that are animated.
51  */
52  Q_INVOKABLE QStringList getJointNames() const;
53 
54  /*@jsdoc
55  * Gets the frames in the animation.
56  * @function AnimationObject.getFrames
57  * @returns {AnimationFrameObject[]} The frames in the animation.
58  */
59  Q_INVOKABLE QVector<HFMAnimationFrame> getFrames() const;
60 };
61 
62 /*@jsdoc
63  * Joint rotations in one frame of an {@link AnimationObject}.
64  *
65  * @class AnimationFrameObject
66  * @hideconstructor
67  *
68  * @hifi-interface
69  * @hifi-client-entity
70  * @hifi-avatar
71  * @hifi-server-entity
72  * @hifi-assignment-client
73  *
74  * @property {Quat[]} rotations - Joint rotations. <em>Read-only.</em>
75  */
77 class AnimationFrameObject : public QObject, protected Scriptable {
78  Q_OBJECT
79  Q_PROPERTY(QVector<glm::quat> rotations READ getRotations)
80 
81 public:
82 
83  /*@jsdoc
84  * Gets the joint rotations in the animation frame.
85  * @function AnimationFrameObject.getRotations
86  * @returns {Quat[]} The joint rotations in the animation frame.
87  */
88  Q_INVOKABLE QVector<glm::quat> getRotations() const;
89 };
90 
91 void registerAnimationTypes(ScriptEngine* engine);
92 void registerAnimationPrototypes(ScriptEngine* engine);
93 
94 #endif // hifi_AnimationObject_h
Scriptable wrapper for animation frames.
Definition: AnimationObject.h:77
Scriptable wrapper for animation pointers.
Definition: AnimationObject.h:40
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptable
Definition: Scriptable.h:29