History

provide a way for scripts to get information about what actions an entity has and what the arguments of those actions are

Seth Alves committed 11 years ago

Commit 0970f011 parent c0c111615 files · +136 −30Browse files

Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 15 files). Show all

Unified · Split

libraries/physics/src/ObjectActionSpring.cpp+20−0
@@ -9,6 +9,8 @@ · 8 unmodified lines
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//10//
11 11
12#include "QVariantGLM.h"
13
12#include "ObjectActionSpring.h"14#include "ObjectActionSpring.h"
13 15
14const uint16_t ObjectActionSpring::springVersion = 1;16const uint16_t ObjectActionSpring::springVersion = 1;
@@ -150,6 +152,24 @@ bool ObjectActionSpring::updateArguments(QVariantMap arguments) { · 135 unmodified lines
150 return true;152 return true;
151}153}
152 154
155QVariantMap ObjectActionSpring::getArguments() {
156 QVariantMap arguments;
157 lockForRead();
158
159 if (_positionalTargetSet) {
160 arguments["linearTimeScale"] = _linearTimeScale;
161 arguments["targetPosition"] = glmToQMap(_positionalTarget);
162 }
163
164 if (_rotationalTargetSet) {
165 arguments["targetRotation"] = glmToQMap(_rotationalTarget);
166 arguments["angularTimeScale"] = _angularTimeScale;
167 }
168
169 unlock();
170 return arguments;
171}
172
153QByteArray ObjectActionSpring::serialize() {173QByteArray ObjectActionSpring::serialize() {
154 QByteArray ba;174 QByteArray ba;
155 QDataStream dataStream(&ba, QIODevice::WriteOnly);175 QDataStream dataStream(&ba, QIODevice::WriteOnly);