utkiupe

brain_workbench.png
So I am using a skin placeholder in which I have pictures that are smaller than the bitmap (see the attached example)

on the editor, I can see no problem, while on runtime (actionscript starling) the image is not positionned correctly.
It seems that only the picture itself, without the apha0 area is used, so my elements seem to be positionned on bottom left of this area (of course all the bitmap have the same dimension on each skin, but the elements in this bitmap don't)
I guess it's a bug
any clue ?
У вас нет необходимых прав для просмотра вложений в этом сообщении.
Аватара пользователя
utkiupe
  • Сообщения: 31

Nate

How do you pack your atlas?
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

utkiupe

I use a soft called texture packer (http://www.codeandweb.com/texturepacker)

after checking I realise that the spritesheet itselft cuts the empty zones. However in the xml it gives information that helps the runtime to recreate the correct bitmap, with the frameWidth and frameHeight parameters. Here is, for example, the line for the picture I sent you :
<SubTexture name="brain_workbench" x="250" y="286" width="128" height="94" frameX="-18" frameY="-20" frameWidth="165" frameHeight="140"/>

moreover, we use the same picture in other context than with spine and it is handled correctly.
Аватара пользователя
utkiupe
  • Сообщения: 31

bali33

Hi,

I have fixed the issue, it's not Spine or Starling runtime fault, it's mine. Actually I have wrote my own AttachmentLoader in order to retrieve textures from my main AssetManager instances, that way I can have more than one Atlas for one Spine animation.

This is the newAttachement function code :
public function newAttachment (skin:Skin, type:AttachmentType, name:String) : Attachment {
if (type == AttachmentType.region) {
var regionAttachment:RegionAttachment = new RegionAttachment(name);
var texture:Texture = _assetManager.getTexture(name);
regionAttachment.rendererObject = new SkeletonImage(texture);
regionAttachment.regionOffsetX = 0; //texture.frame.x;
regionAttachment.regionOffsetY = 0; //texture.frame.y;
regionAttachment.regionWidth = texture.width;
regionAttachment.regionHeight = texture.height;
regionAttachment.regionOriginalWidth = texture.width;
regionAttachment.regionOriginalHeight = texture.height;
return regionAttachment;
}

throw new Error("Unknown attachment type: " + type);
}
In order to fix our problem I set regionOffsetX and Y to 0 instead of texture.frame.x and texture.frame.y
bali33
  • Сообщения: 108

Nate

Aye, I fixed up the spine-starling atlas stuff recently. I also implemented an attachment loader for spine-starling that can load a Spine atlas. This is better since a Starling atlas doesn't support rotation, also it means Spine can export your atlas which may be more convenient.
Аватара пользователя
Nate

Nate
  • Сообщения: 9861

utkiupe

well, in our case, the reason why we don't create our spritesheets with spine is that they contain other assets than only the spine animation itself. for example, this asset is in a big spritesheet with many background elements. This is also used out of spine in our game.
Аватара пользователя
utkiupe
  • Сообщения: 31


Вернуться в Bugs