mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[runtimes] Added parsing of local/relative properties of TransformConstraints in SkeletonJson
This commit is contained in:
parent
03c41b7667
commit
f617ff635f
Binary file not shown.
@ -175,6 +175,9 @@ public class SkeletonJson {
|
|||||||
transformConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
transformConstraintData.target = skeletonData.findBone(constraintMap["target"]);
|
||||||
if (!transformConstraintData.target) throw new Error("Target bone not found: " + 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.offsetRotation = Number(constraintMap["rotation"] || 0);
|
||||||
transformConstraintData.offsetX = Number(constraintMap["x"] || 0) * scale;
|
transformConstraintData.offsetX = Number(constraintMap["x"] || 0) * scale;
|
||||||
transformConstraintData.offsetY = Number(constraintMap["y"] || 0) * scale;
|
transformConstraintData.offsetY = Number(constraintMap["y"] || 0) * scale;
|
||||||
|
|||||||
@ -785,6 +785,8 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data->local = Json_getInt(constraintMap, "local", 0);
|
||||||
|
data->relative = Json_getInt(constraintMap, "relative", 0);
|
||||||
data->offsetRotation = Json_getFloat(constraintMap, "rotation", 0);
|
data->offsetRotation = Json_getFloat(constraintMap, "rotation", 0);
|
||||||
data->offsetX = Json_getFloat(constraintMap, "x", 0) * self->scale;
|
data->offsetX = Json_getFloat(constraintMap, "x", 0) * self->scale;
|
||||||
data->offsetY = Json_getFloat(constraintMap, "y", 0) * self->scale;
|
data->offsetY = Json_getFloat(constraintMap, "y", 0) * self->scale;
|
||||||
|
|||||||
@ -203,6 +203,9 @@ namespace Spine {
|
|||||||
data.target = skeletonData.FindBone(targetName);
|
data.target = skeletonData.FindBone(targetName);
|
||||||
if (data.target == null) throw new Exception("Target bone not found: " + 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.offsetRotation = GetFloat(constraintMap, "rotation", 0);
|
||||||
data.offsetX = GetFloat(constraintMap, "x", 0) * scale;
|
data.offsetX = GetFloat(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = GetFloat(constraintMap, "y", 0) * scale;
|
data.offsetY = GetFloat(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
@ -205,6 +205,9 @@ public class SkeletonJson {
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null) throw new SerializationException("Transform constraint target bone not found: " + 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.offsetRotation = constraintMap.getFloat("rotation", 0);
|
||||||
data.offsetX = constraintMap.getFloat("x", 0) * scale;
|
data.offsetX = constraintMap.getFloat("x", 0) * scale;
|
||||||
data.offsetY = constraintMap.getFloat("y", 0) * scale;
|
data.offsetY = constraintMap.getFloat("y", 0) * scale;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -4420,6 +4420,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4420,6 +4420,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4109,6 +4109,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4109,6 +4109,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4109,6 +4109,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4109,6 +4109,8 @@ var spine;
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null)
|
if (data.target == null)
|
||||||
throw new Error("Transform constraint target bone not found: " + targetName);
|
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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -145,6 +145,8 @@ module spine {
|
|||||||
data.target = skeletonData.findBone(targetName);
|
data.target = skeletonData.findBone(targetName);
|
||||||
if (data.target == null) throw new Error("Transform constraint target bone not found: " + 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.offsetRotation = this.getValue(constraintMap, "rotation", 0);
|
||||||
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
data.offsetX = this.getValue(constraintMap, "x", 0) * scale;
|
||||||
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
data.offsetY = this.getValue(constraintMap, "y", 0) * scale;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user