handle case where action params are missing

This commit is contained in:
Andrew Meadows 2015-07-10 11:30:24 -07:00
parent 71440dfbc5
commit 90ae1fea8b

View file

@ -95,26 +95,21 @@ bool ObjectActionOffset::updateArguments(QVariantMap arguments) {
glm::vec3 pointToOffsetFrom = glm::vec3 pointToOffsetFrom =
EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true); EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true);
if (!ok) { if (!ok) {
return false; pointToOffsetFrom = _pointToOffsetFrom;
} }
ok = true; ok = true;
float linearTimeScale = float linearTimeScale =
EntityActionInterface::extractFloatArgument("offset action", arguments, "linearTimeScale", ok, false); EntityActionInterface::extractFloatArgument("offset action", arguments, "linearTimeScale", ok, false);
if (ok) { if (!ok) {
if (linearTimeScale <= 0.0f) { linearTimeScale = _linearTimeScale;
qDebug() << "offset action -- linearTimeScale must be greater than zero.";
return false;
}
} else {
linearTimeScale = 0.1f;
} }
ok = true; ok = true;
float linearDistance = float linearDistance =
EntityActionInterface::extractFloatArgument("offset action", arguments, "linearDistance", ok, false); EntityActionInterface::extractFloatArgument("offset action", arguments, "linearDistance", ok, false);
if (!ok) { if (!ok) {
linearDistance = 0.0f; linearDistance = _linearDistance;
} }
// only change stuff if something actually changed // only change stuff if something actually changed