diff --git a/CHANGELOG.md b/CHANGELOG.md index f70082fc8..5d8a85080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - AS3 hilight and edit XML based on CData or comment only +- [#1435] Adding DefineScalingGrid to DefineSprite ## [14.2.0] - 2021-03-12 ### Added @@ -1998,7 +1999,8 @@ All notable changes to this project will be documented in this file. ### Added - Initial public release -[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.1.0...Unreleased +[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.2.0...Unreleased +[14.2.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.1.0...version14.2.0 [14.1.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.0.1...version14.1.0 [14.0.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.0.0...version14.0.1 [14.0.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version13.0.3...version14.0.0 @@ -2107,6 +2109,7 @@ All notable changes to this project will be documented in this file. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#1435]: https://www.free-decompiler.com/flash/issues/1435 [#1645]: https://www.free-decompiler.com/flash/issues/1645 [#1639]: https://www.free-decompiler.com/flash/issues/1639 [#1371]: https://www.free-decompiler.com/flash/issues/1371 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 7b4f16780..9b88456bf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -3150,7 +3150,9 @@ public final class SWF implements SWFContainerItem, Timelined { ReadOnlyTagList tags = timelined.getTags(); int index; - if (frame != null) { + if ((tag instanceof DefineScalingGridTag) && (timelined instanceof DefineSpriteTag)) { + index = this.tags.indexOf(timelined) + 1; + } else if (frame != null) { if (frame.showFrameTag != null) { index = tags.indexOf(frame.showFrameTag); } else { @@ -3177,20 +3179,25 @@ public final class SWF implements SWFContainerItem, Timelined { } } - if (index > -1) { - timelined.addTag(index, tag); + if ((tag instanceof DefineScalingGridTag) && (timelined instanceof DefineSpriteTag)) { + DefineScalingGridTag scalingGrid = (DefineScalingGridTag) tag; + scalingGrid.characterId = ((DefineSpriteTag) timelined).spriteId; + this.addTag(index, tag); } else { - timelined.addTag(tag); - } + if (index > -1) { + timelined.addTag(index, tag); + } else { + timelined.addTag(tag); + } + timelined.resetTimeline(); - timelined.resetTimeline(); - - if (timelined instanceof DefineSpriteTag) { - DefineSpriteTag sprite = (DefineSpriteTag) timelined; - sprite.frameCount = timelined.getTimeline().getFrameCount(); - } - if (timelined == this) { - frameCount = getTimeline().getFrameCount(); + if (timelined instanceof DefineSpriteTag) { + DefineSpriteTag sprite = (DefineSpriteTag) timelined; + sprite.frameCount = timelined.getTimeline().getFrameCount(); + } + if (timelined == this) { + frameCount = getTimeline().getFrameCount(); + } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java index d238af5de..aae2c2d47 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineScalingGridTag.java @@ -209,4 +209,10 @@ public class DefineScalingGridTag extends Tag implements CharacterIdTag { targetRect[i].yMin = Math.rint(targetRect[i].yMin / SWF.unitDivisor); } } + + @Override + public String toString() { + return super.toString() + " (" + characterId + ")"; + } + } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index e405cd957..bfb89473d 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -490,12 +490,11 @@ public class TagTree extends JTree { ret = Arrays.asList(DefineBinaryDataTag.ID); break; case TagTreeModel.FOLDER_FRAMES: - // same as nested tags of DefineSpriteTag? + // same as nested tags of DefineSpriteTag but without DefineScalingGrid ret = Arrays.asList(PlaceObjectTag.ID, PlaceObject2Tag.ID, PlaceObject3Tag.ID, PlaceObject4Tag.ID, RemoveObjectTag.ID, RemoveObject2Tag.ID, ShowFrameTag.ID, FrameLabelTag.ID, StartSoundTag.ID, StartSound2Tag.ID, VideoFrameTag.ID, - SoundStreamBlockTag.ID, SoundStreamHeadTag.ID, SoundStreamHead2Tag.ID, - DefineScalingGridTag.ID); + SoundStreamBlockTag.ID, SoundStreamHeadTag.ID, SoundStreamHead2Tag.ID); break; case TagTreeModel.FOLDER_OTHERS: ret = Arrays.asList(