From 949ef9757b6996467b56ca66c4019b85ce8011a3 Mon Sep 17 00:00:00 2001 From: akdcl Date: Mon, 9 Sep 2013 11:38:05 +0800 Subject: [PATCH 01/15] fix set displayList bug --- src/dragonBones/Slot.as | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dragonBones/Slot.as b/src/dragonBones/Slot.as index 31ebed1..c751875 100644 --- a/src/dragonBones/Slot.as +++ b/src/dragonBones/Slot.as @@ -1,12 +1,12 @@ package dragonBones { + import flash.geom.Matrix; + import dragonBones.core.DBObject; import dragonBones.core.dragonBones_internal; import dragonBones.display.IDisplayBridge; import dragonBones.objects.DisplayData; - import flash.geom.Matrix; - use namespace dragonBones_internal; public class Slot extends DBObject @@ -99,8 +99,9 @@ package dragonBones if(_displayIndex >= 0) { + var displayIndexBackup:int = _displayIndex; _displayIndex = -1; - changeDisplay(_displayIndex); + changeDisplay(displayIndexBackup); } } From 5b064ae700c39e9d09872eefeba599243af07141 Mon Sep 17 00:00:00 2001 From: akdcl Date: Tue, 24 Sep 2013 17:24:47 +0800 Subject: [PATCH 02/15] make a copy of bytes --- src/dragonBones/objects/DataParser.as | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dragonBones/objects/DataParser.as b/src/dragonBones/objects/DataParser.as index 83bb4b9..797b60a 100644 --- a/src/dragonBones/objects/DataParser.as +++ b/src/dragonBones/objects/DataParser.as @@ -1,13 +1,13 @@ package dragonBones.objects { + import flash.utils.ByteArray; + import dragonBones.objects.ObjectDataParser; import dragonBones.objects.SkeletonData; import dragonBones.objects.XMLDataParser; import dragonBones.utils.BytesType; import dragonBones.utils.checkBytesTailisXML; - import flash.utils.ByteArray; - public final class DataParser { /** @@ -57,6 +57,10 @@ case BytesType.ATF: try { + var bytesCopy:ByteArray = new ByteArray(); + bytesCopy.writeBytes(bytes); + bytes = bytesCopy; + bytes.position = bytes.length - 4; var strSize:int = bytes.readInt(); var position:uint = bytes.length - 4 - strSize; From 2df8296ed26921a1484c12127d77f29ab661b36a Mon Sep 17 00:00:00 2001 From: Frank Watson Song Date: Fri, 27 Sep 2013 09:18:09 +0800 Subject: [PATCH 03/15] Add modify to bone data, and support spine bone inherit rotation and scale control supports. --- src/dragonBones/factorys/BaseFactory.as | 2 ++ src/dragonBones/objects/BoneData.as | 5 +++++ src/dragonBones/objects/ObjectDataParser.as | 10 ++++++++++ src/dragonBones/objects/XMLDataParser.as | 18 ++++++++++++++++++ src/dragonBones/utils/ConstValues.as | 2 ++ 5 files changed, 37 insertions(+) diff --git a/src/dragonBones/factorys/BaseFactory.as b/src/dragonBones/factorys/BaseFactory.as index b7c3a37..a8ac1b2 100644 --- a/src/dragonBones/factorys/BaseFactory.as +++ b/src/dragonBones/factorys/BaseFactory.as @@ -295,6 +295,8 @@ package dragonBones.factorys { bone = new Bone(); bone.name = boneData.name; + bone.fixedRotation = boneData.fixedRotation; + bone.scaleMode = boneData.scaleMode; bone.origin.copy(boneData.transform); if(armatureData.getBoneData(boneData.parent)) { diff --git a/src/dragonBones/objects/BoneData.as b/src/dragonBones/objects/BoneData.as index 49c90c1..5155568 100644 --- a/src/dragonBones/objects/BoneData.as +++ b/src/dragonBones/objects/BoneData.as @@ -11,11 +11,16 @@ package dragonBones.objects public var global:DBTransform; public var transform:DBTransform; + public var scaleMode:int; + public var fixedRotation:Boolean; + public function BoneData() { length = 0; global = new DBTransform(); transform = new DBTransform(); + scaleMode = 1; + fixedRotation = false; } public function dispose():void diff --git a/src/dragonBones/objects/ObjectDataParser.as b/src/dragonBones/objects/ObjectDataParser.as index d1682e7..e7652ad 100644 --- a/src/dragonBones/objects/ObjectDataParser.as +++ b/src/dragonBones/objects/ObjectDataParser.as @@ -104,6 +104,16 @@ boneData.name = boneObject[ConstValues.A_NAME]; boneData.parent = boneObject[ConstValues.A_PARENT]; boneData.length = Number(boneObject[ConstValues.A_LENGTH]) || 0; + var scaleMode:int = boneObject[ConstValues.A_SCALE_MODE] as int; + if (scaleMode) + { + boneData.scaleMode = scaleMode; + } + var inheritRotation:Boolean = boneObject[ConstValues.A_FIXED_ROTATION] as Boolean; + if (inheritRotation) + { + boneData.fixedRotation = inheritRotation; + } parseTransform(boneObject[ConstValues.TRANSFORM], boneData.global); boneData.transform.copy(boneData.global); diff --git a/src/dragonBones/objects/XMLDataParser.as b/src/dragonBones/objects/XMLDataParser.as index 784868f..272fd2e 100644 --- a/src/dragonBones/objects/XMLDataParser.as +++ b/src/dragonBones/objects/XMLDataParser.as @@ -126,6 +126,24 @@ boneData.name = boneXML.@[ConstValues.A_NAME]; boneData.parent = boneXML.@[ConstValues.A_PARENT]; boneData.length = Number(boneXML.@[ConstValues.A_LENGTH]); + var inheritScale:String = boneXML.@[ConstValues.A_SCALE_MODE]; + if (inheritScale) + { + boneData.scaleMode = parseInt(inheritScale); + } + + var fixedRotation:String = boneXML.@[ConstValues.A_FIXED_ROTATION]; + switch (fixedRotation) + { + case "0": + case "false": + case "no": + boneData.fixedRotation = false; + break; + default: + boneData.fixedRotation = true; + break; + } parseTransform(boneXML[ConstValues.TRANSFORM][0], boneData.global); boneData.transform.copy(boneData.global); diff --git a/src/dragonBones/utils/ConstValues.as b/src/dragonBones/utils/ConstValues.as index 57cf6af..cb02ad2 100644 --- a/src/dragonBones/utils/ConstValues.as +++ b/src/dragonBones/utils/ConstValues.as @@ -43,6 +43,8 @@ public static const A_Z_ORDER:String = "z"; public static const A_WIDTH:String = "width"; public static const A_HEIGHT:String = "height"; + public static const A_SCALE_MODE:String = "scaleMode"; + public static const A_FIXED_ROTATION:String = "fixedRotation"; public static const A_X:String = "x"; public static const A_Y:String = "y"; public static const A_SKEW_X:String = "skX"; From 8880adc75a274879955fb0fdb9a9562bcfcc73e9 Mon Sep 17 00:00:00 2001 From: Frank Watson Song Date: Fri, 27 Sep 2013 10:57:43 +0800 Subject: [PATCH 04/15] Modify object data. --- src/dragonBones/objects/ObjectDataParser.as | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dragonBones/objects/ObjectDataParser.as b/src/dragonBones/objects/ObjectDataParser.as index e7652ad..1d8cf54 100644 --- a/src/dragonBones/objects/ObjectDataParser.as +++ b/src/dragonBones/objects/ObjectDataParser.as @@ -1,9 +1,5 @@ package dragonBones.objects { - import flash.geom.ColorTransform; - import flash.geom.Point; - import flash.geom.Rectangle; - import dragonBones.core.DragonBones; import dragonBones.core.dragonBones_internal; import dragonBones.objects.AnimationData; @@ -21,6 +17,10 @@ import dragonBones.utils.ConstValues; import dragonBones.utils.DBDataUtil; + import flash.geom.ColorTransform; + import flash.geom.Point; + import flash.geom.Rectangle; + use namespace dragonBones_internal; public final class ObjectDataParser @@ -104,9 +104,10 @@ boneData.name = boneObject[ConstValues.A_NAME]; boneData.parent = boneObject[ConstValues.A_PARENT]; boneData.length = Number(boneObject[ConstValues.A_LENGTH]) || 0; - var scaleMode:int = boneObject[ConstValues.A_SCALE_MODE] as int; - if (scaleMode) + var scaleModeObj:Object = boneObject[ConstValues.A_SCALE_MODE]; + if (scaleModeObj) { + var scaleMode:int = scaleModeObj as int; boneData.scaleMode = scaleMode; } var inheritRotation:Boolean = boneObject[ConstValues.A_FIXED_ROTATION] as Boolean; From d149f9aeea22831ae869582a89e8c48e5eaab9a3 Mon Sep 17 00:00:00 2001 From: Frank Watson Song Date: Fri, 27 Sep 2013 14:46:26 +0800 Subject: [PATCH 05/15] Add blend mode support --- src/dragonBones/Slot.as | 25 +++++++++++++++++++ src/dragonBones/display/IDisplayBridge.as | 6 +++++ .../display/NativeDisplayBridge.as | 8 ++++++ .../display/StarlingDisplayBridge.as | 11 ++++++++ src/dragonBones/factorys/BaseFactory.as | 1 + src/dragonBones/objects/ObjectDataParser.as | 5 ++++ src/dragonBones/objects/SlotData.as | 2 ++ src/dragonBones/objects/XMLDataParser.as | 5 ++++ src/dragonBones/utils/ConstValues.as | 1 + 9 files changed, 64 insertions(+) diff --git a/src/dragonBones/Slot.as b/src/dragonBones/Slot.as index 31ebed1..c99ce5c 100644 --- a/src/dragonBones/Slot.as +++ b/src/dragonBones/Slot.as @@ -25,6 +25,7 @@ package dragonBones private var _isHideDisplay:Boolean; private var _offsetZOrder:Number; private var _displayIndex:int; + private var _blendMode:String; public function get zOrder():Number { @@ -42,6 +43,23 @@ package dragonBones } } } + + public function get blendMode():String + { + return _blendMode; + } + + public function set blendMode(value:String):void + { + if(_blendMode != value) + { + _blendMode = value; + if (_displayBridge.display) + { + _displayBridge.updateBlendMode(_blendMode); + } + } + } /** * The DisplayObject belonging to this Bone instance. Instance type of this object varies from flash.display.DisplayObject to startling.display.DisplayObject and subclasses. @@ -121,6 +139,10 @@ package dragonBones } updateChildArmatureAnimation(); + if (display) + { + _displayBridge.updateBlendMode(_blendMode); + } if(!_isHideDisplay && _displayBridge.display) { @@ -238,6 +260,9 @@ package dragonBones _isDisplayOnStage = false; _isHideDisplay = false; + + _blendMode = "normal"; + _displayBridge.updateBlendMode(_blendMode); } /** diff --git a/src/dragonBones/display/IDisplayBridge.as b/src/dragonBones/display/IDisplayBridge.as index 952d8b5..f91bb84 100644 --- a/src/dragonBones/display/IDisplayBridge.as +++ b/src/dragonBones/display/IDisplayBridge.as @@ -60,6 +60,12 @@ package dragonBones.display gMultiplier:Number, bMultiplier:Number ):void; + + /** + * Update the blend mode of the display object + * @param blendMode The blend mode to use. + */ + function updateBlendMode(blendMode:String):void; /** * Adds the original display object to another display object. diff --git a/src/dragonBones/display/NativeDisplayBridge.as b/src/dragonBones/display/NativeDisplayBridge.as index 2e7542f..c63b217 100644 --- a/src/dragonBones/display/NativeDisplayBridge.as +++ b/src/dragonBones/display/NativeDisplayBridge.as @@ -120,6 +120,14 @@ package dragonBones.display _display.transform.colorTransform = _colorTransform; } + + /** + * @inheritDoc + */ + public function updateBlendMode(blendMode:String):void + { + _display.blendMode = blendMode; + } /** * @inheritDoc diff --git a/src/dragonBones/display/StarlingDisplayBridge.as b/src/dragonBones/display/StarlingDisplayBridge.as index c967aaa..f66ff90 100644 --- a/src/dragonBones/display/StarlingDisplayBridge.as +++ b/src/dragonBones/display/StarlingDisplayBridge.as @@ -157,6 +157,17 @@ (_display as Quad).color = (uint(rMultiplier * 0xff) << 16) + (uint(gMultiplier * 0xff) << 8) + uint(bMultiplier * 0xff); } } + + /** + * @inheritDoc + */ + public function updateBlendMode(blendMode:String):void + { + if (_display is DisplayObject) + { + _display.blendMode = blendMode; + } + } /** * @inheritDoc diff --git a/src/dragonBones/factorys/BaseFactory.as b/src/dragonBones/factorys/BaseFactory.as index a8ac1b2..beda601 100644 --- a/src/dragonBones/factorys/BaseFactory.as +++ b/src/dragonBones/factorys/BaseFactory.as @@ -354,6 +354,7 @@ package dragonBones.factorys } slot = generateSlot(); slot.name = slotData.name; + slot.blendMode = slotData.blendMode; slot._originZOrder = slotData.zOrder; slot._dislayDataList = slotData.displayDataList; diff --git a/src/dragonBones/objects/ObjectDataParser.as b/src/dragonBones/objects/ObjectDataParser.as index 1d8cf54..0d37dd1 100644 --- a/src/dragonBones/objects/ObjectDataParser.as +++ b/src/dragonBones/objects/ObjectDataParser.as @@ -141,6 +141,11 @@ slotData.name = slotObject[ConstValues.A_NAME]; slotData.parent = slotObject[ConstValues.A_PARENT]; slotData.zOrder = Number(slotObject[ConstValues.A_Z_ORDER]); + slotData.blendMode = slotObject[ConstValues.A_BLENDMODE]; + if(!slotData.blendMode) + { + slotData.blendMode = "normal"; + } for each(var displayObject:Object in slotObject[ConstValues.DISPLAY]) { slotData.addDisplayData(parseDisplayData(displayObject, data)); diff --git a/src/dragonBones/objects/SlotData.as b/src/dragonBones/objects/SlotData.as index fa16ed8..49c331d 100644 --- a/src/dragonBones/objects/SlotData.as +++ b/src/dragonBones/objects/SlotData.as @@ -6,6 +6,7 @@ package dragonBones.objects public var name:String; public var parent:String; public var zOrder:Number; + public var blendMode:String; private var _displayDataList:Vector.; public function get displayDataList():Vector. @@ -17,6 +18,7 @@ package dragonBones.objects { _displayDataList = new Vector.(0, true); zOrder = 0; + blendMode = "normal"; } public function dispose():void diff --git a/src/dragonBones/objects/XMLDataParser.as b/src/dragonBones/objects/XMLDataParser.as index 272fd2e..39a0713 100644 --- a/src/dragonBones/objects/XMLDataParser.as +++ b/src/dragonBones/objects/XMLDataParser.as @@ -170,6 +170,11 @@ slotData.name = slotXML.@[ConstValues.A_NAME]; slotData.parent = slotXML.@[ConstValues.A_PARENT]; slotData.zOrder = Number(slotXML.@[ConstValues.A_Z_ORDER]); + slotData.blendMode = slotXML.@[ConstValues.A_BLENDMODE]; + if(!slotData.blendMode) + { + slotData.blendMode = "normal"; + } for each(var displayXML:XML in slotXML[ConstValues.DISPLAY]) { slotData.addDisplayData(parseDisplayData(displayXML, data)); diff --git a/src/dragonBones/utils/ConstValues.as b/src/dragonBones/utils/ConstValues.as index cb02ad2..1f8e37f 100644 --- a/src/dragonBones/utils/ConstValues.as +++ b/src/dragonBones/utils/ConstValues.as @@ -41,6 +41,7 @@ public static const A_TWEEN_ROTATE:String = "tweenRotate"; public static const A_DISPLAY_INDEX:String = "displayIndex"; public static const A_Z_ORDER:String = "z"; + public static const A_BLENDMODE:String = "blendMode"; public static const A_WIDTH:String = "width"; public static const A_HEIGHT:String = "height"; public static const A_SCALE_MODE:String = "scaleMode"; From 0185bbcb7b2f07add7e75e0840ad15ad596a8a9f Mon Sep 17 00:00:00 2001 From: akdcl Date: Fri, 27 Sep 2013 17:41:42 +0800 Subject: [PATCH 06/15] added armature.alwaysUpdate. Fix some typos. --- src/dragonBones/Armature.as | 93 +++++++++++++-------- src/dragonBones/Bone.as | 39 ++++----- src/dragonBones/animation/Animation.as | 59 ++++++++----- src/dragonBones/animation/AnimationState.as | 86 +++++++++---------- src/dragonBones/animation/TimelineState.as | 2 + src/dragonBones/animation/WorldClock.as | 30 +++---- src/dragonBones/utils/DBDataUtil.as | 19 +++-- 7 files changed, 185 insertions(+), 143 deletions(-) diff --git a/src/dragonBones/Armature.as b/src/dragonBones/Armature.as index c8cb003..693b29f 100644 --- a/src/dragonBones/Armature.as +++ b/src/dragonBones/Armature.as @@ -1,5 +1,9 @@ package dragonBones { + import flash.events.Event; + import flash.events.EventDispatcher; + import flash.geom.ColorTransform; + import dragonBones.animation.Animation; import dragonBones.animation.AnimationState; import dragonBones.animation.IAnimatable; @@ -13,10 +17,6 @@ import dragonBones.objects.DBTransform; import dragonBones.objects.Frame; - import flash.events.Event; - import flash.events.EventDispatcher; - import flash.geom.ColorTransform; - use namespace dragonBones_internal; /** @@ -79,6 +79,8 @@ */ public var name:String; + public var alwaysUpdate:Boolean; + /** * An object that can contain any user extra data. */ @@ -131,6 +133,8 @@ _boneList = new Vector.; _boneList.fixed = true; _eventList = new Vector.; + + alwaysUpdate = false; } /** @@ -177,47 +181,70 @@ */ public function advanceTime(passedTime:Number):void { - _animation.advanceTime(passedTime); - - var i:int = _boneList.length; - while(i --) - { - _boneList[i].update(); - } - - i = _slotList.length; + var i:int; var slot:Slot; - while(i --) - { - slot = _slotList[i]; - slot.update(); - if(slot._isDisplayOnStage) + var childArmature:Armature; + if(_animation.isPlaying || alwaysUpdate) + { + _animation.advanceTime(passedTime) + passedTime *= _animation.timeScale; + + i = _boneList.length; + while(i --) + { + _boneList[i].update(); + } + + i = _slotList.length; + while(i --) { - var childArmature:Armature = slot.childArmature; - if(childArmature) + slot = _slotList[i]; + slot.update(); + if(slot._isDisplayOnStage) { - childArmature.advanceTime(passedTime); + childArmature = slot.childArmature; + if(childArmature) + { + childArmature.advanceTime(passedTime); + } + } + } + + if(_slotsZOrderChanged) + { + updateSlotsZOrder(); + + if(this.hasEventListener(ArmatureEvent.Z_ORDER_UPDATED)) + { + this.dispatchEvent(new ArmatureEvent(ArmatureEvent.Z_ORDER_UPDATED)); } } - } - - if(_slotsZOrderChanged) - { - updateSlotsZOrder(); - if(this.hasEventListener(ArmatureEvent.Z_ORDER_UPDATED)) + if(_eventList.length) { - this.dispatchEvent(new ArmatureEvent(ArmatureEvent.Z_ORDER_UPDATED)); + for each(var event:Event in _eventList) + { + this.dispatchEvent(event); + } + _eventList.length = 0; } } - - if(_eventList.length) + else { - for each(var event:Event in _eventList) + passedTime *= _animation.timeScale; + i = _slotList.length; + while(i --) { - this.dispatchEvent(event); + slot = _slotList[i]; + if(slot._isDisplayOnStage) + { + childArmature = slot.childArmature; + if(childArmature) + { + childArmature.advanceTime(passedTime); + } + } } - _eventList.length = 0; } } diff --git a/src/dragonBones/Bone.as b/src/dragonBones/Bone.as index f98403c..2161d3a 100644 --- a/src/dragonBones/Bone.as +++ b/src/dragonBones/Bone.as @@ -1,5 +1,7 @@ package dragonBones { + import flash.geom.Point; + import dragonBones.animation.AnimationState; import dragonBones.animation.TimelineState; import dragonBones.core.DBObject; @@ -10,8 +12,6 @@ import dragonBones.objects.Frame; import dragonBones.objects.TransformFrame; - import flash.geom.Point; - use namespace dragonBones_internal; public class Bone extends DBObject @@ -57,15 +57,7 @@ } } - private var _displayController:String; - public function get displayController():String - { - return _displayController; - } - public function set displayController(value:String):void - { - _displayController = value; - } + public var displayController:String; /** * @inheritDoc @@ -78,10 +70,10 @@ var i:int = _children.length; while(i --) { - var slot:Slot = _children[i] as Slot; - if(slot) + var child:DBObject = _children[i]; + if(child is Slot) { - slot.updateVisible(this._visible); + (child as Slot).updateVisible(this._visible); } } } @@ -158,8 +150,7 @@ throw new ArgumentError(); } - var bone:Bone = child as Bone; - if(child == this || (bone && bone.contains(this))) + if(child == this || (child is Bone && (child as Bone).contains(this))) { throw new ArgumentError("An Bone cannot be added as a child to itself or one of its children (or children's children, etc.)"); } @@ -196,7 +187,7 @@ child.setParent(null); child.setArmature(null); - if(_slot && child == _slot) + if(child == _slot) { _slot = null; } @@ -235,7 +226,7 @@ if(animationState.displayControl && (mixingType == 2 || mixingType == -1)) { if( - !_displayController || _displayController == animationState.name + !displayController || displayController == animationState.name ) { var tansformFrame:TransformFrame = frame as TransformFrame; @@ -276,10 +267,16 @@ if(frame.action) { - var childArmature:Armature = this.childArmature; - if(childArmature) + for each(var child:DBObject in _children) { - childArmature.animation.gotoAndPlay(frame.action); + if(child is Slot) + { + var childArmature:Armature = (child as Slot).childArmature; + if(childArmature) + { + childArmature.animation.gotoAndPlay(frame.action); + } + } } } } diff --git a/src/dragonBones/animation/Animation.as b/src/dragonBones/animation/Animation.as index 1e89489..ed944fa 100644 --- a/src/dragonBones/animation/Animation.as +++ b/src/dragonBones/animation/Animation.as @@ -6,14 +6,15 @@ * @langversion 3.0 * @version 2.0 */ + import flash.geom.Point; + import dragonBones.Armature; import dragonBones.Bone; + import dragonBones.Slot; import dragonBones.core.dragonBones_internal; import dragonBones.objects.AnimationData; import dragonBones.objects.DBTransform; - import flash.geom.Point; - use namespace dragonBones_internal; /** @@ -79,7 +80,7 @@ dragonBones_internal var _animationLayer:Vector.>; private var _armature:Armature; - private var _isPlaying:Boolean; + private var _isActive:Boolean; /** * An vector containing all AnimationData names the Animation can play. @@ -119,9 +120,10 @@ return _animationList; } + private var _isPlaying:Boolean; public function get isPlaying():Boolean { - return _isPlaying && !isComplete; + return _isPlaying && _isActive; } public function get isComplete():Boolean @@ -196,6 +198,8 @@ _animationLayer = new Vector.>; _animationList = new Vector.; + _isPlaying = false; + _isActive = false; tweenEnabled = true; } @@ -361,15 +365,15 @@ addState(_lastAnimationState); - var boneList:Vector. = _armature._boneList; - var bone:Bone; - i = boneList.length; + var slotList:Vector. = _armature._slotList; + var slot:Slot; + i = slotList.length; while(i --) { - bone = boneList[i]; - if(bone.childArmature) + slot = slotList[i]; + if(slot.childArmature) { - bone.childArmature.animation.gotoAndPlay(animationName, fadeInTime); + slot.childArmature.animation.gotoAndPlay(animationName, fadeInTime); } } @@ -456,10 +460,12 @@ public function advanceTime(passedTime:Number):void { - if(!_isPlaying) + /* + if(!_isPlaying || !_isActive) { return; } + */ passedTime *= _timeScale; var l:int = _armature._boneList.length; @@ -568,21 +574,32 @@ } /** @private */ - /*dragonBones_internal function setStatesDisplayControl(animationState:AnimationState):void + dragonBones_internal function setActive(animationState:AnimationState, active:Boolean):void { - var i:int = _animationLayer.length; - var animationStateList:Vector. = _animationLayer[i]; - var j:int; - while(i --) + if(active) { - animationStateList = _animationLayer[i]; - j = animationStateList.length; - while(j --) + _isActive = true; + } + else + { + var i:int = _animationLayer.length; + var j:int; + var animationStateList:Vector.; + while(i --) { - animationStateList[j].displayControl = animationStateList[j] == animationState; + animationStateList = _animationLayer[i]; + j = animationStateList.length; + while(j --) + { + if(animationStateList[j].isPlaying) + { + return; + } + } } + _isActive = false; } - }*/ + } private function addLayer(layer:uint):uint { diff --git a/src/dragonBones/animation/AnimationState.as b/src/dragonBones/animation/AnimationState.as index 8e966b2..cb931bd 100644 --- a/src/dragonBones/animation/AnimationState.as +++ b/src/dragonBones/animation/AnimationState.as @@ -1,4 +1,4 @@ -package dragonBones.animation +package dragonBones.animation { import dragonBones.Armature; import dragonBones.Bone; @@ -50,7 +50,6 @@ package dragonBones.animation TimelineState.clear(); } - public var enabled:Boolean; public var tweenEnabled:Boolean; public var blend:Boolean; public var group:String; @@ -71,7 +70,7 @@ package dragonBones.animation private var _fadeOutWeight:Number; private var _fadeIn:Boolean; private var _fadeOut:Boolean; - private var _pauseBeforeFadeInComplete:Boolean; + private var _pauseBeforeFadeInCompleteState:int; private var _name:String; public function get name():String @@ -106,7 +105,7 @@ package dragonBones.animation private var _isPlaying:Boolean; public function get isPlaying():Boolean { - return _isPlaying && !_isComplete; + return _isPlaying && !_isComplete; } private var _isComplete:Boolean; @@ -164,22 +163,7 @@ package dragonBones.animation _timeScale = value; } - private var _displayControl:Boolean; - public function get displayControl():Boolean - { - return _displayControl; - } - public function set displayControl(value:Boolean):void - { - if(_displayControl != value) - { - _displayControl = value; - /*if(_displayControl) - { - _armature.animation.setStatesDisplayControl(this); - }*/ - } - } + public var displayControl:Boolean; public function AnimationState() { @@ -214,7 +198,15 @@ package dragonBones.animation _currentTime = 0; _loop = loop; } - _pauseBeforeFadeInComplete = pauseBeforeFadeInComplete; + + if(pauseBeforeFadeInComplete) + { + _pauseBeforeFadeInCompleteState = -1; + } + else + { + _pauseBeforeFadeInCompleteState = 1; + } _fadeInTime = fadeInTime * _timeScale; @@ -222,17 +214,17 @@ package dragonBones.animation _loopCount = -1; _fadeState = 1; _fadeOutBeginTime = 0; - _fadeOutWeight = NaN; + _fadeOutWeight = -1; _fadeWeight = 0; - _displayControl = displayControl; _isPlaying = true; _isComplete = false; _fadeIn = true; _fadeOut = false; + this.displayControl = displayControl; + weight = 1; blend = true; - enabled = true; tweenEnabled = true; updateTimelineStates(); @@ -240,7 +232,7 @@ package dragonBones.animation public function fadeOut(fadeOutTime:Number, pause:Boolean = false):void { - if(!isNaN(_fadeOutWeight)) + if(!_armature || _fadeOutWeight >= 0) { return; } @@ -248,16 +240,15 @@ package dragonBones.animation _fadeOutWeight = _fadeWeight; _fadeOutTime = fadeOutTime * _timeScale; _fadeOutBeginTime = _currentTime; + _isPlaying = !pause; _fadeOut = true; - _displayControl = false; + displayControl = false; for each(var timelineState:TimelineState in _timelineStates) { timelineState.fadeOut(); } - - enabled = true; } public function play():void @@ -365,28 +356,25 @@ package dragonBones.animation public function advanceTime(passedTime:Number):Boolean { - if(!enabled) - { - return false; - } - var event:AnimationEvent; var isComplete:Boolean; if(_fadeIn) { _fadeIn = false; + _armature.animation.setActive(this, true); if(_armature.hasEventListener(AnimationEvent.FADE_IN)) { event = new AnimationEvent(AnimationEvent.FADE_IN); event.animationState = this; _armature._eventList.push(event); - }; + } } if(_fadeOut) { _fadeOut = false; + _armature.animation.setActive(this, true); if(_armature.hasEventListener(AnimationEvent.FADE_OUT)) { event = new AnimationEvent(AnimationEvent.FADE_OUT); @@ -397,25 +385,26 @@ package dragonBones.animation _currentTime += passedTime * _timeScale; - if(_isPlaying && !_isComplete) + if(_isPlaying && !_isComplete && _pauseBeforeFadeInCompleteState) { - if(_pauseBeforeFadeInComplete) + var progress:Number; + var currentLoopCount:int; + if(_pauseBeforeFadeInCompleteState == -1) { - _pauseBeforeFadeInComplete = false; - _isPlaying = false; - var progress:Number = 0; - var currentLoopCount:int = progress; + _pauseBeforeFadeInCompleteState = 0; + progress = 0; + currentLoopCount = progress; } else { progress = _currentTime / _totalTime; - //update loopCount currentLoopCount = progress; if(currentLoopCount != _loopCount) { if(_loopCount == -1) { + _armature.animation.setActive(this, true); if(_armature.hasEventListener(AnimationEvent.START)) { event = new AnimationEvent(AnimationEvent.START); @@ -500,7 +489,8 @@ package dragonBones.animation { _fadeWeight = 1; _fadeState = 0; - _isPlaying = true; + _pauseBeforeFadeInCompleteState = 1; + _armature.animation.setActive(this, false); if(_armature.hasEventListener(AnimationEvent.FADE_IN_COMPLETE)) { event = new AnimationEvent(AnimationEvent.FADE_IN_COMPLETE); @@ -515,11 +505,12 @@ package dragonBones.animation { _fadeWeight = 1; _fadeState = 0; - if(!_isPlaying) + if(_pauseBeforeFadeInCompleteState == 0) { _currentTime -= _fadeInTime; } - _isPlaying = true; + _pauseBeforeFadeInCompleteState = 1; + _armature.animation.setActive(this, false); if(_armature.hasEventListener(AnimationEvent.FADE_IN_COMPLETE)) { event = new AnimationEvent(AnimationEvent.FADE_IN_COMPLETE); @@ -535,6 +526,7 @@ package dragonBones.animation { _fadeWeight = 0; _fadeState = 0; + _armature.animation.setActive(this, false); if(_armature.hasEventListener(AnimationEvent.FADE_OUT_COMPLETE)) { event = new AnimationEvent(AnimationEvent.FADE_OUT_COMPLETE); @@ -550,6 +542,7 @@ package dragonBones.animation { _fadeWeight = 0; _fadeState = 0; + _armature.animation.setActive(this, false); if(_armature.hasEventListener(AnimationEvent.FADE_OUT_COMPLETE)) { event = new AnimationEvent(AnimationEvent.FADE_OUT_COMPLETE); @@ -568,6 +561,10 @@ package dragonBones.animation { fadeOut((_fadeOutWeight || _fadeInTime) / _timeScale, true); } + else + { + _armature.animation.setActive(this, false); + } } return false; @@ -629,7 +626,6 @@ package dragonBones.animation _currentFrame = null; _clip = null; _mixingTransforms = null; - enabled = false; for(var timelineName:String in _timelineStates) { diff --git a/src/dragonBones/animation/TimelineState.as b/src/dragonBones/animation/TimelineState.as index d359020..519f12d 100644 --- a/src/dragonBones/animation/TimelineState.as +++ b/src/dragonBones/animation/TimelineState.as @@ -148,6 +148,8 @@ package dragonBones.animation _durationPivot.x = 0; _durationPivot.y = 0; + _currentFrame = null; + switch(_timeline.frameList.length) { case 0: diff --git a/src/dragonBones/animation/WorldClock.as b/src/dragonBones/animation/WorldClock.as index a65f006..5eea161 100644 --- a/src/dragonBones/animation/WorldClock.as +++ b/src/dragonBones/animation/WorldClock.as @@ -65,7 +65,7 @@ */ public static var clock:WorldClock = new WorldClock(); - private var animatableList:Vector.; + private var _animatableList:Vector.; private var _time:Number; /** @@ -102,7 +102,7 @@ public function WorldClock() { _time = getTimer() * 0.001; - animatableList = new Vector.; + _animatableList = new Vector.; } /** @@ -112,7 +112,7 @@ */ public function contains(animatable:IAnimatable):Boolean { - return animatableList.indexOf(animatable) >= 0; + return _animatableList.indexOf(animatable) >= 0; } /** * Add a IAnimatable instance (Armature or custom) to this WorldClock instance. @@ -120,9 +120,9 @@ */ public function add(animatable:IAnimatable):void { - if (animatable && animatableList.indexOf(animatable) == -1) + if (animatable && _animatableList.indexOf(animatable) == -1) { - animatableList.push(animatable); + _animatableList.push(animatable); } } /** @@ -131,10 +131,10 @@ */ public function remove(animatable:IAnimatable):void { - var index:int = animatableList.indexOf(animatable); + var index:int = _animatableList.indexOf(animatable); if (index >= 0) { - animatableList[index] = null; + _animatableList[index] = null; } } /** @@ -143,7 +143,7 @@ */ public function clear():void { - animatableList.length = 0; + _animatableList.length = 0; } /** * Update all registered IAnimatable instance animations using this method typically in an ENTERFRAME Event or with a Timer. @@ -160,7 +160,7 @@ passedTime *= _timeScale; - var length:int = animatableList.length; + var length:int = _animatableList.length; if(length == 0) { return; @@ -169,13 +169,13 @@ for(var i:int = 0;i < length;i ++) { - var animatable:IAnimatable = animatableList[i]; + var animatable:IAnimatable = _animatableList[i]; if(animatable) { if(currentIndex != i) { - animatableList[currentIndex] = animatable; - animatableList[i] = null; + _animatableList[currentIndex] = animatable; + _animatableList[i] = null; } animatable.advanceTime(passedTime); currentIndex ++; @@ -184,12 +184,12 @@ if (currentIndex != i) { - length = animatableList.length; + length = _animatableList.length; while(i < length) { - animatableList[currentIndex ++] = animatableList[i ++]; + _animatableList[currentIndex ++] = _animatableList[i ++]; } - animatableList.length = currentIndex; + _animatableList.length = currentIndex; } } } diff --git a/src/dragonBones/utils/DBDataUtil.as b/src/dragonBones/utils/DBDataUtil.as index 0be8159..ddb954e 100644 --- a/src/dragonBones/utils/DBDataUtil.as +++ b/src/dragonBones/utils/DBDataUtil.as @@ -1,5 +1,7 @@ package dragonBones.utils { + import flash.geom.Point; + import dragonBones.animation.TimelineState; import dragonBones.objects.AnimationData; import dragonBones.objects.ArmatureData; @@ -12,8 +14,6 @@ package dragonBones.utils import dragonBones.objects.TransformFrame; import dragonBones.objects.TransformTimeline; - import flash.geom.Point; - /** @private */ public final class DBDataUtil { @@ -22,12 +22,13 @@ package dragonBones.utils public static function transformArmatureData(armatureData:ArmatureData):void { - var i:int = armatureData.boneDataList.length; + var boneDataList:Vector. = armatureData.boneDataList; + var i:int = boneDataList.length; var boneData:BoneData; var parentBoneData:BoneData; while(i --) { - boneData = armatureData.boneDataList[i]; + boneData = boneDataList[i]; if(boneData.parent) { parentBoneData = armatureData.getBoneData(boneData.parent); @@ -53,7 +54,9 @@ package dragonBones.utils public static function transformAnimationData(animationData:AnimationData, armatureData:ArmatureData):void { var skinData:SkinData = armatureData.getSkinData(null); - var i:int = armatureData.boneDataList.length; + var boneDataList:Vector. = armatureData.boneDataList; + var slotDataList:Vector. = skinData.slotDataList; + var i:int = boneDataList.length; var boneData:BoneData; var timeline:TransformTimeline; @@ -69,7 +72,7 @@ package dragonBones.utils while(i --) { - boneData = armatureData.boneDataList[i]; + boneData = boneDataList[i]; timeline = animationData.getTimeline(boneData.name); if(!timeline) { @@ -77,7 +80,7 @@ package dragonBones.utils } slotData = null; - for each(slotData in skinData.slotDataList) + for each(slotData in slotDataList) { if(slotData.parent == boneData.name) { @@ -228,7 +231,7 @@ package dragonBones.utils progress = TimelineState.getEaseValue(progress, tweenEasing); } - nextFrame = timeline.frameList[i + 1] as TransformFrame; + nextFrame = frameList[i + 1] as TransformFrame; retult.x = currentFrame.global.x + (nextFrame.global.x - currentFrame.global.x) * progress; retult.y = currentFrame.global.y + (nextFrame.global.y - currentFrame.global.y) * progress; From 1f00f46ff8a978e4a4e29cc9fa8d78fae7c5d51a Mon Sep 17 00:00:00 2001 From: akdcl Date: Fri, 27 Sep 2013 17:50:43 +0800 Subject: [PATCH 07/15] Fix some typos. --- src/dragonBones/Slot.as | 6 +++++- src/dragonBones/factorys/BaseFactory.as | 20 +++++++++++++++++--- src/dragonBones/factorys/NativeFactory.as | 16 ++++++++-------- src/dragonBones/factorys/StarlingFactory.as | 16 ++++++++-------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/dragonBones/Slot.as b/src/dragonBones/Slot.as index 54308d0..05b6b7f 100644 --- a/src/dragonBones/Slot.as +++ b/src/dragonBones/Slot.as @@ -84,7 +84,11 @@ package dragonBones */ public function get childArmature():Armature { - return _displayList[_displayIndex] as Armature; + if(_displayList[_displayIndex] is Armature) + { + return _displayList[_displayIndex] as Armature; + } + return null; } public function set childArmature(value:Armature):void { diff --git a/src/dragonBones/factorys/BaseFactory.as b/src/dragonBones/factorys/BaseFactory.as index beda601..003fb88 100644 --- a/src/dragonBones/factorys/BaseFactory.as +++ b/src/dragonBones/factorys/BaseFactory.as @@ -37,7 +37,7 @@ package dragonBones.factorys public class BaseFactory extends EventDispatcher { /** @private */ - protected static const _helpMatirx:Matrix = new Matrix(); + protected static const _helpMatrix:Matrix = new Matrix(); private static const _loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain); /** @private */ @@ -384,8 +384,22 @@ package dragonBones.factorys slot.changeDisplay(0); bone.addChild(slot); } - armature._slotsZOrderChanged = true; - armature.advanceTime(0); + + // + i = armature._boneList.length; + while(i --) + { + armature._boneList[i].update(); + } + + i = armature._slotList.length; + while(i --) + { + slot = armature._slotList[i]; + slot.update(); + } + armature.updateSlotsZOrder(); + return armature; } diff --git a/src/dragonBones/factorys/NativeFactory.as b/src/dragonBones/factorys/NativeFactory.as index 6d27dbb..4c3c461 100644 --- a/src/dragonBones/factorys/NativeFactory.as +++ b/src/dragonBones/factorys/NativeFactory.as @@ -81,15 +81,15 @@ package dragonBones.factorys if (subTextureData) { var displayShape:Shape = new Shape(); - _helpMatirx.a = 1; - _helpMatirx.b = 0; - _helpMatirx.c = 0; - _helpMatirx.d = 1; - _helpMatirx.scale(nativeTextureAtlas.scale, nativeTextureAtlas.scale); - _helpMatirx.tx = -pivotX - subTextureData.x; - _helpMatirx.ty = -pivotY - subTextureData.y; + _helpMatrix.a = 1; + _helpMatrix.b = 0; + _helpMatrix.c = 0; + _helpMatrix.d = 1; + _helpMatrix.scale(nativeTextureAtlas.scale, nativeTextureAtlas.scale); + _helpMatrix.tx = -pivotX - subTextureData.x; + _helpMatrix.ty = -pivotY - subTextureData.y; - displayShape.graphics.beginBitmapFill(nativeTextureAtlas.bitmapData, _helpMatirx, false, fillBitmapSmooth); + displayShape.graphics.beginBitmapFill(nativeTextureAtlas.bitmapData, _helpMatrix, false, fillBitmapSmooth); displayShape.graphics.drawRect(-pivotX, -pivotY, subTextureData.width, subTextureData.height); return displayShape; diff --git a/src/dragonBones/factorys/StarlingFactory.as b/src/dragonBones/factorys/StarlingFactory.as index 3c30eb3..5f0e337 100644 --- a/src/dragonBones/factorys/StarlingFactory.as +++ b/src/dragonBones/factorys/StarlingFactory.as @@ -85,17 +85,17 @@ var width:int = getNearest2N(content.width) * scaleForTexture; var height:int = getNearest2N(content.height) * scaleForTexture; - _helpMatirx.a = 1; - _helpMatirx.b = 0; - _helpMatirx.c = 0; - _helpMatirx.d = 1; - _helpMatirx.scale(scaleForTexture, scaleForTexture); - _helpMatirx.tx = 0; - _helpMatirx.ty = 0; + _helpMatrix.a = 1; + _helpMatrix.b = 0; + _helpMatrix.c = 0; + _helpMatrix.d = 1; + _helpMatrix.scale(scaleForTexture, scaleForTexture); + _helpMatrix.tx = 0; + _helpMatrix.ty = 0; var movieClip:MovieClip = content as MovieClip; movieClip.gotoAndStop(1); bitmapData = new BitmapData(width, height, true, 0xFF00FF); - bitmapData.draw(movieClip, _helpMatirx); + bitmapData.draw(movieClip, _helpMatrix); movieClip.gotoAndStop(movieClip.totalFrames); texture = Texture.fromBitmapData(bitmapData, generateMipMaps, optimizeForRenderToTexture, scaleForTexture); } From 5c1422be4920683c1c323ac59896783497cb744d Mon Sep 17 00:00:00 2001 From: akdcl Date: Sat, 28 Sep 2013 13:18:40 +0800 Subject: [PATCH 08/15] fix NativeFactory textureDisplay scale bug --- src/dragonBones/factorys/NativeFactory.as | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dragonBones/factorys/NativeFactory.as b/src/dragonBones/factorys/NativeFactory.as index 4c3c461..f097933 100644 --- a/src/dragonBones/factorys/NativeFactory.as +++ b/src/dragonBones/factorys/NativeFactory.as @@ -52,7 +52,11 @@ package dragonBones.factorys /** @private */ override protected function generateDisplay(textureAtlas:Object, fullName:String, pivotX:Number, pivotY:Number):Object { - var nativeTextureAtlas:NativeTextureAtlas = textureAtlas as NativeTextureAtlas; + if(textureAtlas is NativeTextureAtlas) + { + var nativeTextureAtlas:NativeTextureAtlas = textureAtlas as NativeTextureAtlas; + } + if(nativeTextureAtlas) { var movieClip:MovieClip = nativeTextureAtlas.movieClip; @@ -85,7 +89,7 @@ package dragonBones.factorys _helpMatrix.b = 0; _helpMatrix.c = 0; _helpMatrix.d = 1; - _helpMatrix.scale(nativeTextureAtlas.scale, nativeTextureAtlas.scale); + _helpMatrix.scale(1 / nativeTextureAtlas.scale, 1 / nativeTextureAtlas.scale); _helpMatrix.tx = -pivotX - subTextureData.x; _helpMatrix.ty = -pivotY - subTextureData.y; From 1df2baef68f684fed48873a78338b72b99923605 Mon Sep 17 00:00:00 2001 From: akdcl Date: Sun, 29 Sep 2013 13:56:53 +0800 Subject: [PATCH 09/15] added armature.invalidUpdate() --- src/dragonBones/Armature.as | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/dragonBones/Armature.as b/src/dragonBones/Armature.as index 693b29f..f55c84a 100644 --- a/src/dragonBones/Armature.as +++ b/src/dragonBones/Armature.as @@ -79,8 +79,6 @@ */ public var name:String; - public var alwaysUpdate:Boolean; - /** * An object that can contain any user extra data. */ @@ -95,6 +93,9 @@ /** @private */ dragonBones_internal var _eventList:Vector.; + /** @private */ + protected var _needUpdate:Boolean; + /** @private */ protected var _display:Object; /** @@ -134,7 +135,7 @@ _boneList.fixed = true; _eventList = new Vector.; - alwaysUpdate = false; + _needUpdate = false; } /** @@ -175,6 +176,11 @@ //_display = null; } + public function invalidUpdate():void + { + _needUpdate = true; + } + /** * Update the animation using this method typically in an ENTERFRAME Event or with a Timer. * @param The amount of second to move the playhead ahead. @@ -184,8 +190,9 @@ var i:int; var slot:Slot; var childArmature:Armature; - if(_animation.isPlaying || alwaysUpdate) + if(_animation.isPlaying || _needUpdate) { + _needUpdate = false; _animation.advanceTime(passedTime) passedTime *= _animation.timeScale; From 6a5f7b11ac24068e5367122a56d9c0ed060cd2e1 Mon Sep 17 00:00:00 2001 From: akdcl Date: Sun, 29 Sep 2013 16:48:28 +0800 Subject: [PATCH 10/15] fix blendMode bug --- src/dragonBones/Slot.as | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dragonBones/Slot.as b/src/dragonBones/Slot.as index 05b6b7f..d15483b 100644 --- a/src/dragonBones/Slot.as +++ b/src/dragonBones/Slot.as @@ -144,14 +144,11 @@ package dragonBones } updateChildArmatureAnimation(); - if (display) - { - _displayBridge.updateBlendMode(_blendMode); - } if(!_isHideDisplay && _displayBridge.display) { _isDisplayOnStage = true; + _displayBridge.updateBlendMode(_blendMode); } else { @@ -267,7 +264,10 @@ package dragonBones _isHideDisplay = false; _blendMode = "normal"; - _displayBridge.updateBlendMode(_blendMode); + if(_displayBridge.display) + { + _displayBridge.updateBlendMode(_blendMode); + } } /** From e58ed8b904fa1ee59e345628aa20d319397be1b7 Mon Sep 17 00:00:00 2001 From: akdcl Date: Mon, 30 Sep 2013 14:55:52 +0800 Subject: [PATCH 11/15] fixed parse fixedRotation bug. --- src/dragonBones/objects/XMLDataParser.as | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dragonBones/objects/XMLDataParser.as b/src/dragonBones/objects/XMLDataParser.as index 39a0713..4151015 100644 --- a/src/dragonBones/objects/XMLDataParser.as +++ b/src/dragonBones/objects/XMLDataParser.as @@ -132,12 +132,14 @@ boneData.scaleMode = parseInt(inheritScale); } - var fixedRotation:String = boneXML.@[ConstValues.A_FIXED_ROTATION]; + var fixedRotation:String = boneXML.@[ConstValues.A_FIXED_ROTATION][0]; switch (fixedRotation) { case "0": case "false": case "no": + case "": + case null: boneData.fixedRotation = false; break; default: From bf8ccf6be33c33c5bcb8a40ae51a6d414089f319 Mon Sep 17 00:00:00 2001 From: Chenguang Liu Date: Mon, 30 Sep 2013 15:00:32 +0800 Subject: [PATCH 12/15] update version to 2.4 --- LICENSE | 20 ++++++++++++++++++++ MIT-LICENSE.txt | 20 -------------------- src/dragonBones/core/DragonBones.as | 4 ++-- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 LICENSE delete mode 100644 MIT-LICENSE.txt diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c650532 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2012-2013 DragonBones team and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt deleted file mode 100644 index 71d5be4..0000000 --- a/MIT-LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2012 The DragonBones team and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/dragonBones/core/DragonBones.as b/src/dragonBones/core/DragonBones.as index 4fc101d..9969dac 100644 --- a/src/dragonBones/core/DragonBones.as +++ b/src/dragonBones/core/DragonBones.as @@ -3,8 +3,8 @@ package dragonBones.core public final class DragonBones { public static const DATA_VERSION:String = "2.3"; - public static const VERSION:String = "2.3.1"; - public static const VERSION_NUMBER:int = 2310; + public static const VERSION:String = "2.4"; + public static const VERSION_NUMBER:int = 2400; public function DragonBones() { From 448000fecb73b12a12ad7d35a28b3e149f7a07bd Mon Sep 17 00:00:00 2001 From: Chunlei Duan Date: Wed, 23 Oct 2013 12:04:45 +0800 Subject: [PATCH 13/15] Update StarlingDisplayBridge.as Fix change display bug and change display color bug. --- src/dragonBones/display/StarlingDisplayBridge.as | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dragonBones/display/StarlingDisplayBridge.as b/src/dragonBones/display/StarlingDisplayBridge.as index f66ff90..bf077b7 100644 --- a/src/dragonBones/display/StarlingDisplayBridge.as +++ b/src/dragonBones/display/StarlingDisplayBridge.as @@ -40,6 +40,7 @@ } public function set display(value:Object):void { + /* if (_display is Image && value is Image) { var from:Image = _display as Image; @@ -63,6 +64,7 @@ from.readjustSize(); return; } + */ if (_display == value) { @@ -78,6 +80,7 @@ } removeDisplay(); } + /* else if(value is Image && !_imageBackup) { _imageBackup = value as Image; @@ -85,6 +88,7 @@ _pivotXBackup = _imageBackup.pivotX; _pivotYBackup = _imageBackup.pivotY; } + */ _display = value; addDisplay(parent, index); } @@ -198,4 +202,4 @@ } } } -} \ No newline at end of file +} From 4655e908e34ad4b97569fae2d4c4607cd3723f89 Mon Sep 17 00:00:00 2001 From: Chenguang Liu Date: Wed, 4 Dec 2013 16:05:57 +0800 Subject: [PATCH 14/15] update version to 2.4.1 --- src/dragonBones/core/DragonBones.as | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dragonBones/core/DragonBones.as b/src/dragonBones/core/DragonBones.as index 9969dac..54dc52e 100644 --- a/src/dragonBones/core/DragonBones.as +++ b/src/dragonBones/core/DragonBones.as @@ -3,8 +3,8 @@ package dragonBones.core public final class DragonBones { public static const DATA_VERSION:String = "2.3"; - public static const VERSION:String = "2.4"; - public static const VERSION_NUMBER:int = 2400; + public static const VERSION:String = "2.4.1"; + public static const VERSION_NUMBER:int = 2410; public function DragonBones() { From 3edd4bb593336eb79efbc9de361395b48bbf8a2a Mon Sep 17 00:00:00 2001 From: Chenguang Liu Date: Wed, 4 Dec 2013 16:36:04 +0800 Subject: [PATCH 15/15] Fix bug: Child armature's animation cannot be copied. --- src/dragonBones/factorys/BaseFactory.as | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/dragonBones/factorys/BaseFactory.as b/src/dragonBones/factorys/BaseFactory.as index 003fb88..a247985 100644 --- a/src/dragonBones/factorys/BaseFactory.as +++ b/src/dragonBones/factorys/BaseFactory.as @@ -323,6 +323,12 @@ package dragonBones.factorys } } } + + var armatureDataCopy:ArmatureData = data.getArmatureData(animationName); + if(armatureDataCopy) + { + var skinDataCopy:SkinData = armatureDataCopy.getSkinData(""); + } } if(animationArmatureData) @@ -367,7 +373,21 @@ package dragonBones.factorys switch(displayData.type) { case DisplayData.ARMATURE: - childArmature = buildArmature(displayData.name, null, _currentDataName, _currentTextureAtlasName); + + if(skinDataCopy) + { + var slotDataCopy:SlotData = skinDataCopy.getSlotData(slotData.name); + if(slotDataCopy) + { + var displayDataCopy:DisplayData = slotDataCopy.displayDataList[i]; + } + } + else + { + displayDataCopy = null; + } + + childArmature = buildArmature(displayData.name, displayDataCopy?displayDataCopy.name:null, _currentDataName, _currentTextureAtlasName); if(childArmature) { helpArray[i] = childArmature;