Hi all, I made custom SkeletonSprite(SpriteAnimation) class which can be applyed starling filters. (Since offical SkeletonSprite doesn't work with Starling filters.)
SkeletonAnimationFilterApplicable Class https://github.com/harayoki/SpineTest1/blob/master/src/harayoki/spine/starling/SkeletonAnimationFilterApplicable.as
// simple usage var skeletonAnimation:SkeletonAnimationFilterApplicable = new SkeletonAnimationFilterApplicable(skeletonData); skeletonAnimation.filter = BlurFilter.createDropShadow(); // as you like addChild(skeletonAnimation);
This simple code works fine usually, but understanding what is going on inside may help you in case of any trouble.
Offical SkeletonSprite instance returns 0 sized rectangle for getBounds method. That is why no filters are efective.
Returning correct bounding box size make it possible to apply filter to SkeletonSprite, but calculating bounding box every time with playing animations may cause performance issue, so my custom SpriteAnimation can update the bounds value manually.
There are 2 methods to update bounds.
1) updateBounds(marginX:Number=0, marginY:Number=0):void;
// example skeletonAnimation.updateBounds(20, 20);
This method calculate bounding box of skeleton animation accurately at that time.
Margin values are optional arguments (each default value is 0.) which are sometimes required to draw whole filter pixels. Calling this method after every changing animation is recommended. This method is called automatically at the stage of its instaitiation.
// example skeletonAnimation.setBoundsDirectly(new Rectangle(-160, -160, 320, 320));
If you know the most biggest bounding box size of your animation, this method may be useful.
Also you can use this method to delete bounds value by setting null as boundingBoxRect argument.
Tuto page (in Japanese) here.
Hopes someone here likes this.