|
@@ -1,11 +1,39 @@
|
|
|
+/******************************************************************************
|
|
|
+ * Spine Runtimes License Agreement
|
|
|
+ * Last updated July 28, 2023. Replaces all prior versions.
|
|
|
+ *
|
|
|
+ * Copyright (c) 2013-2023, 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.
|
|
|
+*****************************************************************************/
|
|
|
+
|
|
|
package spine;
|
|
|
|
|
|
-import spine.attachments.AtlasAttachmentLoader;
|
|
|
-import openfl.utils.Assets;
|
|
|
-import spine.atlas.TextureAtlas;
|
|
|
-import openfl.errors.ArgumentError;
|
|
|
import openfl.Vector;
|
|
|
+import openfl.utils.Assets;
|
|
|
import spine.animation.Animation;
|
|
|
+import spine.atlas.TextureAtlas;
|
|
|
+import spine.attachments.AtlasAttachmentLoader;
|
|
|
|
|
|
class SkeletonData {
|
|
|
/** May be null. */
|
|
@@ -53,7 +81,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findBone(boneName:String):BoneData {
|
|
|
if (boneName == null)
|
|
|
- throw new ArgumentError("boneName cannot be null.");
|
|
|
+ throw new SpineException("boneName cannot be null.");
|
|
|
for (i in 0...bones.length) {
|
|
|
var bone:BoneData = bones[i];
|
|
|
if (bone.name == boneName)
|
|
@@ -65,7 +93,7 @@ class SkeletonData {
|
|
|
/** @return -1 if the bone was not found. */
|
|
|
public function findBoneIndex(boneName:String):Int {
|
|
|
if (boneName == null)
|
|
|
- throw new ArgumentError("boneName cannot be null.");
|
|
|
+ throw new SpineException("boneName cannot be null.");
|
|
|
for (i in 0...bones.length) {
|
|
|
if (bones[i].name == boneName)
|
|
|
return i;
|
|
@@ -78,7 +106,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findSlot(slotName:String):SlotData {
|
|
|
if (slotName == null)
|
|
|
- throw new ArgumentError("slotName cannot be null.");
|
|
|
+ throw new SpineException("slotName cannot be null.");
|
|
|
for (i in 0...slots.length) {
|
|
|
var slot:SlotData = slots[i];
|
|
|
if (slot.name == slotName)
|
|
@@ -92,7 +120,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findSkin(skinName:String):Skin {
|
|
|
if (skinName == null)
|
|
|
- throw new ArgumentError("skinName cannot be null.");
|
|
|
+ throw new SpineException("skinName cannot be null.");
|
|
|
for (skin in skins) {
|
|
|
if (skin.name == skinName)
|
|
|
return skin;
|
|
@@ -105,7 +133,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findEvent(eventName:String):EventData {
|
|
|
if (eventName == null)
|
|
|
- throw new ArgumentError("eventName cannot be null.");
|
|
|
+ throw new SpineException("eventName cannot be null.");
|
|
|
for (eventData in events) {
|
|
|
if (eventData.name == eventName)
|
|
|
return eventData;
|
|
@@ -118,7 +146,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findAnimation(animationName:String):Animation {
|
|
|
if (animationName == null)
|
|
|
- throw new ArgumentError("animationName cannot be null.");
|
|
|
+ throw new SpineException("animationName cannot be null.");
|
|
|
for (animation in animations) {
|
|
|
if (animation.name == animationName)
|
|
|
return animation;
|
|
@@ -131,7 +159,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findIkConstraint(constraintName:String):IkConstraintData {
|
|
|
if (constraintName == null)
|
|
|
- throw new ArgumentError("constraintName cannot be null.");
|
|
|
+ throw new SpineException("constraintName cannot be null.");
|
|
|
for (ikConstraintData in ikConstraints) {
|
|
|
if (ikConstraintData.name == constraintName)
|
|
|
return ikConstraintData;
|
|
@@ -144,7 +172,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findTransformConstraint(constraintName:String):TransformConstraintData {
|
|
|
if (constraintName == null)
|
|
|
- throw new ArgumentError("constraintName cannot be null.");
|
|
|
+ throw new SpineException("constraintName cannot be null.");
|
|
|
for (transformConstraintData in transformConstraints) {
|
|
|
if (transformConstraintData.name == constraintName)
|
|
|
return transformConstraintData;
|
|
@@ -155,7 +183,7 @@ class SkeletonData {
|
|
|
/** @return -1 if the transform constraint was not found. */
|
|
|
public function findTransformConstraintIndex(transformConstraintName:String):Int {
|
|
|
if (transformConstraintName == null)
|
|
|
- throw new ArgumentError("transformConstraintName cannot be null.");
|
|
|
+ throw new SpineException("transformConstraintName cannot be null.");
|
|
|
for (i in 0...transformConstraints.length) {
|
|
|
if (transformConstraints[i].name == transformConstraintName)
|
|
|
return i;
|
|
@@ -168,7 +196,7 @@ class SkeletonData {
|
|
|
/** @return May be null. */
|
|
|
public function findPathConstraint(constraintName:String):PathConstraintData {
|
|
|
if (constraintName == null)
|
|
|
- throw new ArgumentError("constraintName cannot be null.");
|
|
|
+ throw new SpineException("constraintName cannot be null.");
|
|
|
for (i in 0...pathConstraints.length) {
|
|
|
var constraint:PathConstraintData = pathConstraints[i];
|
|
|
if (constraint.name == constraintName)
|
|
@@ -180,7 +208,7 @@ class SkeletonData {
|
|
|
/** @return -1 if the path constraint was not found. */
|
|
|
public function findPathConstraintIndex(pathConstraintName:String):Int {
|
|
|
if (pathConstraintName == null)
|
|
|
- throw new ArgumentError("pathConstraintName cannot be null.");
|
|
|
+ throw new SpineException("pathConstraintName cannot be null.");
|
|
|
for (i in 0...pathConstraints.length) {
|
|
|
if (pathConstraints[i].name == pathConstraintName)
|
|
|
return i;
|