From 03f1866f92d044facf8d70879677303c31ff7207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 14 Nov 2022 23:09:43 +0100 Subject: [PATCH] Fixed Clearing shape export cache on changes --- CHANGELOG.md | 1 + libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java | 8 ++++++++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 4 ++++ src/com/jpexs/decompiler/flash/gui/PreviewPanel.java | 1 + .../decompiler/flash/gui/tagtree/TagTreeContextMenu.java | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d20eb688..25ea00bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ### Fixed - [#1869] Replace references now replaces all references, not just PlaceObject - Handle StartSound tag as CharacterIdTag +- Clearing shape export cache on changes ## [16.3.1] - 2022-11-14 ### Fixed 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 19160b507..09cef9b6a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2748,6 +2748,10 @@ public final class SWF implements SWFContainerItem, Timelined { } } } + + public void clearShapeCache() { + shapeExportDataCache.clear(); + } public void clearSoundCache() { soundCache.clear(); @@ -2792,6 +2796,7 @@ public final class SWF implements SWFContainerItem, Timelined { cyclicCharacters = null; clearReadOnlyListCache(); clearImageCache(); + clearShapeCache(); clearScriptCache(); clearAbcListCache(); clearAllStaticCache(); @@ -3171,6 +3176,7 @@ public final class SWF implements SWFContainerItem, Timelined { updateCharacters(); clearImageCache(); + clearShapeCache(); } @Override @@ -3193,6 +3199,7 @@ public final class SWF implements SWFContainerItem, Timelined { resetTimelines(timelined); updateCharacters(); clearImageCache(); + clearShapeCache(); } private void removeTagInternal(Timelined timelined, Tag tag, boolean removeDependencies) { @@ -3376,6 +3383,7 @@ public final class SWF implements SWFContainerItem, Timelined { assignExportNamesToSymbols(); assignClassesToSymbols(); clearImageCache(); + clearShapeCache(); updateCharacters(); computeDependentCharacters(); computeDependentFrames(); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 10a079d5f..cf1e124ae 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -3616,6 +3616,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se setTagTreeSelectedNode(getCurrentTree(), newTag); } swf.clearImageCache(); + swf.clearShapeCache(); } catch (IOException ex) { logger.log(Level.SEVERE, "Invalid image", ex); ViewMessages.showMessageDialog(this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); @@ -3644,6 +3645,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } swf.clearImageCache(); + swf.clearShapeCache(); } catch (IOException ex) { logger.log(Level.SEVERE, "Invalid image", ex); ViewMessages.showMessageDialog(MainPanel.this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); @@ -3699,6 +3701,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } swf.clearImageCache(); + swf.clearShapeCache(); } catch (IOException ex) { logger.log(Level.SEVERE, "Invalid image", ex); ViewMessages.showMessageDialog(this, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); @@ -3729,6 +3732,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se new ImageImporter().importImageAlpha(it, data); SWF swf = it.getSwf(); swf.clearImageCache(); + swf.clearShapeCache(); } catch (IOException ex) { logger.log(Level.SEVERE, "Invalid alpha channel data", ex); ViewMessages.showMessageDialog(this, translate("error.image.alpha.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE); diff --git a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java index 6bc66fc11..a4843ea59 100644 --- a/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PreviewPanel.java @@ -943,6 +943,7 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel Tag tag = genericTagPanel.getTag(); SWF swf = tag.getSwf(); swf.clearImageCache(); + swf.clearShapeCache(); swf.updateCharacters(); tag.getTimelined().resetTimeline(); swf.assignClassesToSymbols(); diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index 13d210a1b..2be28390f 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -1384,6 +1384,8 @@ public class TagTreeContextMenu extends JPopupMenu { targetSwf.assignClassesToSymbols(); sourceSwf.clearImageCache(); targetSwf.clearImageCache(); + sourceSwf.clearShapeCache(); + targetSwf.clearShapeCache(); sourceSwf.updateCharacters(); targetSwf.updateCharacters(); sourceSwf.resetTimelines(sourceSwf); @@ -1476,6 +1478,7 @@ public class TagTreeContextMenu extends JPopupMenu { swf.assignExportNamesToSymbols(); swf.assignClassesToSymbols(); swf.clearImageCache(); + swf.clearShapeCache(); swf.updateCharacters(); swf.computeDependentCharacters(); swf.computeDependentFrames(); @@ -2446,6 +2449,7 @@ public class TagTreeContextMenu extends JPopupMenu { swf.assignExportNamesToSymbols(); swf.assignClassesToSymbols(); swf.clearImageCache(); + swf.clearShapeCache(); swf.updateCharacters(); mainPanel.refreshTree(swf); } @@ -2926,6 +2930,7 @@ public class TagTreeContextMenu extends JPopupMenu { sourceSwf.assignExportNamesToSymbols(); sourceSwf.assignClassesToSymbols(); sourceSwf.clearImageCache(); + sourceSwf.clearShapeCache(); sourceSwf.updateCharacters(); sourceSwf.resetTimelines(sourceSwf); } @@ -2933,6 +2938,7 @@ public class TagTreeContextMenu extends JPopupMenu { targetSwf.assignExportNamesToSymbols(); targetSwf.assignClassesToSymbols(); targetSwf.clearImageCache(); + targetSwf.clearShapeCache(); targetSwf.updateCharacters(); targetSwf.resetTimelines(targetSwf);