mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 13:40:46 +00:00
removing frame fixed
This commit is contained in:
@@ -1052,7 +1052,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static List<TreeNode> createASTagList(List<? extends ContainerItem> list, Tag parent) {
|
||||
public static List<TreeNode> createASTagList(List<? extends ContainerItem> list, Timelined parent) {
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
int frame = 1;
|
||||
List<TreeNode> frames = new ArrayList<>();
|
||||
@@ -1093,8 +1093,8 @@ public final class SWF implements TreeItem, Timelined {
|
||||
ContainerNode tti = new ContainerNode(t);
|
||||
List<ContainerItem> subItems = ((Container) t).getSubItems();
|
||||
|
||||
Tag tag = t instanceof Tag ? (Tag) t : null;
|
||||
tti.subNodes = createASTagList(subItems, tag);
|
||||
Timelined timelined = t instanceof Timelined ? (Timelined) t : null;
|
||||
tti.subNodes = createASTagList(subItems, timelined);
|
||||
addNode = tti;
|
||||
//ret.add(tti);
|
||||
}
|
||||
@@ -2945,7 +2945,7 @@ public final class SWF implements TreeItem, Timelined {
|
||||
tags.remove(t);
|
||||
timelined.resetTimeline();
|
||||
} else {
|
||||
// timeline shuold be always the swf here
|
||||
// timeline should be always the swf here
|
||||
if (removeDependencies) {
|
||||
removeTagWithDependenciesFromTimeline(t, timelined.getTimeline());
|
||||
} else {
|
||||
|
||||
@@ -1242,11 +1242,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
if (!fn.scriptsNode) {
|
||||
|
||||
FrameNodeItem fni = (FrameNodeItem) d.getItem();
|
||||
Tag par = fni.getParent();
|
||||
Timelined parent = fni.getParent();
|
||||
int frame = fni.getFrame() - 1; //Fix to zero based
|
||||
int parentId = 0;
|
||||
if (par != null) {
|
||||
parentId = ((CharacterTag) par).getCharacterId();
|
||||
if (parent instanceof CharacterTag) {
|
||||
parentId = ((CharacterTag) parent).getCharacterId();
|
||||
}
|
||||
if (!frames.containsKey(parentId)) {
|
||||
frames.put(parentId, new ArrayList<Integer>());
|
||||
@@ -2252,9 +2252,14 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
if (tag instanceof Tag) {
|
||||
tagsToRemove.add((Tag) tag);
|
||||
} else if (tag instanceof FrameNodeItem) {
|
||||
FrameNodeItem frame = (FrameNodeItem) tag;
|
||||
// todo: honfika: remove frame
|
||||
//tagsToRemove.add(frame.getShowFrameTag());
|
||||
FrameNodeItem frameNode = (FrameNodeItem) tag;
|
||||
Frame frame = frameNode.getParent().getTimeline().frames.get(frameNode.getFrame() - 1);
|
||||
if (frame.showFrameTag != null) {
|
||||
tagsToRemove.add(frame.showFrameTag);
|
||||
} else {
|
||||
// this should be the last frame, so remove the inner tags
|
||||
tagsToRemove.addAll(frame.innerTags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
if (tagObj instanceof FrameNodeItem) {
|
||||
FrameNodeItem fn = (FrameNodeItem) tagObj;
|
||||
swf = fn.getSwf();
|
||||
if (fn.getParent() == null) {
|
||||
if (fn.getParent() == swf) {
|
||||
for (Tag t : swf.tags) {
|
||||
if (t instanceof SetBackgroundColorTag) {
|
||||
backgroundColor = ((SetBackgroundColorTag) t).backgroundColor.toColor();
|
||||
@@ -530,15 +530,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
|
||||
if (tagObj instanceof FrameNodeItem) {
|
||||
FrameNodeItem fn = (FrameNodeItem) tagObj;
|
||||
Tag parent = fn.getParent();
|
||||
List<ContainerItem> subs = new ArrayList<>();
|
||||
if (parent == null) {
|
||||
subs.addAll(swf.tags);
|
||||
} else {
|
||||
if (parent instanceof Container) {
|
||||
subs = ((Container) parent).getSubItems();
|
||||
}
|
||||
}
|
||||
Timelined parent = fn.getParent();
|
||||
List<Tag> subs = parent.getTimeline().tags;
|
||||
List<Integer> doneCharacters = new ArrayList<>();
|
||||
int frameCnt = 1;
|
||||
for (ContainerItem item : subs) {
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TagTreeModel implements TreeModel {
|
||||
private SWFNode createSwfNode(SWF swf) {
|
||||
ClassesListTreeModel classTreeModel = new ClassesListTreeModel(swf);
|
||||
SWFNode swfNode = new SWFNode(swf, swf.getShortFileName());
|
||||
swfNode.list = createTagList(swf.tags, null, swf, swfNode, classTreeModel);
|
||||
swfNode.list = createTagList(swf.tags, swf, swfNode, classTreeModel);
|
||||
swfToSwfNode.put(swf, swfNode);
|
||||
return swfNode;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class TagTreeModel implements TreeModel {
|
||||
return mainFrame.translate(key);
|
||||
}
|
||||
|
||||
private List<TreeNode> createTagList(List<Tag> list, Tag parent, SWF swf, SWFNode swfNode, ClassesListTreeModel classTreeModel) {
|
||||
private List<TreeNode> createTagList(List<Tag> list, SWF swf, SWFNode swfNode, ClassesListTreeModel classTreeModel) {
|
||||
boolean hasAbc = swf.abcList != null && !swf.abcList.isEmpty();
|
||||
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
@@ -179,7 +179,7 @@ public class TagTreeModel implements TreeModel {
|
||||
|
||||
Timeline timeline = swf.getTimeline();
|
||||
for (int i = 0; i < timeline.getFrameCount(); i++) {
|
||||
frames.add(new FrameNode(new FrameNodeItem(swf, i + 1, parent, true), timeline.frames.get(i).innerTags, false));
|
||||
frames.add(new FrameNode(new FrameNodeItem(swf, i + 1, swf, true), timeline.frames.get(i).innerTags, false));
|
||||
}
|
||||
|
||||
for (int i = 0; i < sounds.size(); i++) {
|
||||
@@ -193,8 +193,8 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
|
||||
for (TreeNode n : sprites) {
|
||||
Tag tag = n.getItem() instanceof Tag ? (Tag) n.getItem() : null;
|
||||
n.subNodes = createSubTagList(((DefineSpriteTag) n.getItem()).subTags, tag, swf, actionScriptTags);
|
||||
Timelined timelined = n.getItem() instanceof Timelined ? (Timelined) n.getItem() : null;
|
||||
n.subNodes = createSubTagList(((DefineSpriteTag) n.getItem()).subTags, timelined, swf, actionScriptTags);
|
||||
}
|
||||
|
||||
StringNode textsNode = new StringNode(new StringItem(translate("node.texts"), FOLDER_TEXTS, swf));
|
||||
@@ -286,7 +286,7 @@ public class TagTreeModel implements TreeModel {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private List<TreeNode> createSubTagList(List<Tag> list, Tag parent, SWF swf, List<Tag> actionScriptTags) {
|
||||
private List<TreeNode> createSubTagList(List<Tag> list, Timelined parent, SWF swf, List<Tag> actionScriptTags) {
|
||||
List<TreeNode> ret = new ArrayList<>();
|
||||
List<TreeNode> frames = new ArrayList<>();
|
||||
List<TreeNode> others = new ArrayList<>();
|
||||
@@ -304,11 +304,9 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
}
|
||||
|
||||
if (parent instanceof Timelined) {
|
||||
Timeline timeline = ((Timelined) parent).getTimeline();
|
||||
for (int i = 0; i < timeline.getFrameCount(); i++) {
|
||||
frames.add(new FrameNode(new FrameNodeItem(swf, i + 1, parent, true), timeline.frames.get(i).innerTags, false));
|
||||
}
|
||||
Timeline timeline = ((Timelined) parent).getTimeline();
|
||||
for (int i = 0; i < timeline.getFrameCount(); i++) {
|
||||
frames.add(new FrameNode(new FrameNodeItem(swf, i + 1, parent, true), timeline.frames.get(i).innerTags, false));
|
||||
}
|
||||
|
||||
ret.addAll(frames);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.timeline;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.DoActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
@@ -37,6 +38,7 @@ public class Frame {
|
||||
public List<Integer> sounds = new ArrayList<>();
|
||||
public List<String> soundClasses = new ArrayList<>();
|
||||
public List<Tag> innerTags = new ArrayList<>();
|
||||
public ShowFrameTag showFrameTag = null; // can be null for the last frame
|
||||
|
||||
public Frame(Timeline timeline) {
|
||||
this.timeline = timeline;
|
||||
|
||||
@@ -178,6 +178,7 @@ public class Timeline {
|
||||
tagAdded = true;
|
||||
}
|
||||
if (t instanceof ShowFrameTag) {
|
||||
frame.showFrameTag = (ShowFrameTag) t;
|
||||
frames.add(frame);
|
||||
frame = new Frame(frame);
|
||||
tagAdded = false;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.treeitems;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,10 +27,10 @@ public class FrameNodeItem implements TreeItem {
|
||||
|
||||
private final SWF swf;
|
||||
private final int frame;
|
||||
private final Tag parent;
|
||||
private final Timelined parent;
|
||||
private final boolean display;
|
||||
|
||||
public FrameNodeItem(SWF swf, int frame, Tag parent, boolean display) {
|
||||
public FrameNodeItem(SWF swf, int frame, Timelined parent, boolean display) {
|
||||
|
||||
this.swf = swf;
|
||||
this.frame = frame;
|
||||
@@ -56,7 +56,7 @@ public class FrameNodeItem implements TreeItem {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public Tag getParent() {
|
||||
public Timelined getParent() {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user