mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-25 04:45:33 +00:00
framelabels in Timeline class
This commit is contained in:
@@ -58,6 +58,9 @@ public class Frame implements TreeItem, Exportable {
|
||||
|
||||
public boolean layersChanged;
|
||||
|
||||
public String label = null;
|
||||
public boolean namedAnchor = false;
|
||||
|
||||
public Frame(Timeline timeline, int frame) {
|
||||
this.timeline = timeline;
|
||||
this.frame = frame;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.exporters.commonshape.Matrix;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
|
||||
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
|
||||
@@ -92,6 +93,8 @@ public class Timeline {
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
private Map<String, Integer> labelToFrame = new HashMap<>();
|
||||
|
||||
private void ensureInitialized() {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
@@ -221,6 +224,13 @@ public class Timeline {
|
||||
as2RootPackage = new AS2Package(null, null, swf);
|
||||
}
|
||||
|
||||
public int getFrameWithLabel(String label) {
|
||||
if (labelToFrame.containsKey(label)) {
|
||||
return labelToFrame.get(label);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
int frameIdx = 0;
|
||||
Frame frame = new Frame(this, frameIdx++);
|
||||
@@ -244,7 +254,12 @@ public class Timeline {
|
||||
}
|
||||
}
|
||||
|
||||
if (t instanceof StartSoundTag) {
|
||||
if (t instanceof FrameLabelTag) {
|
||||
newFrameNeeded = true;
|
||||
frame.label = ((FrameLabelTag) t).getLabelName();
|
||||
frame.namedAnchor = ((FrameLabelTag) t).isNamedAnchor();
|
||||
labelToFrame.put(frame.label, frames.size());
|
||||
} else if (t instanceof StartSoundTag) {
|
||||
newFrameNeeded = true;
|
||||
frame.sounds.add(((StartSoundTag) t).soundId);
|
||||
} else if (t instanceof StartSound2Tag) {
|
||||
|
||||
Reference in New Issue
Block a user