Javadoc, clean up.

This commit is contained in:
NathanSweet 2019-05-31 18:13:02 +02:00
parent b87ff7337b
commit 47c3704acd
4 changed files with 34 additions and 37 deletions

View File

@ -29,16 +29,14 @@
package com.esotericsoftware.spine;
import static com.esotericsoftware.spine.Animation.MixBlend.add;
import static com.esotericsoftware.spine.Animation.MixBlend.first;
import static com.esotericsoftware.spine.Animation.MixBlend.setup;
import static com.esotericsoftware.spine.Animation.MixDirection.in;
import static com.esotericsoftware.spine.Animation.MixDirection.out;
import static com.esotericsoftware.spine.Animation.MixBlend.*;
import static com.esotericsoftware.spine.Animation.MixDirection.*;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.FloatArray;
import com.esotericsoftware.spine.attachments.Attachment;
import com.esotericsoftware.spine.attachments.VertexAttachment;

View File

@ -587,7 +587,7 @@ public class Skeleton {
/** 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}.
* @param attachmentName May be null to clear the slot. */
* @param attachmentName May be null to clear the slot's attachment. */
public void setAttachment (String slotName, String attachmentName) {
if (slotName == null) throw new IllegalArgumentException("slotName cannot be null.");
Slot slot = findSlot(slotName);

View File

@ -233,46 +233,42 @@ public class MeshAttachment extends VertexAttachment {
}
public Attachment copy () {
if (parentMesh != null) return newLinkedMesh();
MeshAttachment copy = new MeshAttachment(name);
copy.region = region;
copy.path = path;
copy.color.set(color);
copy.deformAttachment = deformAttachment;
if (parentMesh == null) {
copyTo(copy);
copy.regionUVs = new float[regionUVs.length];
System.arraycopy(regionUVs, 0, copy.regionUVs, 0, regionUVs.length);
copy.uvs = new float[uvs.length];
System.arraycopy(uvs, 0, copy.uvs, 0, uvs.length);
copy.triangles = new short[triangles.length];
System.arraycopy(triangles, 0, copy.triangles, 0, triangles.length);
copy.hullLength = hullLength;
copyTo(copy);
copy.regionUVs = new float[regionUVs.length];
System.arraycopy(regionUVs, 0, copy.regionUVs, 0, regionUVs.length);
copy.uvs = new float[uvs.length];
System.arraycopy(uvs, 0, copy.uvs, 0, uvs.length);
copy.triangles = new short[triangles.length];
System.arraycopy(triangles, 0, copy.triangles, 0, triangles.length);
copy.hullLength = hullLength;
// Nonessential.
if (edges != null) {
copy.edges = new short[edges.length];
System.arraycopy(edges, 0, copy.edges, 0, edges.length);
}
copy.width = width;
copy.height = height;
} else {
copy.setParentMesh(parentMesh);
copy.updateUVs();
// Nonessential.
if (edges != null) {
copy.edges = new short[edges.length];
System.arraycopy(edges, 0, copy.edges, 0, edges.length);
}
copy.width = width;
copy.height = height;
return copy;
}
/** returns a mesh linking to this mesh. **/
/** Returns a new mesh with this mesh set as the {@link #parentMesh}. **/
public MeshAttachment newLinkedMesh () {
MeshAttachment linkedMesh = new MeshAttachment(name);
linkedMesh.region = region;
linkedMesh.path = path;
linkedMesh.color.set(color);
linkedMesh.deformAttachment = deformAttachment;
linkedMesh.setParentMesh(parentMesh != null ? parentMesh : this);
linkedMesh.updateUVs();
return linkedMesh;
MeshAttachment mesh = new MeshAttachment(name);
mesh.region = region;
mesh.path = path;
mesh.color.set(color);
mesh.deformAttachment = deformAttachment;
mesh.setParentMesh(parentMesh != null ? parentMesh : this);
mesh.updateUVs();
return mesh;
}
}

View File

@ -30,6 +30,7 @@
package com.esotericsoftware.spine.attachments;
import com.badlogic.gdx.utils.FloatArray;
import com.esotericsoftware.spine.Bone;
import com.esotericsoftware.spine.Skeleton;
import com.esotericsoftware.spine.Slot;
@ -43,11 +44,10 @@ abstract public class VertexAttachment extends Attachment {
int[] bones;
float[] vertices;
int worldVerticesLength;
VertexAttachment deformAttachment;
VertexAttachment deformAttachment = this;
public VertexAttachment (String name) {
super(name);
deformAttachment = this;
}
/** Transforms the attachment's local {@link #getVertices()} to world coordinates. If the slot's {@link Slot#getDeform()} is
@ -118,10 +118,13 @@ abstract public class VertexAttachment extends Attachment {
}
}
/** Deform keys for the deform attachment are also applied to this attachment.
* @return May be null if no deform keys should be applied. */
public VertexAttachment getDeformAttachment () {
return deformAttachment;
}
/** @param deformAttachment May be null if no deform keys should be applied. */
public void setDeformAttachment (VertexAttachment deformAttachment) {
this.deformAttachment = deformAttachment;
}