diff --git a/spine-csharp/src/SpringConstraint.cs b/spine-csharp/src/PhysicsConstraint.cs
similarity index 85%
rename from spine-csharp/src/SpringConstraint.cs
rename to spine-csharp/src/PhysicsConstraint.cs
index a775af5c1..28704f813 100644
--- a/spine-csharp/src/SpringConstraint.cs
+++ b/spine-csharp/src/PhysicsConstraint.cs
@@ -31,12 +31,12 @@ using System;
namespace Spine {
///
- /// Stores the current pose for a spring constraint. A spring constraint applies physics to bones.
+ /// Stores the current pose for a physics constraint. A physics constraint applies physics to bones.
///
- /// See Spring constraints in the Spine User Guide.
+ /// See Physics constraints in the Spine User Guide.
///
- public class SpringConstraint : IUpdatable {
- internal readonly SpringConstraintData data;
+ public class PhysicsConstraint : IUpdatable {
+ internal readonly PhysicsConstraintData data;
internal readonly ExposedList bones;
// BOZO! - stiffness -> strength. stiffness, damping, rope, stretch -> move to spring.
internal float mix, friction, gravity, wind, stiffness, damping;
@@ -44,7 +44,7 @@ namespace Spine {
internal bool active;
- public SpringConstraint (SpringConstraintData data, Skeleton skeleton) {
+ public PhysicsConstraint (PhysicsConstraintData data, Skeleton skeleton) {
if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
this.data = data;
@@ -63,7 +63,7 @@ namespace Spine {
}
/// Copy constructor.
- public SpringConstraint (SpringConstraint constraint, Skeleton skeleton) {
+ public PhysicsConstraint (PhysicsConstraint constraint, Skeleton skeleton) {
if (constraint == null) throw new ArgumentNullException("constraint", "constraint cannot be null.");
if (skeleton == null) throw new ArgumentNullException("skeleton", "skeleton cannot be null.");
data = constraint.data;
@@ -85,6 +85,8 @@ namespace Spine {
}
+ /// The bones that will be modified by this physics constraint.
+ public ExposedList Bones { get { return bones; } }
/// A percentage (0-1) that controls the mix between the constrained and unconstrained poses.
public float Mix { get { return mix; } set { mix = value; } }
public float Friction { get { return friction; } set { friction = value; } }
@@ -95,8 +97,8 @@ namespace Spine {
public bool Rope { get { return rope; } set { rope = value; } }
public bool Stretch { get { return stretch; } set { stretch = value; } }
public bool Active { get { return active; } }
- /// The spring constraint's setup pose data.
- public SpringConstraintData Data { get { return data; } }
+ /// The physics constraint's setup pose data.
+ public PhysicsConstraintData Data { get { return data; } }
override public string ToString () {
return data.name;
diff --git a/spine-csharp/src/SpringConstraint.cs.meta b/spine-csharp/src/PhysicsConstraint.cs.meta
similarity index 100%
rename from spine-csharp/src/SpringConstraint.cs.meta
rename to spine-csharp/src/PhysicsConstraint.cs.meta
diff --git a/spine-csharp/src/SpringConstraintData.cs b/spine-csharp/src/PhysicsConstraintData.cs
similarity index 87%
rename from spine-csharp/src/SpringConstraintData.cs
rename to spine-csharp/src/PhysicsConstraintData.cs
index 787159aa1..59df82458 100644
--- a/spine-csharp/src/SpringConstraintData.cs
+++ b/spine-csharp/src/PhysicsConstraintData.cs
@@ -31,19 +31,19 @@ using System;
namespace Spine {
///
- /// Stores the setup pose for a .
+ /// Stores the setup pose for a .
///
- /// See Spring constraints in the Spine User Guide.
+ /// See Physics constraints in the Spine User Guide.
///
- public class SpringConstraintData : ConstraintData {
+ public class PhysicsConstraintData : ConstraintData {
internal ExposedList bones = new ExposedList();
internal float mix, friction, gravity, wind, stiffness, damping;
internal bool rope, stretch;
- public SpringConstraintData (string name) : base(name) {
+ public PhysicsConstraintData (string name) : base(name) {
}
- /// The bones that are constrained by this spring constraint.
+ /// The bones that are constrained by this physics constraint.
public ExposedList Bones { get { return bones; } }
/// A percentage (0-1) that controls the mix between the constrained and unconstrained poses.
diff --git a/spine-csharp/src/SpringConstraintData.cs.meta b/spine-csharp/src/PhysicsConstraintData.cs.meta
similarity index 100%
rename from spine-csharp/src/SpringConstraintData.cs.meta
rename to spine-csharp/src/PhysicsConstraintData.cs.meta
diff --git a/spine-csharp/src/Skeleton.cs b/spine-csharp/src/Skeleton.cs
index 71b9dbcef..50001d831 100644
--- a/spine-csharp/src/Skeleton.cs
+++ b/spine-csharp/src/Skeleton.cs
@@ -38,23 +38,35 @@ namespace Spine {
internal ExposedList ikConstraints;
internal ExposedList transformConstraints;
internal ExposedList pathConstraints;
- internal ExposedList springConstraints;
+ internal ExposedList physicsConstraints;
internal ExposedList updateCache = new ExposedList();
internal Skin skin;
internal float r = 1, g = 1, b = 1, a = 1;
internal float scaleX = 1, scaleY = 1;
internal float x, y;
+ /// The skeleton's setup pose data.
public SkeletonData Data { get { return data; } }
+ /// The skeleton's bones, sorted parent first. The root bone is always the first bone.
public ExposedList Bones { get { return bones; } }
+ /// The list of bones and constraints, sorted in the order they should be updated,
+ /// as computed by .
public ExposedList UpdateCacheList { get { return updateCache; } }
+ /// The skeleton's slots.
public ExposedList Slots { get { return slots; } }
+ /// The skeleton's slots in the order they should be drawn.
+ /// The returned array may be modified to change the draw order.
public ExposedList DrawOrder { get { return drawOrder; } }
+ /// The skeleton's IK constraints.
public ExposedList IkConstraints { get { return ikConstraints; } }
+ /// The skeleton's path constraints.
public ExposedList PathConstraints { get { return pathConstraints; } }
- public ExposedList SpringConstraints { get { return springConstraints; } }
+ /// The skeleton's physics constraints.
+ public ExposedList PhysicsConstraints { get { return physicsConstraints; } }
+ /// The skeleton's transform constraints.
public ExposedList TransformConstraints { get { return transformConstraints; } }
+ /// The skeleton's current skin.
public Skin Skin {
/// The skeleton's current skin. May be null.
get { return skin; }
@@ -65,9 +77,21 @@ namespace Spine {
public float G { get { return g; } set { g = value; } }
public float B { get { return b; } set { b = value; } }
public float A { get { return a; } set { a = value; } }
+ /// The skeleton X position, which is added to the root bone worldX position.
+ ///
+ /// Bones that do not inherit translation are still affected by this property.
public float X { get { return x; } set { x = value; } }
+ /// The skeleton Y position, which is added to the root bone worldY position.
+ ///
+ /// Bones that do not inherit translation are still affected by this property.
public float Y { get { return y; } set { y = value; } }
+ /// Scales the entire skeleton on the X axis.
+ ///
+ /// Bones that do not inherit scale are still affected by this property.
public float ScaleX { get { return scaleX; } set { scaleX = value; } }
+ /// Scales the entire skeleton on the Y axis.
+ ///
+ /// Bones that do not inherit scale are still affected by this property.
public float ScaleY { get { return scaleY * (Bone.yDown ? -1 : 1); } set { scaleY = value; } }
[Obsolete("Use ScaleX instead. FlipX is when ScaleX is negative.")]
@@ -120,9 +144,9 @@ namespace Spine {
foreach (PathConstraintData pathConstraintData in data.pathConstraints)
pathConstraints.Add(new PathConstraint(pathConstraintData, this));
- springConstraints = new ExposedList(data.springConstraints.Count);
- foreach (SpringConstraintData springConstraintData in data.springConstraints)
- springConstraints.Add(new SpringConstraint(springConstraintData, this));
+ physicsConstraints = new ExposedList(data.physicsConstraints.Count);
+ foreach (PhysicsConstraintData physicsConstraintData in data.physicsConstraints)
+ physicsConstraints.Add(new PhysicsConstraint(physicsConstraintData, this));
UpdateCache();
}
@@ -169,9 +193,9 @@ namespace Spine {
foreach (PathConstraint pathConstraint in skeleton.pathConstraints)
pathConstraints.Add(new PathConstraint(pathConstraint, this));
- springConstraints = new ExposedList(skeleton.springConstraints.Count);
- foreach (SpringConstraint springConstraint in skeleton.springConstraints)
- springConstraints.Add(new SpringConstraint(springConstraint, this));
+ physicsConstraints = new ExposedList(skeleton.physicsConstraints.Count);
+ foreach (PhysicsConstraint physicsConstraint in skeleton.physicsConstraints)
+ physicsConstraints.Add(new PhysicsConstraint(physicsConstraint, this));
skin = skeleton.skin;
r = skeleton.r;
@@ -210,12 +234,12 @@ namespace Spine {
}
int ikCount = this.ikConstraints.Count, transformCount = this.transformConstraints.Count, pathCount = this.pathConstraints.Count,
- springCount = this.springConstraints.Count;
+ physicsCount = this.physicsConstraints.Count;
IkConstraint[] ikConstraints = this.ikConstraints.Items;
TransformConstraint[] transformConstraints = this.transformConstraints.Items;
PathConstraint[] pathConstraints = this.pathConstraints.Items;
- SpringConstraint[] springConstraints = this.springConstraints.Items;
- int constraintCount = ikCount + transformCount + pathCount + springCount;
+ PhysicsConstraint[] physicsConstraints = this.physicsConstraints.Items;
+ int constraintCount = ikCount + transformCount + pathCount + physicsCount;
for (int i = 0; i < constraintCount; i++) {
for (int ii = 0; ii < ikCount; ii++) {
IkConstraint constraint = ikConstraints[ii];
@@ -238,10 +262,10 @@ namespace Spine {
goto continue_outer;
}
}
- for (int ii = 0; ii < springCount; ii++) {
- SpringConstraint constraint = springConstraints[ii];
+ for (int ii = 0; ii < physicsCount; ii++) {
+ PhysicsConstraint constraint = physicsConstraints[ii];
if (constraint.data.order == i) {
- SortSpringConstraint(constraint);
+ SortPhysicsConstraint(constraint);
goto continue_outer;
}
}
@@ -355,7 +379,7 @@ namespace Spine {
}
}
- private void SortSpringConstraint (SpringConstraint constraint) {
+ private void SortPhysicsConstraint (PhysicsConstraint constraint) {
constraint.active = !constraint.data.skinRequired || (skin != null && skin.constraints.Contains(constraint.data));
if (!constraint.active) return;
@@ -491,10 +515,10 @@ namespace Spine {
constraint.mixY = data.mixY;
}
- SpringConstraint[] springConstraints = this.springConstraints.Items;
- for (int i = 0, n = this.springConstraints.Count; i < n; i++) {
- SpringConstraint constraint = springConstraints[i];
- SpringConstraintData data = constraint.data;
+ PhysicsConstraint[] physicsConstraints = this.physicsConstraints.Items;
+ for (int i = 0, n = this.physicsConstraints.Count; i < n; i++) {
+ PhysicsConstraint constraint = physicsConstraints[i];
+ PhysicsConstraintData data = constraint.data;
constraint.mix = data.mix;
constraint.friction = data.friction;
constraint.gravity = data.gravity;
@@ -657,14 +681,14 @@ namespace Spine {
return null;
}
- /// Finds a spring constraint by comparing each spring constraint's name. It is more efficient to cache the results of this
+ /// Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
/// method than to call it repeatedly.
/// May be null.
- public SpringConstraint FindSpringConstraint (String constraintName) {
+ public PhysicsConstraint FindPhysicsConstraint (String constraintName) {
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
- SpringConstraint[] springConstraints = this.springConstraints.Items;
- for (int i = 0, n = this.springConstraints.Count; i < n; i++) {
- SpringConstraint constraint = springConstraints[i];
+ PhysicsConstraint[] physicsConstraints = this.physicsConstraints.Items;
+ for (int i = 0, n = this.physicsConstraints.Count; i < n; i++) {
+ PhysicsConstraint constraint = physicsConstraints[i];
if (constraint.data.name.Equals(constraintName)) return constraint;
}
return null;
diff --git a/spine-csharp/src/SkeletonData.cs b/spine-csharp/src/SkeletonData.cs
index c8d367be8..3098123ea 100644
--- a/spine-csharp/src/SkeletonData.cs
+++ b/spine-csharp/src/SkeletonData.cs
@@ -43,7 +43,7 @@ namespace Spine {
internal ExposedList ikConstraints = new ExposedList();
internal ExposedList transformConstraints = new ExposedList();
internal ExposedList pathConstraints = new ExposedList();
- internal ExposedList springConstraints = new ExposedList();
+ internal ExposedList physicsConstraints = new ExposedList();
internal float x, y, width, height;
internal string version, hash;
@@ -70,12 +70,18 @@ namespace Spine {
/// May be null.
public Skin DefaultSkin { get { return defaultSkin; } set { defaultSkin = value; } }
+ /// The skeleton's events.
public ExposedList Events { get { return events; } set { events = value; } }
+ /// The skeleton's animations.
public ExposedList Animations { get { return animations; } set { animations = value; } }
+ /// The skeleton's IK constraints.
public ExposedList IkConstraints { get { return ikConstraints; } set { ikConstraints = value; } }
+ /// The skeleton's transform constraints.
public ExposedList TransformConstraints { get { return transformConstraints; } set { transformConstraints = value; } }
+ /// The skeleton's path constraints.
public ExposedList PathConstraints { get { return pathConstraints; } set { pathConstraints = value; } }
- public ExposedList SpringConstraints { get { return springConstraints; } set { springConstraints = value; } }
+ /// The skeleton's physics constraints.
+ public ExposedList PhysicsConstraints { get { return physicsConstraints; } set { physicsConstraints = value; } }
public float X { get { return x; } set { x = value; } }
public float Y { get { return y; } set { y = value; } }
@@ -202,18 +208,18 @@ namespace Spine {
return null;
}
- // --- Spring constraints
+ // --- Physics constraints
///
- /// Finds a spring constraint by comparing each spring constraint's name. It is more efficient to cache the results of this
+ /// Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
/// method than to call it multiple times.
///
/// May be null.
- public SpringConstraintData FindSpringConstraint (String constraintName) {
+ public PhysicsConstraintData FindPhysicsConstraint (String constraintName) {
if (constraintName == null) throw new ArgumentNullException("constraintName", "constraintName cannot be null.");
- Object[] springConstraints = this.springConstraints.Items;
- for (int i = 0, n = this.springConstraints.Count; i < n; i++) {
- SpringConstraintData constraint = (SpringConstraintData)springConstraints[i];
+ Object[] physicsConstraints = this.physicsConstraints.Items;
+ for (int i = 0, n = this.physicsConstraints.Count; i < n; i++) {
+ PhysicsConstraintData constraint = (PhysicsConstraintData)physicsConstraints[i];
if (constraint.name.Equals(constraintName)) return constraint;
}
return null;