Fixed Copy/Move with dependencies order of tags

BUTTONRECORD/CLIPACTIONRECORD swf / tag set
This commit is contained in:
Jindra Petřík
2022-11-14 10:04:55 +01:00
parent d0936e1a46
commit 968fd92cd2
8 changed files with 80 additions and 23 deletions
@@ -37,6 +37,7 @@ import com.jpexs.decompiler.flash.types.ARGB;
import com.jpexs.decompiler.flash.types.BasicType;
import com.jpexs.decompiler.flash.types.CLIPACTIONRECORD;
import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.HasSwfAndTag;
import com.jpexs.decompiler.flash.types.RGB;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
@@ -1228,6 +1229,9 @@ public class GenericTagTreePanel extends GenericTagPanel {
ASMSource asv = (ASMSource) v;
asv.setSourceTag(editedTag);
}
if (v instanceof HasSwfAndTag) {
((HasSwfAndTag) obj).setSwfAndTag(editedTag.getSwf(), editedTag);
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
//ignore
}
@@ -1259,6 +1263,10 @@ public class GenericTagTreePanel extends GenericTagPanel {
if ((obj instanceof CLIPACTIONS) && (v instanceof CLIPACTIONRECORD)) {
((CLIPACTIONRECORD) v).setParentClipActions((CLIPACTIONS) obj);
}
if (obj instanceof HasSwfAndTag) {
((HasSwfAndTag) obj).setSwfAndTag(editedTag.getSwf(), editedTag);
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
//ignore
@@ -2686,20 +2686,13 @@ public class TagTreeContextMenu extends JPopupMenu {
Set<Integer> needed = new LinkedHashSet<>();
Tag tag = (Tag) item;
tag.getNeededCharactersDeep(needed);
List<Integer> neededList = new ArrayList<>();
if (tag instanceof CharacterTag) {
needed.add(((CharacterTag) tag).getCharacterId());
}
for (Integer characterId : needed) {
neededList.add(characterId);
}
// first add dependencies in reverse order
for (int n = neededList.size() - 1; n >= 0; n--) {
int characterId = neededList.get(n);
CharacterTag neededTag = sourceSwf.getCharacter(characterId);
if (!newItems.contains(neededTag)) {
newItems.add(neededTag);
}
newItems.add(neededTag);
}
newItems.add(item);
}
return newItems;
}