mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 17:18:44 +08:00
Per attachment color.
This commit is contained in:
parent
2b241c3628
commit
2e9cb471f7
@ -176,6 +176,15 @@ public class SkeletonJson {
|
||||
regionAttachment.rotation = map["rotation"] || 0;
|
||||
regionAttachment.width = (map["width"] || 32) * scale;
|
||||
regionAttachment.height = (map["height"] || 32) * scale;
|
||||
|
||||
var color:String = map["color"];
|
||||
if (color) {
|
||||
regionAttachment.r = toColor(color, 0);
|
||||
regionAttachment.g = toColor(color, 1);
|
||||
regionAttachment.b = toColor(color, 2);
|
||||
regionAttachment.a = toColor(color, 3);
|
||||
}
|
||||
|
||||
regionAttachment.updateOffset();
|
||||
} else if (attachment is BoundingBoxAttachment) {
|
||||
var box:BoundingBoxAttachment = attachment as BoundingBoxAttachment;
|
||||
|
||||
@ -46,6 +46,10 @@ public dynamic class RegionAttachment extends Attachment {
|
||||
public var rotation:Number;
|
||||
public var width:Number;
|
||||
public var height:Number;
|
||||
public var r:Number = 1;
|
||||
public var g:Number = 1;
|
||||
public var b:Number = 1;
|
||||
public var a:Number = 1;
|
||||
|
||||
public var rendererObject:Object;
|
||||
public var regionOffsetX:Number; // Pixels stripped from the bottom left, unrotated.
|
||||
|
||||
@ -119,10 +119,10 @@ public class SkeletonSprite extends Sprite {
|
||||
wrapper.blendMode = slot.data.additiveBlending ? BlendMode.ADD : BlendMode.NORMAL;
|
||||
|
||||
var colorTransform:ColorTransform = wrapper.transform.colorTransform;
|
||||
colorTransform.redMultiplier = skeleton.r * slot.r;
|
||||
colorTransform.greenMultiplier = skeleton.g * slot.g;
|
||||
colorTransform.blueMultiplier = skeleton.b * slot.b;
|
||||
colorTransform.alphaMultiplier = skeleton.a * slot.a;
|
||||
colorTransform.redMultiplier = skeleton.r * slot.r * regionAttachment.r;
|
||||
colorTransform.greenMultiplier = skeleton.g * slot.g * regionAttachment.g;
|
||||
colorTransform.blueMultiplier = skeleton.b * slot.b * regionAttachment.b;
|
||||
colorTransform.alphaMultiplier = skeleton.a * slot.a * regionAttachment.a;
|
||||
wrapper.transform.colorTransform = colorTransform;
|
||||
|
||||
var flipX:int = skeleton.flipX ? -1 : 1;
|
||||
|
||||
@ -79,8 +79,11 @@ public class SkeletonSprite extends DisplayObject implements IAnimatable {
|
||||
if (regionAttachment != null) {
|
||||
var vertices:Vector.<Number> = tempVertices;
|
||||
regionAttachment.computeWorldVertices(x, y, slot.bone, vertices);
|
||||
var a:Number = slot.a;
|
||||
var rgb:uint = Color.rgb(r * slot.r, g * slot.g, b * slot.b);
|
||||
var a:Number = slot.a * regionAttachment.a;
|
||||
var rgb:uint = Color.rgb(
|
||||
r * slot.r * regionAttachment.r,
|
||||
g * slot.g * regionAttachment.g,
|
||||
b * slot.b * regionAttachment.b);
|
||||
|
||||
var image:SkeletonImage;
|
||||
image = regionAttachment.rendererObject as SkeletonImage;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user