Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DragonBones/src/DragonBones/armature/Slot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ protected void _UpdateDisplayData()
this._displayDirty = true;
this._transformDirty = true;
}

if (this._armature.replacedTexture != null) {
this._displayDirty = true;
}
}

/// <private/>
Expand Down
4 changes: 4 additions & 0 deletions Unity/Demos/Assets/DragonBones/Scripts/armature/Slot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ protected void _UpdateDisplayData()
this._displayDirty = true;
this._transformDirty = true;
}

if (this._armature.replacedTexture != null) {
this._displayDirty = true;
}
}

/// <private/>
Expand Down
23 changes: 22 additions & 1 deletion Unity/Demos/Assets/DragonBones/Scripts/unity/UnitySlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* 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.
*/
/**
/**
* The MIT License (MIT)
*
* Copyright (c) 2012-2017 DragonBones team and other contributors
Expand Down Expand Up @@ -78,6 +78,7 @@ public class UnitySlot : Slot
private bool _skewed;
private UnityArmatureComponent _proxy;
private BlendMode _currentBlendMode;
private static readonly int MainTex = Shader.PropertyToID("_MainTex");

/**
* @private
Expand Down Expand Up @@ -475,6 +476,26 @@ protected override void _UpdateFrame()
this._isActive = false;
if (this._displayIndex >= 0 && this._display != null && currentTextureData != null)
{
var currentTextureAtlasData = this.currentTextureAtlasData;
if (this.armature.replacedTexture != null) { // Update replaced texture atlas.
if (this.armature._replaceTextureAtlasData == null)
{
currentTextureAtlasData = BorrowObject<UnityTextureAtlasData>();
currentTextureAtlasData.CopyFrom(this.currentTextureAtlasData);
currentTextureAtlasData.texture = this.currentTextureAtlasData.texture;
currentTextureAtlasData.uiTexture = this.currentTextureAtlasData.uiTexture;
if(currentTextureAtlasData.uiTexture)
currentTextureAtlasData.uiTexture.SetTexture(MainTex, (Texture)this.armature.replacedTexture);
if(currentTextureAtlasData.texture)
currentTextureAtlasData.texture.SetTexture(MainTex, (Texture)this.armature.replacedTexture);
this.armature._replaceTextureAtlasData = currentTextureAtlasData;
}
else
currentTextureAtlasData = this.armature._replaceTextureAtlasData as UnityTextureAtlasData;

currentTextureData = currentTextureAtlasData.GetTexture(currentTextureData.name) as UnityTextureData;
}

var currentTextureAtlas = _proxy.isUGUI ? currentTextureAtlasData.uiTexture : currentTextureAtlasData.texture;
if (currentTextureAtlas != null)
{
Expand Down
23 changes: 22 additions & 1 deletion Unity/src/DragonBones/Scripts/unity/UnitySlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* 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.
*/
/**
/**
* The MIT License (MIT)
*
* Copyright (c) 2012-2017 DragonBones team and other contributors
Expand Down Expand Up @@ -78,6 +78,7 @@ public class UnitySlot : Slot
private bool _skewed;
private UnityArmatureComponent _proxy;
private BlendMode _currentBlendMode;
private static readonly int MainTex = Shader.PropertyToID("_MainTex");

/**
* @private
Expand Down Expand Up @@ -475,6 +476,26 @@ protected override void _UpdateFrame()
this._isActive = false;
if (this._displayIndex >= 0 && this._display != null && currentTextureData != null)
{
var currentTextureAtlasData = this.currentTextureAtlasData;
if (this.armature.replacedTexture != null) { // Update replaced texture atlas.
if (this.armature._replaceTextureAtlasData == null)
{
currentTextureAtlasData = BorrowObject<UnityTextureAtlasData>();
currentTextureAtlasData.CopyFrom(this.currentTextureAtlasData);
currentTextureAtlasData.texture = this.currentTextureAtlasData.texture;
currentTextureAtlasData.uiTexture = this.currentTextureAtlasData.uiTexture;
if(currentTextureAtlasData.uiTexture)
currentTextureAtlasData.uiTexture.SetTexture(MainTex, (Texture)this.armature.replacedTexture);
if(currentTextureAtlasData.texture)
currentTextureAtlasData.texture.SetTexture(MainTex, (Texture)this.armature.replacedTexture);
this.armature._replaceTextureAtlasData = currentTextureAtlasData;
}
else
currentTextureAtlasData = this.armature._replaceTextureAtlasData as UnityTextureAtlasData;

currentTextureData = currentTextureAtlasData.GetTexture(currentTextureData.name) as UnityTextureData;
}

var currentTextureAtlas = _proxy.isUGUI ? currentTextureAtlasData.uiTexture : currentTextureAtlasData.texture;
if (currentTextureAtlas != null)
{
Expand Down