I export a skeleton with spine, but the texture the artist use have large blank border. When I using texture packer to combine all the images into one, I use trim mode, which will compress all the border, and store in texture frame data.
When I load it into the spine actionscript runtime, It show very strange. I put the resource file and screenshot in the attachment.

My test code is just modify the starling example:
[Embed(source = "test.xml", mimeType = "application/octet-stream")]
static public const SpineboyAtlasXml:Class;

[Embed(source = "test.png")]
static public const SpineboyAtlasTexture:Class;

[Embed(source = "tes.json", mimeType = "application/octet-stream")]
static public const SpineboyJson:Class;

// ...

public function Game () {
// ...
skeleton = new SkeletonAnimation(skeletonData);
skeleton.skeleton.skinName = "0002";
skeleton.x = 320;
skeleton.y = 820;
skeleton.setAnimation("walk", true);
skeleton.addAnimation("hit", false, 3);
skeleton.addAnimation("walk", true);

If I using the No trim mode to process the images, and keep the blank border inside the texture, It will be OK. I find the starling AttachmentLoader code:
switch (type) {
case AttachmentType.region:
var regionAttachment:RegionAttachment = new RegionAttachment(name);

var texture:Texture = Cvar.rdFactory.CreateTexture(_prefix + name);
if (texture)
var frame:Rectangle = texture.frame;
texture = Texture.fromTexture(texture); // Discard frame.
regionAttachment.rendererObject = new SkeletonImage(texture);
regionAttachment.regionOffsetX = frame.x;
regionAttachment.regionOffsetY = frame.y;
regionAttachment.regionWidth = frame.width;
regionAttachment.regionHeight = frame.height;
regionAttachment.regionOriginalWidth = texture.width;
regionAttachment.regionOriginalHeight = texture.height;

return regionAttachment;
return null;
case AttachmentType.boundingbox:
return new BoundingBoxAttachment(name);

throw new Error("Unknown attachment type: " + type);
Which store the frame data into the RegionAttachment, and process them in function: RegionAttachment.updateOffset.
I view many other language runtime, the algorithm do the same thing. I want to know it there any bug in this function, or I miss something?
Non hai i permessi necessari per visualizzare i file allegati in questo messaggio.
  • Messaggi: 10


I had to figure out that your atlas needs a JSON loader scale of 0.17. Your skeleton is very complex, with many bones and attachments. It would be better to create a new, simplified skeleton to use for debugging any texture atlas problems.

I've committed some changes that improve things. There are still some errors, eg one foot is in the wrong place, but unless you can provide a simpler skeleton for me to test with I have to assume something is wrong with your skeleton.

Avatar utente

  • Messaggi: 12133

Torna a Bugs