update characterids when tag was moved or copied (copy with dependencies is not ready,yet)

This commit is contained in:
2015-04-29 23:19:47 +02:00
parent 81a4c2f664
commit a6847b6562
38 changed files with 479 additions and 100 deletions
@@ -72,7 +72,7 @@ public class Timeline {
public int maxDepth;
public int fontFrameNum = -1;
public List<Tag> tags;
private final List<Frame> frames = new ArrayList<>();
@@ -124,7 +124,11 @@ public class Timeline {
return depthMaxFrame;
}
public void reset() {
public void reset(SWF swf) {
reset(swf, null, swf.tags, 0, swf.displayRect);
}
public void reset(SWF swf, Tag parentTag, List<Tag> tags, int id, RECT displayRect) {
initialized = false;
frames.clear();
depthMaxFrame.clear();
@@ -132,6 +136,13 @@ public class Timeline {
asmSourceContainers.clear();
actionFrames.clear();
otherTags.clear();
this.id = id;
this.swf = swf;
this.displayRect = displayRect;
this.frameRate = swf.frameRate;
this.timelined = parentTag == null ? swf : (Timelined) parentTag;
this.parentTag = parentTag;
this.tags = tags;
as2RootPackage = new AS2Package(null, null, swf);
}
@@ -425,6 +436,18 @@ public class Timeline {
}
}
public boolean replaceCharacter(int oldCharacterId, int newCharacterId) {
boolean modified = false;
for (int i = 0; i < tags.size(); i++) {
Tag t = tags.get(i);
if (t instanceof CharacterIdTag && ((CharacterIdTag) t).getCharacterId() == oldCharacterId) {
((CharacterIdTag) t).setCharacterId(newCharacterId);
modified = true;
}
}
return modified;
}
public boolean removeCharacter(int characterId) {
boolean modified = false;
for (int i = 0; i < tags.size(); i++) {
@@ -1,18 +1,19 @@
/*
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.timeline;
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
@@ -24,4 +25,6 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag;
public interface Timelined extends BoundedTag {
public Timeline getTimeline();
public void resetTimeline();
}