Replacing morphshape1 fix, do not corrupt old tag on error.

This commit is contained in:
Jindra Petřík
2023-11-05 21:11:10 +01:00
parent 377c5ac458
commit 048be5cc80
@@ -4489,29 +4489,29 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
} }
newEndTag.getTimelined().removeTag(newEndTag); newEndTag.getTimelined().removeTag(newEndTag);
if (morphShape instanceof DefineMorphShapeTag) { DefineMorphShape2Tag newMorphShape = new DefineMorphShape2Tag(morphShape.getSwf());
DefineMorphShape2Tag morphShape2 = new DefineMorphShape2Tag(morphShape.getSwf()); newMorphShape.setTimelined(morphShape.getTimelined());
morphShape.getTimelined().replaceTag(morphShape, morphShape2); SWF.addTagBefore(newMorphShape, morphShape);
morphShape2.setTimelined(morphShape.getTimelined());
morphShape = morphShape2;
}
MorphShapeGenerator gen = new MorphShapeGenerator(); MorphShapeGenerator gen = new MorphShapeGenerator();
try { try {
gen.generate((DefineMorphShape2Tag) morphShape, shapeStart, shapeEnd); gen.generate(newMorphShape, shapeStart, shapeEnd);
} catch (StyleMismatchException sme) { } catch (StyleMismatchException sme) {
ViewMessages.showMessageDialog(this, AppStrings.translate("error.morphshape.incompatible"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE); newMorphShape.getTimelined().removeTag(newMorphShape);
return false;
}
SWF swf = morphShape.getSwf(); SWF swf = morphShape.getSwf();
swf.resetTimeline(); swf.resetTimeline();
refreshTree(swf); refreshTree(swf);
/*if (newTag != null) { ViewMessages.showMessageDialog(this, AppStrings.translate("error.morphshape.incompatible"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
return false;
setTagTreeSelectedNode(getCurrentTree(), newTag); }
}*/ SWF swf = newMorphShape.getSwf();
morphShape.getTimelined().removeTag(morphShape);
newMorphShape.setCharacterId(morphShape.getCharacterId());
swf.updateCharacters();
swf.resetTimeline();
refreshTree(swf);
setTagTreeSelectedNode(getCurrentTree(), newMorphShape);
swf.clearImageCache(); swf.clearImageCache();
swf.clearShapeCache(); swf.clearShapeCache();
} catch (IOException ex) { } catch (IOException ex) {