diff --git a/Assets/FlashTools/Scripts/Internal/Editor/SwfPostprocessor.cs b/Assets/FlashTools/Scripts/Internal/Editor/SwfPostprocessor.cs index 875bfa0..0a51de1 100644 --- a/Assets/FlashTools/Scripts/Internal/Editor/SwfPostprocessor.cs +++ b/Assets/FlashTools/Scripts/Internal/Editor/SwfPostprocessor.cs @@ -82,7 +82,7 @@ namespace FlashTools.Internal { Matrix4x4 parent_matrix, SwfAnimationColorTransform parent_color_transform, SwfAnimationFrameData frame) { - foreach ( var inst in dl.Instances.Values.Where(p => p.Visible) ) { + foreach ( var inst in dl.Instances.Values.Where(p => p.Visible && p.ClipDepth == 0) ) { switch ( inst.Type ) { case SwfDisplayInstanceType.Shape: var shape_def = ctx.Library.FindDefine(inst.Id); diff --git a/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContext.cs b/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContext.cs index 55c9392..b93af61 100644 --- a/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContext.cs +++ b/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContext.cs @@ -77,6 +77,7 @@ namespace FlashTools.Internal.SwfTools { public ushort Id; public ushort Depth; + public ushort ClipDepth; public bool Visible; public SwfMatrix Matrix; public SwfColorTransform ColorTransform; diff --git a/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContextExecuter.cs b/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContextExecuter.cs index 4f42d82..a05b557 100644 --- a/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContextExecuter.cs +++ b/Assets/FlashTools/Scripts/Internal/Editor/SwfTools/SwfContextExecuter.cs @@ -41,6 +41,7 @@ namespace FlashTools.Internal.SwfTools { if ( new_inst != null ) { new_inst.Id = tag.CharacterId; new_inst.Depth = tag.Depth; + new_inst.ClipDepth = 0; new_inst.Visible = true; new_inst.Matrix = tag.Matrix; new_inst.ColorTransform = tag.ColorTransform; @@ -74,14 +75,18 @@ namespace FlashTools.Internal.SwfTools { if ( new_inst != null ) { new_inst.Id = tag.CharacterId; new_inst.Depth = tag.Depth; + new_inst.ClipDepth = tag.HasClipDepth ? tag.ClipDepth : (old_inst != null ? old_inst.ClipDepth : (ushort)0); new_inst.Visible = true; - new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity ); + new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity); new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity); dl.Instances.Add(new_inst.Depth, new_inst); } } else if ( tag.Move ) { // move character SwfDisplayInstance inst; if ( dl.Instances.TryGetValue(tag.Depth, out inst) ) { + if ( tag.HasClipDepth ) { + inst.ClipDepth = tag.ClipDepth; + } if ( tag.HasMatrix ) { inst.Matrix = tag.Matrix; } @@ -118,14 +123,18 @@ namespace FlashTools.Internal.SwfTools { if ( new_inst != null ) { new_inst.Id = tag.CharacterId; new_inst.Depth = tag.Depth; - new_inst.Visible = tag.HasVisible ? tag.Visible : (old_inst != null ? old_inst.Visible : true ); - new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity ); + new_inst.ClipDepth = tag.HasClipDepth ? tag.ClipDepth : (old_inst != null ? old_inst.ClipDepth : (ushort)0); + new_inst.Visible = tag.HasVisible ? tag.Visible : (old_inst != null ? old_inst.Visible : true); + new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity); new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity); dl.Instances.Add(new_inst.Depth, new_inst); } } else if ( tag.Move ) { // move character SwfDisplayInstance inst; if ( dl.Instances.TryGetValue(tag.Depth, out inst) ) { + if ( tag.HasClipDepth ) { + inst.ClipDepth = tag.ClipDepth; + } if ( tag.HasVisible ) { inst.Visible = tag.Visible; } diff --git a/Tools/FlashExport.jsfl b/Tools/FlashExport.jsfl index c996334..4d92474 100644 --- a/Tools/FlashExport.jsfl +++ b/Tools/FlashExport.jsfl @@ -220,6 +220,7 @@ if (!Function.prototype.bind) { ftdoc.export_swf = function (document) { ft.type_assert(document, Document); + ft.trace_fmt("Export swf: {0}", document.name); document.exportSWF(ftdoc.get_swf_export_path(document)); };