Use annotation for null analysis rather than javadoc.

This commit is contained in:
NathanSweet 2020-02-13 15:32:03 +01:00
parent d386bcc466
commit 53068fc7f1
24 changed files with 237 additions and 179 deletions

View File

@ -2,26 +2,31 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullable=com.esotericsoftware.spine.utils.Null
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@ -29,7 +34,7 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
@ -40,61 +45,70 @@ org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7

View File

@ -40,6 +40,7 @@ import com.badlogic.gdx.utils.ObjectSet;
import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.VertexAttachment; import com.esotericsoftware.spine.attachments.VertexAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Stores a list of timelines to animate a skeleton's pose over time. */ /** Stores a list of timelines to animate a skeleton's pose over time. */
public class Animation { public class Animation {
@ -69,7 +70,7 @@ public class Animation {
timelineIds.addAll(timelines.get(i).getPropertyIds()); timelineIds.addAll(timelines.get(i).getPropertyIds());
} }
/** Returns true if this animation contains a timeline with any of the specified property IDs. **/ /** Returns true if this animation contains a timeline with any of the specified property IDs. */
public boolean hasTimeline (String[] propertyIds) { public boolean hasTimeline (String[] propertyIds) {
for (String id : propertyIds) for (String id : propertyIds)
if (timelineIds.contains(id)) return true; if (timelineIds.contains(id)) return true;
@ -106,7 +107,7 @@ public class Animation {
* @param blend Controls how mixing is applied when <code>alpha</code> < 1. * @param blend Controls how mixing is applied when <code>alpha</code> < 1.
* @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, * @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions,
* such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */ * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */
public void apply (Skeleton skeleton, float lastTime, float time, boolean loop, Array<Event> events, float alpha, public void apply (Skeleton skeleton, float lastTime, float time, boolean loop, @Null Array<Event> events, float alpha,
MixBlend blend, MixDirection direction) { MixBlend blend, MixDirection direction) {
if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
@ -249,8 +250,8 @@ public class Animation {
* @param blend Controls how mixing is applied when <code>alpha</code> < 1. * @param blend Controls how mixing is applied when <code>alpha</code> < 1.
* @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions, * @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions,
* such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */ * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */
abstract public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, abstract public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha,
MixDirection direction); MixBlend blend, MixDirection direction);
} }
/** An interface for timelines which change the property of a bone. */ /** An interface for timelines which change the property of a bone. */
@ -454,7 +455,7 @@ public class Animation {
return boneIndex; return boneIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Bone bone = skeleton.bones.get(boneIndex); Bone bone = skeleton.bones.get(boneIndex);
@ -501,7 +502,7 @@ public class Animation {
return boneIndex; return boneIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Bone bone = skeleton.bones.get(boneIndex); Bone bone = skeleton.bones.get(boneIndex);
@ -573,7 +574,7 @@ public class Animation {
return boneIndex; return boneIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Bone bone = skeleton.bones.get(boneIndex); Bone bone = skeleton.bones.get(boneIndex);
@ -686,7 +687,7 @@ public class Animation {
return boneIndex; return boneIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Bone bone = skeleton.bones.get(boneIndex); Bone bone = skeleton.bones.get(boneIndex);
@ -776,7 +777,7 @@ public class Animation {
frames[frame + A] = a; frames[frame + A] = a;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Slot slot = skeleton.slots.get(slotIndex); Slot slot = skeleton.slots.get(slotIndex);
@ -873,7 +874,7 @@ public class Animation {
frames[frame + B2] = b2; frames[frame + B2] = b2;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Slot slot = skeleton.slots.get(slotIndex); Slot slot = skeleton.slots.get(slotIndex);
@ -978,7 +979,7 @@ public class Animation {
attachmentNames[frame] = attachmentName; attachmentNames[frame] = attachmentName;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Slot slot = skeleton.slots.get(slotIndex); Slot slot = skeleton.slots.get(slotIndex);
@ -1094,7 +1095,7 @@ public class Animation {
return y + (1 - y) * (time - x) / (frames[frame + getFrameEntries()] - x); return y + (1 - y) * (time - x) / (frames[frame + getFrameEntries()] - x);
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Slot slot = skeleton.slots.get(slotIndex); Slot slot = skeleton.slots.get(slotIndex);
@ -1301,8 +1302,8 @@ public class Animation {
} }
/** Fires events for frames > <code>lastTime</code> and <= <code>time</code>. */ /** Fires events for frames > <code>lastTime</code> and <= <code>time</code>. */
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> firedEvents, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> firedEvents, float alpha,
MixDirection direction) { MixBlend blend, MixDirection direction) {
if (firedEvents == null) return; if (firedEvents == null) return;
@ -1353,12 +1354,12 @@ public class Animation {
* @param time The frame time in seconds. * @param time The frame time in seconds.
* @param drawOrder For each slot in {@link Skeleton#slots}, the index of the slot in the new draw order. May be null to use * @param drawOrder For each slot in {@link Skeleton#slots}, the index of the slot in the new draw order. May be null to use
* setup pose draw order. */ * setup pose draw order. */
public void setFrame (int frame, float time, int[] drawOrder) { public void setFrame (int frame, float time, @Null int[] drawOrder) {
frames[frame] = time; frames[frame] = time;
drawOrders[frame] = drawOrder; drawOrders[frame] = drawOrder;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
Array<Slot> drawOrder = skeleton.drawOrder; Array<Slot> drawOrder = skeleton.drawOrder;
@ -1421,7 +1422,7 @@ public class Animation {
frames[frame + STRETCH] = stretch ? 1 : 0; frames[frame + STRETCH] = stretch ? 1 : 0;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
IkConstraint constraint = skeleton.ikConstraints.get(ikConstraintIndex); IkConstraint constraint = skeleton.ikConstraints.get(ikConstraintIndex);
@ -1526,7 +1527,7 @@ public class Animation {
frames[frame + SHEAR] = shearMix; frames[frame + SHEAR] = shearMix;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
TransformConstraint constraint = skeleton.transformConstraints.get(transformConstraintIndex); TransformConstraint constraint = skeleton.transformConstraints.get(transformConstraintIndex);
@ -1609,7 +1610,7 @@ public class Animation {
return pathConstraintIndex; return pathConstraintIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex);
@ -1649,7 +1650,7 @@ public class Animation {
return pathConstraintIndex; return pathConstraintIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex);
@ -1690,7 +1691,7 @@ public class Animation {
return pathConstraintIndex; return pathConstraintIndex;
} }
public void apply (Skeleton skeleton, float lastTime, float time, Array<Event> events, float alpha, MixBlend blend, public void apply (Skeleton skeleton, float lastTime, float time, @Null Array<Event> events, float alpha, MixBlend blend,
MixDirection direction) { MixDirection direction) {
PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex);

View File

@ -44,6 +44,7 @@ import com.esotericsoftware.spine.Animation.MixBlend;
import com.esotericsoftware.spine.Animation.MixDirection; import com.esotericsoftware.spine.Animation.MixDirection;
import com.esotericsoftware.spine.Animation.RotateTimeline; import com.esotericsoftware.spine.Animation.RotateTimeline;
import com.esotericsoftware.spine.Animation.Timeline; import com.esotericsoftware.spine.Animation.Timeline;
import com.esotericsoftware.spine.utils.Null;
/** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies /** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies
* multiple animations on top of each other (layering). * multiple animations on top of each other (layering).
@ -502,7 +503,7 @@ public class AnimationState {
/** Sets an animation by name. /** Sets an animation by name.
* <p> * <p>
* {@link #setAnimation(int, Animation, boolean)}. */ * See {@link #setAnimation(int, Animation, boolean)}. */
public TrackEntry setAnimation (int trackIndex, String animationName, boolean loop) { public TrackEntry setAnimation (int trackIndex, String animationName, boolean loop) {
Animation animation = data.skeletonData.findAnimation(animationName); Animation animation = data.skeletonData.findAnimation(animationName);
if (animation == null) throw new IllegalArgumentException("Animation not found: " + animationName); if (animation == null) throw new IllegalArgumentException("Animation not found: " + animationName);
@ -649,8 +650,7 @@ public class AnimationState {
return null; return null;
} }
/** @param last May be null. */ private TrackEntry trackEntry (int trackIndex, Animation animation, boolean loop, @Null TrackEntry last) {
private TrackEntry trackEntry (int trackIndex, Animation animation, boolean loop, TrackEntry last) {
TrackEntry entry = trackEntryPool.obtain(); TrackEntry entry = trackEntryPool.obtain();
entry.trackIndex = trackIndex; entry.trackIndex = trackIndex;
entry.animation = animation; entry.animation = animation;
@ -772,6 +772,7 @@ public class AnimationState {
} }
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */ /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
@Null
public TrackEntry getCurrent (int trackIndex) { public TrackEntry getCurrent (int trackIndex) {
if (trackIndex < 0) throw new IllegalArgumentException("trackIndex must be >= 0."); if (trackIndex < 0) throw new IllegalArgumentException("trackIndex must be >= 0.");
if (trackIndex >= tracks.size) return null; if (trackIndex >= tracks.size) return null;
@ -1009,12 +1010,12 @@ public class AnimationState {
* <p> * <p>
* A track entry returned from {@link AnimationState#setAnimation(int, Animation, boolean)} is already the current animation * A track entry returned from {@link AnimationState#setAnimation(int, Animation, boolean)} is already the current animation
* for the track, so the track entry listener {@link AnimationStateListener#start(TrackEntry)} will not be called. */ * for the track, so the track entry listener {@link AnimationStateListener#start(TrackEntry)} will not be called. */
@Null
public AnimationStateListener getListener () { public AnimationStateListener getListener () {
return listener; return listener;
} }
/** @param listener May be null. */ public void setListener (@Null AnimationStateListener listener) {
public void setListener (AnimationStateListener listener) {
this.listener = listener; this.listener = listener;
} }
@ -1065,6 +1066,7 @@ public class AnimationState {
} }
/** The animation queued to start after this animation, or null. <code>next</code> makes up a linked list. */ /** The animation queued to start after this animation, or null. <code>next</code> makes up a linked list. */
@Null
public TrackEntry getNext () { public TrackEntry getNext () {
return next; return next;
} }
@ -1124,12 +1126,14 @@ public class AnimationState {
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
* mixing is currently occuring. When mixing from multiple animations, <code>mixingFrom</code> makes up a linked list. */ * mixing is currently occuring. When mixing from multiple animations, <code>mixingFrom</code> makes up a linked list. */
@Null
public TrackEntry getMixingFrom () { public TrackEntry getMixingFrom () {
return mixingFrom; return mixingFrom;
} }
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
* currently occuring. When mixing to multiple animations, <code>mixingTo</code> makes up a linked list. */ * currently occuring. When mixing to multiple animations, <code>mixingTo</code> makes up a linked list. */
@Null
public TrackEntry getMixingTo () { public TrackEntry getMixingTo () {
return mixingTo; return mixingTo;
} }

View File

@ -37,6 +37,7 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.BoneData.TransformMode; import com.esotericsoftware.spine.BoneData.TransformMode;
import com.esotericsoftware.spine.utils.Null;
/** Stores a bone's current pose. /** Stores a bone's current pose.
* <p> * <p>
@ -56,8 +57,7 @@ public class Bone implements Updatable {
boolean sorted, active; boolean sorted, active;
/** @param parent May be null. */ public Bone (BoneData data, Skeleton skeleton, @Null Bone parent) {
public Bone (BoneData data, Skeleton skeleton, Bone parent) {
if (data == null) throw new IllegalArgumentException("data cannot be null."); if (data == null) throw new IllegalArgumentException("data cannot be null.");
if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
this.data = data; this.data = data;
@ -66,9 +66,8 @@ public class Bone implements Updatable {
setToSetupPose(); setToSetupPose();
} }
/** Copy constructor. Does not copy the children bones. /** Copy constructor. Does not copy the children bones. */
* @param parent May be null. */ public Bone (Bone bone, Skeleton skeleton, @Null Bone parent) {
public Bone (Bone bone, Skeleton skeleton, Bone parent) {
if (bone == null) throw new IllegalArgumentException("bone cannot be null."); if (bone == null) throw new IllegalArgumentException("bone cannot be null.");
if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null.");
this.skeleton = skeleton; this.skeleton = skeleton;
@ -226,6 +225,7 @@ public class Bone implements Updatable {
} }
/** The parent bone, or null if this is the root bone. */ /** The parent bone, or null if this is the root bone. */
@Null
public Bone getParent () { public Bone getParent () {
return parent; return parent;
} }

View File

@ -31,6 +31,8 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.esotericsoftware.spine.utils.Null;
/** Stores the setup pose for a {@link Bone}. */ /** Stores the setup pose for a {@link Bone}. */
public class BoneData { public class BoneData {
final int index; final int index;
@ -44,8 +46,7 @@ public class BoneData {
// Nonessential. // Nonessential.
final Color color = new Color(0.61f, 0.61f, 0.61f, 1); // 9b9b9bff final Color color = new Color(0.61f, 0.61f, 0.61f, 1); // 9b9b9bff
/** @param parent May be null. */ public BoneData (int index, String name, @Null BoneData parent) {
public BoneData (int index, String name, BoneData parent) {
if (index < 0) throw new IllegalArgumentException("index must be >= 0."); if (index < 0) throw new IllegalArgumentException("index must be >= 0.");
if (name == null) throw new IllegalArgumentException("name cannot be null."); if (name == null) throw new IllegalArgumentException("name cannot be null.");
this.index = index; this.index = index;
@ -53,9 +54,8 @@ public class BoneData {
this.parent = parent; this.parent = parent;
} }
/** Copy constructor. /** Copy constructor. */
* @param parent May be null. */ public BoneData (BoneData bone, @Null BoneData parent) {
public BoneData (BoneData bone, BoneData parent) {
if (bone == null) throw new IllegalArgumentException("bone cannot be null."); if (bone == null) throw new IllegalArgumentException("bone cannot be null.");
index = bone.index; index = bone.index;
name = bone.name; name = bone.name;
@ -80,7 +80,7 @@ public class BoneData {
return name; return name;
} }
/** @return May be null. */ @Null
public BoneData getParent () { public BoneData getParent () {
return parent; return parent;
} }
@ -179,7 +179,8 @@ public class BoneData {
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#getSkin()} contains this /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#getSkin()} contains this
* bone. * bone.
* @see Skin#getBones() */ * <p>
* See {@link Skin#getBones()}. */
public boolean getSkinRequired () { public boolean getSkinRequired () {
return skinRequired; return skinRequired;
} }

View File

@ -57,7 +57,8 @@ abstract public class ConstraintData {
/** When true, {@link Skeleton#updateWorldTransform()} only updates this constraint if the {@link Skeleton#getSkin()} contains /** When true, {@link Skeleton#updateWorldTransform()} only updates this constraint if the {@link Skeleton#getSkin()} contains
* this constraint. * this constraint.
* @see Skin#getConstraints() */ * <p>
* See {@link Skin#getConstraints()}. */
public boolean getSkinRequired () { public boolean getSkinRequired () {
return skinRequired; return skinRequired;
} }

View File

@ -41,6 +41,7 @@ import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.MeshAttachment; import com.esotericsoftware.spine.attachments.MeshAttachment;
import com.esotericsoftware.spine.attachments.PathAttachment; import com.esotericsoftware.spine.attachments.PathAttachment;
import com.esotericsoftware.spine.attachments.RegionAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Stores the current pose for a skeleton. /** Stores the current pose for a skeleton.
* <p> * <p>
@ -472,15 +473,14 @@ public class Skeleton {
return updateCache; return updateCache;
} }
/** Returns the root bone, or null. */ /** Returns the root bone, or null if the skeleton has no bones. */
public Bone getRootBone () { public Bone getRootBone () {
if (bones.size == 0) return null; return bones.size == 0 ? null : bones.first();
return bones.first();
} }
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* repeatedly. * repeatedly. */
* @return May be null. */ @Null
public Bone findBone (String boneName) { public Bone findBone (String boneName) {
if (boneName == null) throw new IllegalArgumentException("boneName cannot be null."); if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
Array<Bone> bones = this.bones; Array<Bone> bones = this.bones;
@ -497,8 +497,8 @@ public class Skeleton {
} }
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* repeatedly. * repeatedly. */
* @return May be null. */ @Null
public Slot findSlot (String slotName) { public Slot findSlot (String slotName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Array<Slot> slots = this.slots; Array<Slot> slots = this.slots;
@ -519,8 +519,8 @@ public class Skeleton {
this.drawOrder = drawOrder; this.drawOrder = drawOrder;
} }
/** The skeleton's current skin. /** The skeleton's current skin. */
* @return May be null. */ @Null
public Skin getSkin () { public Skin getSkin () {
return skin; return skin;
} }
@ -542,9 +542,9 @@ public class Skeleton {
* <p> * <p>
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling * After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply(Skeleton)} is called before the next time the * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply(Skeleton)} is called before the next time the
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin. * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new
* @param newSkin May be null. */ * skin. */
public void setSkin (Skin newSkin) { public void setSkin (@Null Skin newSkin) {
if (newSkin == skin) return; if (newSkin == skin) return;
if (newSkin != null) { if (newSkin != null) {
if (skin != null) if (skin != null)
@ -568,8 +568,8 @@ public class Skeleton {
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
* name. * name.
* <p> * <p>
* See {@link #getAttachment(int, String)}. * See {@link #getAttachment(int, String)}. */
* @return May be null. */ @Null
public Attachment getAttachment (String slotName, String attachmentName) { public Attachment getAttachment (String slotName, String attachmentName) {
SlotData slot = data.findSlot(slotName); SlotData slot = data.findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
@ -579,8 +579,8 @@ public class Skeleton {
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked. * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
* <p> * <p>
* See <a href="http://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. * See <a href="http://esotericsoftware.com/spine-runtime-skins">Runtime skins</a> in the Spine Runtimes Guide. */
* @return May be null. */ @Null
public Attachment getAttachment (int slotIndex, String attachmentName) { public Attachment getAttachment (int slotIndex, String attachmentName) {
if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null."); if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null.");
if (skin != null) { if (skin != null) {
@ -594,7 +594,7 @@ public class Skeleton {
/** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with /** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with
* {@link #getAttachment(int, String)}, then setting the slot's {@link Slot#attachment}. * {@link #getAttachment(int, String)}, then setting the slot's {@link Slot#attachment}.
* @param attachmentName May be null to clear the slot's attachment. */ * @param attachmentName May be null to clear the slot's attachment. */
public void setAttachment (String slotName, String attachmentName) { public void setAttachment (String slotName, @Null String attachmentName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Slot slot = findSlot(slotName); Slot slot = findSlot(slotName);
if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName);
@ -613,8 +613,8 @@ public class Skeleton {
} }
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly. * than to call it repeatedly. */
* @return May be null. */ @Null
public IkConstraint findIkConstraint (String constraintName) { public IkConstraint findIkConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<IkConstraint> ikConstraints = this.ikConstraints; Array<IkConstraint> ikConstraints = this.ikConstraints;
@ -631,8 +631,8 @@ public class Skeleton {
} }
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it repeatedly. * this method than to call it repeatedly. */
* @return May be null. */ @Null
public TransformConstraint findTransformConstraint (String constraintName) { public TransformConstraint findTransformConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<TransformConstraint> transformConstraints = this.transformConstraints; Array<TransformConstraint> transformConstraints = this.transformConstraints;
@ -649,8 +649,8 @@ public class Skeleton {
} }
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it repeatedly. * than to call it repeatedly. */
* @return May be null. */ @Null
public PathConstraint findPathConstraint (String constraintName) { public PathConstraint findPathConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<PathConstraint> pathConstraints = this.pathConstraints; Array<PathConstraint> pathConstraints = this.pathConstraints;

View File

@ -76,6 +76,7 @@ import com.esotericsoftware.spine.attachments.PathAttachment;
import com.esotericsoftware.spine.attachments.PointAttachment; import com.esotericsoftware.spine.attachments.PointAttachment;
import com.esotericsoftware.spine.attachments.RegionAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment;
import com.esotericsoftware.spine.attachments.VertexAttachment; import com.esotericsoftware.spine.attachments.VertexAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Loads skeleton data in the Spine binary format. /** Loads skeleton data in the Spine binary format.
* <p> * <p>
@ -138,7 +139,7 @@ public class SkeletonBinary {
try { try {
skeletonData.hash = input.readString(); skeletonData.hash = input.readString();
if (skeletonData.hash.isEmpty()) skeletonData.hash = null; if (skeletonData.hash.isEmpty()) skeletonData.hash = null;
skeletonData.version = input.readString(); skeletonData.version = input.readString();
if (skeletonData.version.isEmpty()) skeletonData.version = null; if (skeletonData.version.isEmpty()) skeletonData.version = null;
if ("3.8.75".equals(skeletonData.version)) if ("3.8.75".equals(skeletonData.version))
throw new RuntimeException("Unsupported skeleton data, please export with a newer version of Spine."); throw new RuntimeException("Unsupported skeleton data, please export with a newer version of Spine.");
@ -330,7 +331,7 @@ public class SkeletonBinary {
return skeletonData; return skeletonData;
} }
/** @return May be null. */ @Null
private Skin readSkin (SkeletonInput input, SkeletonData skeletonData, boolean defaultSkin, boolean nonessential) private Skin readSkin (SkeletonInput input, SkeletonData skeletonData, boolean defaultSkin, boolean nonessential)
throws IOException { throws IOException {
@ -773,7 +774,9 @@ public class SkeletonBinary {
for (int ii = 0, nn = input.readInt(true); ii < nn; ii++) { for (int ii = 0, nn = input.readInt(true); ii < nn; ii++) {
int slotIndex = input.readInt(true); int slotIndex = input.readInt(true);
for (int iii = 0, nnn = input.readInt(true); iii < nnn; iii++) { for (int iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
VertexAttachment attachment = (VertexAttachment)skin.getAttachment(slotIndex, input.readStringRef()); String attachmentName = input.readStringRef();
VertexAttachment attachment = (VertexAttachment)skin.getAttachment(slotIndex, attachmentName);
if (attachment == null) throw new SerializationException("Vertex attachment not found: " + attachmentName);
boolean weighted = attachment.getBones() != null; boolean weighted = attachment.getBones() != null;
float[] vertices = attachment.getVertices(); float[] vertices = attachment.getVertices();
int deformLength = weighted ? (vertices.length / 3) << 1 : vertices.length; int deformLength = weighted ? (vertices.length / 3) << 1 : vertices.length;
@ -937,7 +940,7 @@ public class SkeletonBinary {
super(file.read(512)); super(file.read(512));
} }
/** @return May be null. */ @Null
public String readStringRef () throws IOException { public String readStringRef () throws IOException {
int index = readInt(true); int index = readInt(true);
return index == 0 ? null : strings.get(index - 1); return index == 0 ? null : strings.get(index - 1);

View File

@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.FloatArray;
import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.Pool;
import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.BoundingBoxAttachment; import com.esotericsoftware.spine.attachments.BoundingBoxAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are /** Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are
* provided along with convenience methods for doing hit detection. */ * provided along with convenience methods for doing hit detection. */
@ -141,6 +142,7 @@ public class SkeletonBounds {
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */ * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
@Null
public BoundingBoxAttachment containsPoint (float x, float y) { public BoundingBoxAttachment containsPoint (float x, float y) {
Array<FloatArray> polygons = this.polygons; Array<FloatArray> polygons = this.polygons;
for (int i = 0, n = polygons.size; i < n; i++) for (int i = 0, n = polygons.size; i < n; i++)
@ -171,6 +173,7 @@ public class SkeletonBounds {
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it /** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns * is usually more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns
* true. */ * true. */
@Null
public BoundingBoxAttachment intersectsSegment (float x1, float y1, float x2, float y2) { public BoundingBoxAttachment intersectsSegment (float x1, float y1, float x2, float y2) {
Array<FloatArray> polygons = this.polygons; Array<FloatArray> polygons = this.polygons;
for (int i = 0, n = polygons.size; i < n; i++) for (int i = 0, n = polygons.size; i < n; i++)
@ -244,6 +247,7 @@ public class SkeletonBounds {
} }
/** Returns the polygon for the specified bounding box, or null. */ /** Returns the polygon for the specified bounding box, or null. */
@Null
public FloatArray getPolygon (BoundingBoxAttachment boundingBox) { public FloatArray getPolygon (BoundingBoxAttachment boundingBox) {
if (boundingBox == null) throw new IllegalArgumentException("boundingBox cannot be null."); if (boundingBox == null) throw new IllegalArgumentException("boundingBox cannot be null.");
int index = boundingBoxes.indexOf(boundingBox, true); int index = boundingBoxes.indexOf(boundingBox, true);

View File

@ -31,6 +31,8 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.spine.utils.Null;
/** Stores the setup pose and all of the stateless data for a skeleton. /** Stores the setup pose and all of the stateless data for a skeleton.
* <p> * <p>
* See <a href="http://esotericsoftware.com/spine-runtime-architecture#Data-objects">Data objects</a> in the Spine Runtimes * See <a href="http://esotericsoftware.com/spine-runtime-architecture#Data-objects">Data objects</a> in the Spine Runtimes
@ -65,8 +67,8 @@ public class SkeletonData {
} }
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
* multiple times. * multiple times. */
* @return May be null. */ @Null
public BoneData findBone (String boneName) { public BoneData findBone (String boneName) {
if (boneName == null) throw new IllegalArgumentException("boneName cannot be null."); if (boneName == null) throw new IllegalArgumentException("boneName cannot be null.");
Array<BoneData> bones = this.bones; Array<BoneData> bones = this.bones;
@ -85,8 +87,8 @@ public class SkeletonData {
} }
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
* multiple times. * multiple times. */
* @return May be null. */ @Null
public SlotData findSlot (String slotName) { public SlotData findSlot (String slotName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Array<SlotData> slots = this.slots; Array<SlotData> slots = this.slots;
@ -101,20 +103,19 @@ public class SkeletonData {
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine. /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
* <p> * <p>
* See {@link Skeleton#getAttachment(int, String)}. * See {@link Skeleton#getAttachment(int, String)}. */
* @return May be null. */ @Null
public Skin getDefaultSkin () { public Skin getDefaultSkin () {
return defaultSkin; return defaultSkin;
} }
/** @param defaultSkin May be null. */ public void setDefaultSkin (@Null Skin defaultSkin) {
public void setDefaultSkin (Skin defaultSkin) {
this.defaultSkin = defaultSkin; this.defaultSkin = defaultSkin;
} }
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it /** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
* multiple times. * multiple times. */
* @return May be null. */ @Null
public Skin findSkin (String skinName) { public Skin findSkin (String skinName) {
if (skinName == null) throw new IllegalArgumentException("skinName cannot be null."); if (skinName == null) throw new IllegalArgumentException("skinName cannot be null.");
for (Skin skin : skins) for (Skin skin : skins)
@ -130,8 +131,8 @@ public class SkeletonData {
// --- Events. // --- Events.
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it /** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
* multiple times. * multiple times. */
* @return May be null. */ @Null
public EventData findEvent (String eventDataName) { public EventData findEvent (String eventDataName) {
if (eventDataName == null) throw new IllegalArgumentException("eventDataName cannot be null."); if (eventDataName == null) throw new IllegalArgumentException("eventDataName cannot be null.");
for (EventData eventData : events) for (EventData eventData : events)
@ -152,8 +153,8 @@ public class SkeletonData {
} }
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to /** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
* call it multiple times. * call it multiple times. */
* @return May be null. */ @Null
public Animation findAnimation (String animationName) { public Animation findAnimation (String animationName) {
if (animationName == null) throw new IllegalArgumentException("animationName cannot be null."); if (animationName == null) throw new IllegalArgumentException("animationName cannot be null.");
Array<Animation> animations = this.animations; Array<Animation> animations = this.animations;
@ -172,8 +173,8 @@ public class SkeletonData {
} }
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times. * than to call it multiple times. */
* @return May be null. */ @Null
public IkConstraintData findIkConstraint (String constraintName) { public IkConstraintData findIkConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<IkConstraintData> ikConstraints = this.ikConstraints; Array<IkConstraintData> ikConstraints = this.ikConstraints;
@ -192,8 +193,8 @@ public class SkeletonData {
} }
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
* this method than to call it multiple times. * this method than to call it multiple times. */
* @return May be null. */ @Null
public TransformConstraintData findTransformConstraint (String constraintName) { public TransformConstraintData findTransformConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<TransformConstraintData> transformConstraints = this.transformConstraints; Array<TransformConstraintData> transformConstraints = this.transformConstraints;
@ -212,8 +213,8 @@ public class SkeletonData {
} }
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
* than to call it multiple times. * than to call it multiple times. */
* @return May be null. */ @Null
public PathConstraintData findPathConstraint (String constraintName) { public PathConstraintData findPathConstraint (String constraintName) {
if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null.");
Array<PathConstraintData> pathConstraints = this.pathConstraints; Array<PathConstraintData> pathConstraints = this.pathConstraints;
@ -226,14 +227,13 @@ public class SkeletonData {
// --- // ---
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. /** The skeleton's name, which by default is the name of the skeleton data file, if possible. */
* @return May be null. */ @Null
public String getName () { public String getName () {
return name; return name;
} }
/** @param name May be null. */ public void setName (@Null String name) {
public void setName (String name) {
this.name = name; this.name = name;
} }
@ -274,45 +274,42 @@ public class SkeletonData {
} }
/** The Spine version used to export the skeleton data, or null. */ /** The Spine version used to export the skeleton data, or null. */
@Null
public String getVersion () { public String getVersion () {
return version; return version;
} }
/** @param version May be null. */ public void setVersion (@Null String version) {
public void setVersion (String version) {
this.version = version; this.version = version;
} }
/** The skeleton data hash. This value will change if any of the skeleton data has changed. /** The skeleton data hash. This value will change if any of the skeleton data has changed. */
* @return May be null. */ @Null
public String getHash () { public String getHash () {
return hash; return hash;
} }
/** @param hash May be null. */ public void setHash (@Null String hash) {
public void setHash (String hash) {
this.hash = hash; this.hash = hash;
} }
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. */
* @return May be null. */ @Null
public String getImagesPath () { public String getImagesPath () {
return imagesPath; return imagesPath;
} }
/** @param imagesPath May be null. */ public void setImagesPath (@Null String imagesPath) {
public void setImagesPath (String imagesPath) {
this.imagesPath = imagesPath; this.imagesPath = imagesPath;
} }
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. */
* @return May be null. */ @Null
public String getAudioPath () { public String getAudioPath () {
return audioPath; return audioPath;
} }
/** @param audioPath May be null. */ public void setAudioPath (@Null String audioPath) {
public void setAudioPath (String audioPath) {
this.audioPath = audioPath; this.audioPath = audioPath;
} }

View File

@ -44,6 +44,7 @@ import com.esotericsoftware.spine.attachments.ClippingAttachment;
import com.esotericsoftware.spine.attachments.MeshAttachment; import com.esotericsoftware.spine.attachments.MeshAttachment;
import com.esotericsoftware.spine.attachments.RegionAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment;
import com.esotericsoftware.spine.attachments.SkeletonAttachment; import com.esotericsoftware.spine.attachments.SkeletonAttachment;
import com.esotericsoftware.spine.utils.Null;
import com.esotericsoftware.spine.utils.SkeletonClipping; import com.esotericsoftware.spine.utils.SkeletonClipping;
import com.esotericsoftware.spine.utils.TwoColorPolygonBatch; import com.esotericsoftware.spine.utils.TwoColorPolygonBatch;
@ -450,13 +451,12 @@ public class SkeletonRenderer {
this.premultipliedAlpha = premultipliedAlpha; this.premultipliedAlpha = premultipliedAlpha;
} }
/** @return May be null. */ @Null
public VertexEffect getVertexEffect () { public VertexEffect getVertexEffect () {
return vertexEffect; return vertexEffect;
} }
/** @param vertexEffect May be null. */ public void setVertexEffect (@Null VertexEffect vertexEffect) {
public void setVertexEffect (VertexEffect vertexEffect) {
this.vertexEffect = vertexEffect; this.vertexEffect = vertexEffect;
} }

View File

@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.OrderedSet;
import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.MeshAttachment; import com.esotericsoftware.spine.attachments.MeshAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Stores attachments by slot index and attachment name. /** Stores attachments by slot index and attachment name.
* <p> * <p>
@ -93,6 +94,7 @@ public class Skin {
} }
/** Returns the attachment for the specified slot index and name, or null. */ /** Returns the attachment for the specified slot index and name, or null. */
@Null
public Attachment getAttachment (int slotIndex, String name) { public Attachment getAttachment (int slotIndex, String name) {
lookup.set(slotIndex, name); lookup.set(slotIndex, name);
SkinEntry entry = attachments.get(lookup); SkinEntry entry = attachments.get(lookup);
@ -154,15 +156,14 @@ public class Skin {
} }
} }
/** Stores an entry in the skin consisting of the slot index, name, and attachment **/ /** Stores an entry in the skin consisting of the slot index and the attachment name. */
static public class SkinEntry { static public class SkinEntry {
int slotIndex; int slotIndex;
String name; String name;
Attachment attachment; Attachment attachment;
private int hashCode; private int hashCode;
/** @param attachment May be null. */ SkinEntry (int slotIndex, String name, @Null Attachment attachment) {
SkinEntry (int slotIndex, String name, Attachment attachment) {
set(slotIndex, name); set(slotIndex, name);
this.attachment = attachment; this.attachment = attachment;
} }

View File

@ -35,6 +35,7 @@ import com.badlogic.gdx.utils.FloatArray;
import com.esotericsoftware.spine.Animation.DeformTimeline; import com.esotericsoftware.spine.Animation.DeformTimeline;
import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.VertexAttachment; import com.esotericsoftware.spine.attachments.VertexAttachment;
import com.esotericsoftware.spine.utils.Null;
/** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store /** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store
* state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared * state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared
@ -92,18 +93,19 @@ public class Slot {
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */ * color's alpha is not used. */
@Null
public Color getDarkColor () { public Color getDarkColor () {
return darkColor; return darkColor;
} }
/** The current attachment for the slot, or null if the slot has no attachment. */ /** The current attachment for the slot, or null if the slot has no attachment. */
@Null
public Attachment getAttachment () { public Attachment getAttachment () {
return attachment; return attachment;
} }
/** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}. /** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}. */
* @param attachment May be null. */ public void setAttachment (@Null Attachment attachment) {
public void setAttachment (Attachment attachment) {
if (this.attachment == attachment) return; if (this.attachment == attachment) return;
this.attachment = attachment; this.attachment = attachment;
attachmentTime = bone.skeleton.time; attachmentTime = bone.skeleton.time;

View File

@ -31,6 +31,8 @@ package com.esotericsoftware.spine;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.esotericsoftware.spine.utils.Null;
/** Stores the setup pose for a {@link Slot}. */ /** Stores the setup pose for a {@link Slot}. */
public class SlotData { public class SlotData {
final int index; final int index;
@ -73,21 +75,21 @@ public class SlotData {
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
* color's alpha is not used. */ * color's alpha is not used. */
@Null
public Color getDarkColor () { public Color getDarkColor () {
return darkColor; return darkColor;
} }
/** @param darkColor May be null. */ public void setDarkColor (@Null Color darkColor) {
public void setDarkColor (Color darkColor) {
this.darkColor = darkColor; this.darkColor = darkColor;
} }
/** @param attachmentName May be null. */ public void setAttachmentName (@Null String attachmentName) {
public void setAttachmentName (String attachmentName) {
this.attachmentName = attachmentName; this.attachmentName = attachmentName;
} }
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */ /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
@Null
public String getAttachmentName () { public String getAttachmentName () {
return attachmentName; return attachmentName;
} }

View File

@ -47,6 +47,6 @@ abstract public class Attachment {
return name; return name;
} }
/** Returns a copy of the attachment. **/ /** Returns a copy of the attachment. */
abstract public Attachment copy (); abstract public Attachment copy ();
} }

View File

@ -30,6 +30,7 @@
package com.esotericsoftware.spine.attachments; package com.esotericsoftware.spine.attachments;
import com.esotericsoftware.spine.Skin; import com.esotericsoftware.spine.Skin;
import com.esotericsoftware.spine.utils.Null;
/** The interface which can be implemented to customize creating and populating attachments. /** The interface which can be implemented to customize creating and populating attachments.
* <p> * <p>
@ -37,20 +38,26 @@ import com.esotericsoftware.spine.Skin;
* Runtimes Guide. */ * Runtimes Guide. */
public interface AttachmentLoader { public interface AttachmentLoader {
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public RegionAttachment newRegionAttachment (Skin skin, String name, String path); public RegionAttachment newRegionAttachment (Skin skin, String name, String path);
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public MeshAttachment newMeshAttachment (Skin skin, String name, String path); public MeshAttachment newMeshAttachment (Skin skin, String name, String path);
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public BoundingBoxAttachment newBoundingBoxAttachment (Skin skin, String name); public BoundingBoxAttachment newBoundingBoxAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public ClippingAttachment newClippingAttachment (Skin skin, String name); public ClippingAttachment newClippingAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public PathAttachment newPathAttachment (Skin skin, String name); public PathAttachment newPathAttachment (Skin skin, String name);
/** @return May be null to not load the attachment. */ /** @return May be null to not load the attachment. */
@Null
public PointAttachment newPointAttachment (Skin skin, String name); public PointAttachment newPointAttachment (Skin skin, String name);
} }

View File

@ -33,6 +33,9 @@ import static com.esotericsoftware.spine.utils.SpineUtils.*;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion;
import com.esotericsoftware.spine.utils.Null;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
/** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not /** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not
@ -218,8 +221,7 @@ public class MeshAttachment extends VertexAttachment {
return parentMesh; return parentMesh;
} }
/** @param parentMesh May be null. */ public void setParentMesh (@Null MeshAttachment parentMesh) {
public void setParentMesh (MeshAttachment parentMesh) {
this.parentMesh = parentMesh; this.parentMesh = parentMesh;
if (parentMesh != null) { if (parentMesh != null) {
bones = parentMesh.bones; bones = parentMesh.bones;
@ -261,7 +263,7 @@ public class MeshAttachment extends VertexAttachment {
return copy; return copy;
} }
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/ /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. */
public MeshAttachment newLinkedMesh () { public MeshAttachment newLinkedMesh () {
MeshAttachment mesh = new MeshAttachment(name); MeshAttachment mesh = new MeshAttachment(name);
mesh.region = region; mesh.region = region;

View File

@ -30,6 +30,7 @@
package com.esotericsoftware.spine.attachments; package com.esotericsoftware.spine.attachments;
import com.esotericsoftware.spine.Skeleton; import com.esotericsoftware.spine.Skeleton;
import com.esotericsoftware.spine.utils.Null;
/** Attachment that displays a skeleton. */ /** Attachment that displays a skeleton. */
public class SkeletonAttachment extends Attachment { public class SkeletonAttachment extends Attachment {
@ -44,8 +45,7 @@ public class SkeletonAttachment extends Attachment {
return skeleton; return skeleton;
} }
/** @param skeleton May be null. */ public void setSkeleton (@Null Skeleton skeleton) {
public void setSkeleton (Skeleton skeleton) {
this.skeleton = skeleton; this.skeleton = skeleton;
} }

View File

@ -36,6 +36,7 @@ import com.badlogic.gdx.utils.FloatArray;
import com.esotericsoftware.spine.Bone; import com.esotericsoftware.spine.Bone;
import com.esotericsoftware.spine.Skeleton; import com.esotericsoftware.spine.Skeleton;
import com.esotericsoftware.spine.Slot; import com.esotericsoftware.spine.Slot;
import com.esotericsoftware.spine.utils.Null;
/** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's /** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's
* {@link Slot#getDeform()}. */ * {@link Slot#getDeform()}. */
@ -122,24 +123,26 @@ abstract public class VertexAttachment extends Attachment {
/** Deform keys for the deform attachment are also applied to this attachment. /** Deform keys for the deform attachment are also applied to this attachment.
* @return May be null if no deform keys should be applied. */ * @return May be null if no deform keys should be applied. */
@Null
public VertexAttachment getDeformAttachment () { public VertexAttachment getDeformAttachment () {
return deformAttachment; return deformAttachment;
} }
/** @param deformAttachment May be null if no deform keys should be applied. */ /** @param deformAttachment May be null if no deform keys should be applied. */
public void setDeformAttachment (VertexAttachment deformAttachment) { public void setDeformAttachment (@Null VertexAttachment deformAttachment) {
this.deformAttachment = deformAttachment; this.deformAttachment = deformAttachment;
} }
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#getBones()}. Will be null * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#getBones()}. Will be null
* if this attachment has no weights. */ * if this attachment has no weights. */
@Null
public int[] getBones () { public int[] getBones () {
return bones; return bones;
} }
/** @param bones May be null if this attachment has no weights. */ /** @param bones May be null if this attachment has no weights. */
public void setBones (int[] bones) { public void setBones (@Null int[] bones) {
this.bones = bones; this.bones = bones;
} }
@ -169,7 +172,7 @@ abstract public class VertexAttachment extends Attachment {
return id; return id;
} }
/** Does not copy id (generated) or name (set on construction). **/ /** Does not copy id (generated) or name (set on construction). */
void copyTo (VertexAttachment attachment) { void copyTo (VertexAttachment attachment) {
if (bones != null) { if (bones != null) {
attachment.bones = new int[bones.length]; attachment.bones = new int[bones.length];

View File

@ -0,0 +1,5 @@
package com.esotericsoftware.spine.utils;
public @interface Null {
}

View File

@ -67,8 +67,7 @@ public class SkeletonDataLoader extends AsynchronousAssetLoader<SkeletonData, Sk
super(resolver); super(resolver);
} }
/** @param parameter May be null. */ public void loadAsync (AssetManager manager, String fileName, FileHandle file, @Null SkeletonDataParameter parameter) {
public void loadAsync (AssetManager manager, String fileName, FileHandle file, SkeletonDataParameter parameter) {
float scale = 1; float scale = 1;
AttachmentLoader attachmentLoader = null; AttachmentLoader attachmentLoader = null;
if (parameter != null) { if (parameter != null) {
@ -92,15 +91,13 @@ public class SkeletonDataLoader extends AsynchronousAssetLoader<SkeletonData, Sk
} }
} }
/** @param parameter May be null. */ public SkeletonData loadSync (AssetManager manager, String fileName, FileHandle file, @Null SkeletonDataParameter parameter) {
public SkeletonData loadSync (AssetManager manager, String fileName, FileHandle file, SkeletonDataParameter parameter) {
SkeletonData skeletonData = this.skeletonData; SkeletonData skeletonData = this.skeletonData;
this.skeletonData = null; this.skeletonData = null;
return skeletonData; return skeletonData;
} }
/** @param parameter May be null. */ public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, @Null SkeletonDataParameter parameter) {
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, SkeletonDataParameter parameter) {
if (parameter == null) return null; if (parameter == null) return null;
if (parameter.attachmentLoader != null) return null; if (parameter.attachmentLoader != null) return null;
Array<AssetDescriptor> dependencies = new Array(); Array<AssetDescriptor> dependencies = new Array();

View File

@ -83,7 +83,7 @@ public class TwoColorPolygonBatch implements PolygonBatch {
private float lightPacked = Color.WHITE.toFloatBits(); private float lightPacked = Color.WHITE.toFloatBits();
private float darkPacked = Color.BLACK.toFloatBits(); private float darkPacked = Color.BLACK.toFloatBits();
/** Number of rendering calls, ever. Will not be reset unless set manually. **/ /** Number of rendering calls, ever. Will not be reset unless set manually. */
public int totalRenderCalls = 0; public int totalRenderCalls = 0;
public TwoColorPolygonBatch () { public TwoColorPolygonBatch () {

View File

@ -2,26 +2,31 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullable=com.esotericsoftware.spine.utils.Null
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=warning org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
@ -29,71 +34,81 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7

View File

@ -226,7 +226,6 @@ public class SkeletonViewer extends ApplicationAdapter {
state = new AnimationState(new AnimationStateData(skeletonData)); state = new AnimationState(new AnimationStateData(skeletonData));
state.addListener(new AnimationStateAdapter() { state.addListener(new AnimationStateAdapter() {
public void event (TrackEntry entry, Event event) { public void event (TrackEntry entry, Event event) {
ui.toast(event.getData().getName()); ui.toast(event.getData().getName());
} }
@ -243,7 +242,6 @@ public class SkeletonViewer extends ApplicationAdapter {
ui.window.getTitleLabel().setText(skeletonFile.name()); ui.window.getTitleLabel().setText(skeletonFile.name());
{ {
Array<String> items = new Array(); Array<String> items = new Array();
for (Skin skin : skeletonData.getSkins()) for (Skin skin : skeletonData.getSkins())
items.add(skin.getName()); items.add(skin.getName());
@ -719,6 +717,7 @@ public class SkeletonViewer extends ApplicationAdapter {
}); });
slotsSetupPoseButton.addListener(new ChangeListener() { slotsSetupPoseButton.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) { public void changed (ChangeEvent event, Actor actor) {
skeleton.getRootBone().getChildren();
if (skeleton != null) skeleton.setSlotsToSetupPose(); if (skeleton != null) skeleton.setSlotsToSetupPose();
} }
}); });