[runtimes] Added parsing of local/relative properties of TransformConstraints in SkeletonJson

This commit is contained in:
badlogic 2017-02-20 11:22:26 +01:00
parent 03c41b7667
commit f617ff635f
20 changed files with 31 additions and 6 deletions

View File

@ -175,6 +175,9 @@ public class SkeletonJson {
transformConstraintData.target = skeletonData.findBone(constraintMap["target"]);
if (!transformConstraintData.target) throw new Error("Target bone not found: " + constraintMap["target"]);
transformConstraintData.local = constraintMap.hasOwnProperty("local") ? Boolean(constraintMap["local"]) : false;
transformConstraintData.relative = constraintMap.hasOwnProperty("relative") ? Boolean(constraintMap["relative"]) : false;
transformConstraintData.offsetRotation = Number(constraintMap["rotation"] || 0);
transformConstraintData.offsetX = Number(constraintMap["x"] || 0) * scale;
transformConstraintData.offsetY = Number(constraintMap["y"] || 0) * scale;

View File

@ -785,6 +785,8 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
return 0;
}
data->local = Json_getInt(constraintMap, "local", 0);
data->relative = Json_getInt(constraintMap, "relative", 0);
data->offsetRotation = Json_getFloat(constraintMap, "rotation", 0);
data->offsetX = Json_getFloat(constraintMap, "x", 0) * self->scale;
data->offsetY = Json_getFloat(constraintMap, "y", 0) * self->scale;

View File

@ -203,6 +203,9 @@ namespace Spine {
data.target = skeletonData.FindBone(targetName);
if (data.target == null) throw new Exception("Target bone not found: " + targetName);
data.local = GetBoolean(constraintMap, "local", false);
data.relative = GetBoolean(constraintMap, "relative", false);
data.offsetRotation = GetFloat(constraintMap, "rotation", 0);
data.offsetX = GetFloat(constraintMap, "x", 0) * scale;
data.offsetY = GetFloat(constraintMap, "y", 0) * scale;

View File

@ -205,6 +205,9 @@ public class SkeletonJson {
data.target = skeletonData.findBone(targetName);
if (data.target == null) throw new SerializationException("Transform constraint target bone not found: " + targetName);
data.local = constraintMap.getBoolean("local", false);
data.relative = constraintMap.getBoolean("relative", false);
data.offsetRotation = constraintMap.getFloat("rotation", 0);
data.offsetX = constraintMap.getFloat("x", 0) * scale;
data.offsetY = constraintMap.getFloat("y", 0) * scale;

View File

@ -4420,6 +4420,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -4420,6 +4420,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -4109,6 +4109,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -4109,6 +4109,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -4109,6 +4109,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -4109,6 +4109,8 @@ var spine;
data.target = skeletonData.findBone(targetName);
if (data.target == null)
throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,8 @@ module spine {
data.target = skeletonData.findBone(targetName);
if (data.target == null) throw new Error("Transform constraint target bone not found: " + targetName);
data.local = this.getValue(constraintMap, "local", false);
data.relative = this.getValue(constraintMap, "relative", false);
data.offsetRotation = this.getValue(constraintMap, "rotation", 0);
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;