diff --git a/spine-csharp/src/Skeleton.cs b/spine-csharp/src/Skeleton.cs index 69ee5a368..7ff11eb60 100644 --- a/spine-csharp/src/Skeleton.cs +++ b/spine-csharp/src/Skeleton.cs @@ -38,7 +38,6 @@ namespace Spine { internal ExposedList ikConstraints; internal ExposedList transformConstraints; internal ExposedList pathConstraints; - internal ExposedList springConstraints; internal ExposedList updateCache = new ExposedList(); internal Skin skin; internal float r = 1, g = 1, b = 1, a = 1; @@ -52,7 +51,6 @@ namespace Spine { public ExposedList DrawOrder { get { return drawOrder; } } public ExposedList IkConstraints { get { return ikConstraints; } } public ExposedList PathConstraints { get { return pathConstraints; } } - public ExposedList SpringConstraints { get { return SpringConstraints; } } public ExposedList TransformConstraints { get { return transformConstraints; } } public Skin Skin { @@ -120,10 +118,6 @@ 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)); - UpdateCache(); } @@ -169,10 +163,6 @@ 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)); - skin = skeleton.skin; r = skeleton.r; g = skeleton.g; @@ -209,13 +199,11 @@ namespace Spine { } } - int ikCount = this.ikConstraints.Count, transformCount = this.transformConstraints.Count, pathCount = this.pathConstraints.Count, - springCount = this.springConstraints.Count; + int ikCount = this.ikConstraints.Count, transformCount = this.transformConstraints.Count, pathCount = this.pathConstraints.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; + int constraintCount = ikCount + transformCount + pathCount; for (int i = 0; i < constraintCount; i++) { for (int ii = 0; ii < ikCount; ii++) { IkConstraint constraint = ikConstraints[ii]; @@ -238,13 +226,6 @@ namespace Spine { goto continue_outer; } } - for (int ii = 0; ii < springCount; ii++) { - SpringConstraint constraint = springConstraints[ii]; - if (constraint.data.order == i) { - SortSpringConstraint(constraint); - goto continue_outer; - } - } continue_outer: { } } @@ -355,23 +336,6 @@ namespace Spine { } } - private void SortSpringConstraint (SpringConstraint constraint) { - constraint.active = !constraint.data.skinRequired || (skin != null && skin.constraints.Contains(constraint.data)); - if (!constraint.active) return; - - Object[] constrained = constraint.bones.Items; - int boneCount = constraint.bones.Count; - for (int i = 0; i < boneCount; i++) - SortBone((Bone)constrained[i]); - - updateCache.Add(constraint); - - for (int i = 0; i < boneCount; i++) - SortReset(((Bone)constrained[i]).children); - for (int i = 0; i < boneCount; i++) - ((Bone)constrained[i]).sorted = true; - } - private void SortBone (Bone bone) { if (bone.sorted) return; Bone parent = bone.parent; @@ -490,20 +454,6 @@ namespace Spine { constraint.mixX = data.mixX; 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; - constraint.mix = data.mix; - constraint.friction = data.friction; - constraint.gravity = data.gravity; - constraint.wind = data.wind; - constraint.stiffness = data.stiffness; - constraint.damping = data.damping; - constraint.rope = data.rope; - constraint.stretch = data.stretch; - } } public void SetSlotsToSetupPose () { @@ -657,19 +607,6 @@ 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 - /// method than to call it repeatedly. - /// May be null. - public SpringConstraint FindSpringConstraint (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]; - if (constraint.data.name.Equals(constraintName)) return constraint; - } - return null; - } - /// Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. /// The horizontal distance between the skeleton origin and the left side of the AABB. /// The vertical distance between the skeleton origin and the bottom side of the AABB. diff --git a/spine-csharp/src/SkeletonData.cs b/spine-csharp/src/SkeletonData.cs index 7e7ce1c61..9039073c4 100644 --- a/spine-csharp/src/SkeletonData.cs +++ b/spine-csharp/src/SkeletonData.cs @@ -43,7 +43,6 @@ namespace Spine { internal ExposedList ikConstraints = new ExposedList(); internal ExposedList transformConstraints = new ExposedList(); internal ExposedList pathConstraints = new ExposedList(); - internal ExposedList springConstraints = new ExposedList(); internal float x, y, width, height; internal string version, hash; @@ -201,23 +200,6 @@ namespace Spine { return null; } - // --- Spring constraints - - /// - /// Finds a spring constraint by comparing each spring 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) { - 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]; - if (constraint.name.Equals(constraintName)) return constraint; - } - return null; - } - // --- override public string ToString () { diff --git a/spine-csharp/src/SpringConstraint.cs b/spine-csharp/src/SpringConstraint.cs deleted file mode 100644 index a775af5c1..000000000 --- a/spine-csharp/src/SpringConstraint.cs +++ /dev/null @@ -1,105 +0,0 @@ -/****************************************************************************** - * Spine Runtimes License Agreement - * Last updated September 24, 2021. Replaces all prior versions. - * - * Copyright (c) 2013-2021, Esoteric Software LLC - * - * Integration of the Spine Runtimes into software or otherwise creating - * derivative works of the Spine Runtimes is permitted under the terms and - * conditions of Section 2 of the Spine Editor License Agreement: - * http://esotericsoftware.com/spine-editor-license - * - * Otherwise, it is permitted to integrate the Spine Runtimes into software - * or otherwise create derivative works of the Spine Runtimes (collectively, - * "Products"), provided that each user of the Products must obtain their own - * Spine Editor license and redistribution of the Products in any form must - * include this license and copyright notice. - * - * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, - * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -using System; - -namespace Spine { - /// - /// Stores the current pose for a spring constraint. A spring constraint applies physics to bones. - /// - /// See Spring constraints in the Spine User Guide. - /// - public class SpringConstraint : IUpdatable { - internal readonly SpringConstraintData data; - internal readonly ExposedList bones; - // BOZO! - stiffness -> strength. stiffness, damping, rope, stretch -> move to spring. - internal float mix, friction, gravity, wind, stiffness, damping; - internal bool rope, stretch; - - internal bool active; - - public SpringConstraint (SpringConstraintData 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; - mix = data.mix; - friction = data.friction; - gravity = data.gravity; - wind = data.wind; - stiffness = data.stiffness; - damping = data.damping; - rope = data.rope; - stretch = data.stretch; - - bones = new ExposedList(data.Bones.Count); - foreach (BoneData boneData in data.bones) - bones.Add(skeleton.bones.Items[boneData.index]); - } - - /// Copy constructor. - public SpringConstraint (SpringConstraint 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; - bones = new ExposedList(constraint.bones.Count); - foreach (Bone bone in constraint.bones) - bones.Add(skeleton.bones.Items[bone.data.index]); - mix = constraint.mix; - friction = constraint.friction; - gravity = constraint.gravity; - wind = constraint.wind; - stiffness = constraint.stiffness; - damping = constraint.damping; - rope = constraint.rope; - stretch = constraint.stretch; - } - - /// Applies the constraint to the constrained bones. - public void Update () { - - } - - /// 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; } } - public float Gravity { get { return gravity; } set { gravity = value; } } - public float Wind { get { return wind; } set { wind = value; } } - public float Stiffness { get { return stiffness; } set { stiffness = value; } } - public float Damping { get { return damping; } set { damping = value; } } - 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; } } - - override public string ToString () { - return data.name; - } - } -} diff --git a/spine-csharp/src/SpringConstraint.cs.meta b/spine-csharp/src/SpringConstraint.cs.meta deleted file mode 100644 index e06a49dfe..000000000 --- a/spine-csharp/src/SpringConstraint.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e2816491d178b3b4986920107586ce55 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/spine-csharp/src/SpringConstraintData.cs b/spine-csharp/src/SpringConstraintData.cs deleted file mode 100644 index 787159aa1..000000000 --- a/spine-csharp/src/SpringConstraintData.cs +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * Spine Runtimes License Agreement - * Last updated September 24, 2021. Replaces all prior versions. - * - * Copyright (c) 2013-2021, Esoteric Software LLC - * - * Integration of the Spine Runtimes into software or otherwise creating - * derivative works of the Spine Runtimes is permitted under the terms and - * conditions of Section 2 of the Spine Editor License Agreement: - * http://esotericsoftware.com/spine-editor-license - * - * Otherwise, it is permitted to integrate the Spine Runtimes into software - * or otherwise create derivative works of the Spine Runtimes (collectively, - * "Products"), provided that each user of the Products must obtain their own - * Spine Editor license and redistribution of the Products in any form must - * include this license and copyright notice. - * - * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, - * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -using System; - -namespace Spine { - /// - /// Stores the setup pose for a . - /// - /// See Spring constraints in the Spine User Guide. - /// - public class SpringConstraintData : ConstraintData { - internal ExposedList bones = new ExposedList(); - internal float mix, friction, gravity, wind, stiffness, damping; - internal bool rope, stretch; - - public SpringConstraintData (string name) : base(name) { - } - - /// The bones that are constrained by this spring 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; } } - public float Gravity { get { return gravity; } set { gravity = value; } } - public float Wind { get { return wind; } set { wind = value; } } - public float Stiffness { get { return stiffness; } set { stiffness = value; } } - public float Damping { get { return damping; } set { damping = value; } } - public bool Rope { get { return rope; } set { rope = value; } } - public bool Stretch { get { return stretch; } set { stretch = value; } } - } -} diff --git a/spine-csharp/src/SpringConstraintData.cs.meta b/spine-csharp/src/SpringConstraintData.cs.meta deleted file mode 100644 index d883a6d05..000000000 --- a/spine-csharp/src/SpringConstraintData.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 438688f6194e6dc40953a23d05d48e1a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: