Merge branch '4.1' into 4.2-beta

This commit is contained in:
Harald Csaszar 2022-12-19 11:39:05 +01:00
commit c0e0842520
6 changed files with 2 additions and 269 deletions

View File

@ -38,7 +38,6 @@ namespace Spine {
internal ExposedList<IkConstraint> ikConstraints;
internal ExposedList<TransformConstraint> transformConstraints;
internal ExposedList<PathConstraint> pathConstraints;
internal ExposedList<SpringConstraint> springConstraints;
internal ExposedList<IUpdatable> updateCache = new ExposedList<IUpdatable>();
internal Skin skin;
internal float r = 1, g = 1, b = 1, a = 1;
@ -52,7 +51,6 @@ namespace Spine {
public ExposedList<Slot> DrawOrder { get { return drawOrder; } }
public ExposedList<IkConstraint> IkConstraints { get { return ikConstraints; } }
public ExposedList<PathConstraint> PathConstraints { get { return pathConstraints; } }
public ExposedList<SpringConstraint> SpringConstraints { get { return SpringConstraints; } }
public ExposedList<TransformConstraint> 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<SpringConstraint>(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<SpringConstraint>(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;
}
/// <summary>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.</summary>
/// <returns>May be null.</returns>
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;
}
/// <summary>Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.</summary>
/// <param name="x">The horizontal distance between the skeleton origin and the left side of the AABB.</param>
/// <param name="y">The vertical distance between the skeleton origin and the bottom side of the AABB.</param>

View File

@ -43,7 +43,6 @@ namespace Spine {
internal ExposedList<IkConstraintData> ikConstraints = new ExposedList<IkConstraintData>();
internal ExposedList<TransformConstraintData> transformConstraints = new ExposedList<TransformConstraintData>();
internal ExposedList<PathConstraintData> pathConstraints = new ExposedList<PathConstraintData>();
internal ExposedList<SpringConstraintData> springConstraints = new ExposedList<SpringConstraintData>();
internal float x, y, width, height;
internal string version, hash;
@ -201,23 +200,6 @@ namespace Spine {
return null;
}
// --- Spring constraints
/// <summary>
/// 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.
/// </summary>
/// <returns>May be null.</returns>
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 () {

View File

@ -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 {
/// <summary>
/// Stores the current pose for a spring constraint. A spring constraint applies physics to bones.
/// <para>
/// See <a href="http://esotericsoftware.com/spine-spring-constraints">Spring constraints</a> in the Spine User Guide.</para>
/// </summary>
public class SpringConstraint : IUpdatable {
internal readonly SpringConstraintData data;
internal readonly ExposedList<Bone> 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<Bone>(data.Bones.Count);
foreach (BoneData boneData in data.bones)
bones.Add(skeleton.bones.Items[boneData.index]);
}
/// <summary>Copy constructor.</summary>
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<Bone>(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;
}
/// <summary>Applies the constraint to the constrained bones.</summary>
public void Update () {
}
/// <summary>A percentage (0-1) that controls the mix between the constrained and unconstrained poses.</summary>
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; } }
/// <summary>The spring constraint's setup pose data.</summary>
public SpringConstraintData Data { get { return data; } }
override public string ToString () {
return data.name;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e2816491d178b3b4986920107586ce55
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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 {
/// <summary>
/// Stores the setup pose for a <see cref="SpringConstraint"/>.
/// <para>
/// See <a href="http://esotericsoftware.com/spine-spring-constraints">Spring constraints</a> in the Spine User Guide.</para>
/// </summary>
public class SpringConstraintData : ConstraintData {
internal ExposedList<BoneData> bones = new ExposedList<BoneData>();
internal float mix, friction, gravity, wind, stiffness, damping;
internal bool rope, stretch;
public SpringConstraintData (string name) : base(name) {
}
/// <summary>The bones that are constrained by this spring constraint.</summary>
public ExposedList<BoneData> Bones { get { return bones; } }
/// <summary>A percentage (0-1) that controls the mix between the constrained and unconstrained poses.</summary>
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; } }
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 438688f6194e6dc40953a23d05d48e1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: