mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 17:09:23 +00:00
method for getting the dependent chatacter ids + translation
This commit is contained in:
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.Exportable;
|
||||
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
|
||||
import com.jpexs.decompiler.flash.tags.gfx.DefineCompactedFont;
|
||||
@@ -524,6 +525,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
originalRange = new ByteArrayRange(tagData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return modified;
|
||||
}
|
||||
@@ -548,7 +550,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
getNeededCharacters(needed2);
|
||||
|
||||
while (visited.size() != needed2.size()) {
|
||||
for (Integer characterId : needed2) {
|
||||
for (int characterId : needed2) {
|
||||
if (!visited.contains(characterId)) {
|
||||
visited.add(characterId);
|
||||
if (swf.getCharacters().containsKey(characterId)) {
|
||||
@@ -566,6 +568,21 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void getDependentCharacters(Set<Integer> dependent) {
|
||||
for (Tag tag : swf.tags) {
|
||||
if (tag instanceof CharacterTag) {
|
||||
Set<Integer> needed = new HashSet<>();
|
||||
tag.getNeededCharactersDeep(needed);
|
||||
for (int dep : dependent) {
|
||||
if (needed.contains(dep)) {
|
||||
dependent.add(((CharacterTag) tag).getCharacterId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void getTagInfo(TagInfo tagInfo) {
|
||||
|
||||
tagInfo.addInfo("general", "tagType", String.format("%s (%d)", tagName, id));
|
||||
@@ -597,5 +614,18 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
if (needed.size() > 0) {
|
||||
tagInfo.addInfo("general", "neededCharacters", Helper.joinStrings(needed, ", "));
|
||||
}
|
||||
|
||||
/* todo: add dependent characters, getDependentCharacters method is currently slow
|
||||
if (this instanceof CharacterTag) {
|
||||
Set<Integer> dependent = new LinkedHashSet<>();
|
||||
int characterId = ((CharacterTag) this).getCharacterId();
|
||||
dependent.add(characterId);
|
||||
getDependentCharacters(dependent);
|
||||
dependent.remove(characterId);
|
||||
|
||||
if (dependent.size() > 0) {
|
||||
tagInfo.addInfo("general", "dependentCharacters", Helper.joinStrings(dependent, ", "));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user