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
99 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
1010 //
1111
12+#include "QVariantGLM.h"
13+
1214 #include "ObjectActionSpring.h"
1315
1416 const uint16_t ObjectActionSpring::springVersion = 1;
@@ -150,6 +152,24 @@ bool ObjectActionSpring::updateArguments(QVariantMap arguments) { · 135 unmodified lines
150152 return true;
151153 }
152154
155+QVariantMap 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+
153173 QByteArray ObjectActionSpring::serialize() {
154174 QByteArray ba;
155175 QDataStream dataStream(&ba, QIODevice::WriteOnly);