diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 6d29534f36..db658ef728 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "AnimationLogging.h" @@ -783,24 +784,6 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos _lastVelocity = workingVelocity; } -static bool isListOfStrings(const QScriptValue& arg) { - if (!arg.isArray()) - return false; - - auto lengthProperty = arg.property("length"); - if (!lengthProperty.isNumber()) - return false; - - int length = lengthProperty.toInt32(); - for (int i = 0; i < length; i++) { - if (!arg.property(i).isString()) { - return false; - } - } - - return true; -} - // Allow script to add/remove handlers and report results, from within their thread. QScriptValue Rig::addAnimationStateHandler(QScriptValue handler, QScriptValue propertiesList) { // called in script thread diff --git a/libraries/shared/src/ScriptValueUtils.cpp b/libraries/shared/src/ScriptValueUtils.cpp new file mode 100644 index 0000000000..e352c0546d --- /dev/null +++ b/libraries/shared/src/ScriptValueUtils.cpp @@ -0,0 +1,34 @@ +// +// ScriptValueUtils.cpp +// libraries/shared/src +// +// Created by Anthony Thibault on 4/15/16. +// Copyright 2016 High Fidelity, Inc. +// +// Utilities for working with QtScriptValues +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "ScriptValueUtils.h" + +bool isListOfStrings(const QScriptValue& arg) { + if (!arg.isArray()) { + return false; + } + + auto lengthProperty = arg.property("length"); + if (!lengthProperty.isNumber()) { + return false; + } + + int length = lengthProperty.toInt32(); + for (int i = 0; i < length; i++) { + if (!arg.property(i).isString()) { + return false; + } + } + + return true; +} diff --git a/libraries/shared/src/ScriptValueUtils.h b/libraries/shared/src/ScriptValueUtils.h new file mode 100644 index 0000000000..2e120a7217 --- /dev/null +++ b/libraries/shared/src/ScriptValueUtils.h @@ -0,0 +1,21 @@ +// +// ScriptValueUtils.h +// libraries/shared/src +// +// Created by Anthony Thibault on 4/15/16. +// Copyright 2016 High Fidelity, Inc. +// +// Utilities for working with QtScriptValues +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_ScriptValueUtils_h +#define hifi_ScriptValueUtils_h + +#include + +bool isListOfStrings(const QScriptValue& value); + +#endif // #define hifi_ScriptValueUtils_h