diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java index 93d50de11..b1d0ad12d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/PathExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.shape; import com.jpexs.decompiler.flash.exporters.commonshape.Matrix; @@ -129,6 +130,5 @@ public class PathExporter extends ShapeExporterBase { protected void finalizePath() { paths.add(path); path = new GeneralPath(GeneralPath.WIND_EVEN_ODD); //For correct intersections display - } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index ce0804b00..d127b96bf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -31,6 +31,7 @@ import com.jpexs.decompiler.flash.tags.base.ContainerItem; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; import com.jpexs.decompiler.flash.timeline.DepthState; +import com.jpexs.decompiler.flash.timeline.Frame; import com.jpexs.decompiler.flash.timeline.Timeline; import com.jpexs.decompiler.flash.timeline.Timelined; import com.jpexs.decompiler.flash.types.BasicType; @@ -313,6 +314,18 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable public int getNumFrames() { return frameCount; } + + private int getRealFrameCount() { + int cnt = 1; + List frames = getTimeline().getFrames(); + for (int i = 1; i < frames.size(); i++) { + if (frames.get(i).layersChanged) { + cnt++; + } + } + + return cnt; + } @Override public boolean isSingleFrame() { @@ -324,7 +337,7 @@ public class DefineSpriteTag extends CharacterTag implements Container, Drawable private synchronized void initialiteIsSingleFrame() { if (!isSingleFrameInitialized) { - if (frameCount > 1) { + if (getRealFrameCount() > 1) { isSingleFrameInitialized = true; return; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java index 02bb07b15..7c1e496b5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java @@ -42,6 +42,7 @@ public class Frame implements TreeItem { public List actions = new ArrayList<>(); public List innerTags = new ArrayList<>(); public ShowFrameTag showFrameTag = null; // can be null for the last frame + public boolean layersChanged; public Frame(Timeline timeline, int frame) { this.timeline = timeline; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index d57c2e18b..889d7ae04 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -153,6 +153,7 @@ public class Timeline { private void initialize() { int frameIdx = 0; Frame frame = new Frame(this, frameIdx++); + frame.layersChanged = true; boolean tagAdded = false; for (Tag t : tags) { tagAdded = true; @@ -171,6 +172,7 @@ public class Timeline { if (!frame.layers.containsKey(depth)) { frame.layers.put(depth, new DepthState(swf, frame)); } + frame.layersChanged = true; DepthState fl = frame.layers.get(depth); int characterId = po.getCharacterId(); if (characterId != -1) { @@ -229,6 +231,7 @@ public class Timeline { RemoveTag r = (RemoveTag) t; int depth = r.getDepth(); frame.layers.remove(depth); + frame.layersChanged = true; } else if (t instanceof DoActionTag) { frame.actions.add((DoActionTag) t); actionFrames.put((DoActionTag) t, frame.frame);