Showing the changes to libraries/script-engine/src/AnimationObject.cpp (1 of 5 files). Show all
Unified · Split
| @@ -0,0 +1,36 @@ | ||
| 1 | +// | |
| 2 | +// AnimationObject.cpp | |
| 3 | +// libraries/script-engine/src/ | |
| 4 | +// | |
| 5 | +// Created by Andrzej Kapolka on 4/17/14. | |
| 6 | +// Copyright (c) 2014 High Fidelity, Inc. All rights reserved. | |
| 7 | +// | |
| 8 | +// Distributed under the Apache License, Version 2.0. | |
| 9 | +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| 10 | +// | |
| 11 | + | |
| 12 | +#include <QScriptEngine> | |
| 13 | + | |
| 14 | +#include "AnimationCache.h" | |
| 15 | +#include "AnimationObject.h" | |
| 16 | + | |
| 17 | +QStringList AnimationObject::getJointNames() const { | |
| 18 | + return qscriptvalue_cast<AnimationPointer>(thisObject())->getJointNames(); | |
| 19 | +} | |
| 20 | + | |
| 21 | +QVector<FBXAnimationFrame> AnimationObject::getFrames() const { | |
| 22 | + return qscriptvalue_cast<AnimationPointer>(thisObject())->getFrames(); | |
| 23 | +} | |
| 24 | + | |
| 25 | +QVector<glm::quat> AnimationFrameObject::getRotations() const { | |
| 26 | + return qscriptvalue_cast<FBXAnimationFrame>(thisObject()).rotations; | |
| 27 | +} | |
| 28 | + | |
| 29 | +void registerAnimationTypes(QScriptEngine* engine) { | |
| 30 | + qScriptRegisterSequenceMetaType<QVector<FBXAnimationFrame> >(engine); | |
| 31 | + engine->setDefaultPrototype(qMetaTypeId<FBXAnimationFrame>(), engine->newQObject( | |
| 32 | + new AnimationFrameObject(), QScriptEngine::ScriptOwnership)); | |
| 33 | + engine->setDefaultPrototype(qMetaTypeId<AnimationPointer>(), engine->newQObject( | |
| 34 | + new AnimationObject(), QScriptEngine::ScriptOwnership)); | |
| 35 | +} | |
| 36 | + | |