mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-03 08:04:34 +00:00
Added Checking missing needed character tags and their proper position (Marking them as red - with tooltip)
This commit is contained in:
@@ -48,6 +48,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -445,4 +446,14 @@ public class DefineSpriteTag extends DrawableTag implements Timelined {
|
||||
public RECT getRectWithStrokes() {
|
||||
return getRect(); //?
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Integer> getMissingNeededCharacters() {
|
||||
Set<Integer> ret = new LinkedHashSet<>();
|
||||
for (Tag tag : getTags()) {
|
||||
Set<Integer> sub = tag.getMissingNeededCharacters();
|
||||
ret.addAll(sub);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags;
|
||||
|
||||
import com.jpexs.decompiler.flash.ReadOnlyTagList;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
@@ -594,6 +595,37 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
}
|
||||
|
||||
public Set<Integer> getMissingNeededCharacters() {
|
||||
Set<Integer> needed = new LinkedHashSet<>();
|
||||
getNeededCharacters(needed);
|
||||
if (needed.isEmpty()) {
|
||||
return needed;
|
||||
}
|
||||
Timelined tim = getTimelined();
|
||||
ReadOnlyTagList tags = tim.getTags();
|
||||
for (int i = tags.indexOf(this) - 1; i >= -1; i--) {
|
||||
if (i == -1) {
|
||||
if (tim instanceof SWF) {
|
||||
break;
|
||||
} else {
|
||||
Timelined parent = ((Tag) tim).getTimelined();
|
||||
tags = parent.getTags();
|
||||
i = tags.indexOf((Tag) tim);
|
||||
tim = parent;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (tags.get(i) instanceof CharacterTag) {
|
||||
int charId = ((CharacterTag) tags.get(i)).getCharacterId();
|
||||
needed.remove(charId);
|
||||
if (needed.isEmpty()) {
|
||||
return needed;
|
||||
}
|
||||
}
|
||||
}
|
||||
return needed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
|
||||
|
||||
Reference in New Issue
Block a user