Added Replacing morphshapes (currently only same shape for start/end)

Fixed miterLimitFactor is FIXED8 value in MORPHLINESTYLE2
This commit is contained in:
Jindra Petřík
2023-11-05 21:11:10 +01:00
parent 194e358740
commit 247b1c17a4
27 changed files with 506 additions and 87 deletions
+5 -1
View File
@@ -826,7 +826,11 @@ public class Main {
statusTimer.schedule(new TimerTask() {
@Override
public void run() {
if (mainFrame != null && mainFrame.getPanel().getStatusPanel().isStatusHidden()) {
if (mainFrame == null) {
return;
}
MainFrameStatusPanel sp = mainFrame.getPanel().getStatusPanel();
if (sp != null && sp.isStatusHidden()) {
long nowTime = System.currentTimeMillis();
if (nowTime > lastTimeStartWork + 5000) {
mainFrame.getPanel().showOldStatus();
@@ -4441,6 +4441,12 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
if (ti0 instanceof ShapeTag) {
file = showImportFileChooser("filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg", true);
}
if (ti0 instanceof MorphShapeTag) {
if (ViewMessages.showConfirmDialog(this, AppStrings.translate("warning.replace.morphshape"), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, JOptionPane.WARNING_MESSAGE, Configuration.warningReplaceMorphShape, JOptionPane.OK_OPTION) != JOptionPane.OK_OPTION) {
return false;
}
file = showImportFileChooser("filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg", true);
}
if (ti0 instanceof DefineVideoStreamTag) {
file = showImportFileChooser("filter.movies|*.flv", false);
}
@@ -4520,8 +4526,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
reload(true);
}
}
if (item instanceof ShapeTag) {
ShapeTag st = (ShapeTag) item;
if ((item instanceof ShapeTag) || (item instanceof MorphShapeTag)) {
Tag st = (Tag) item;
File selfile = Helper.fixDialogFile(selectedFile);
byte[] data = null;
String svgText = null;
@@ -4532,7 +4538,21 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
data = Helper.readFile(selfile.getAbsolutePath());
}
try {
Tag newTag = svgText != null ? new SvgImporter().importSvg(st, svgText) : new ShapeImporter().importImage(st, data);
Tag newTag = null;
if (st instanceof ShapeTag) {
if (svgText != null) {
newTag = new SvgImporter().importSvg((ShapeTag) st, svgText);
} else {
newTag = new ShapeImporter().importImage((ShapeTag) st, data);
}
}
if (st instanceof MorphShapeTag) {
if (svgText != null) {
newTag = new SvgImporter().importSvg((MorphShapeTag) st, svgText);
} else {
newTag = new ShapeImporter().importImage((MorphShapeTag) st, data);
}
}
SWF swf = st.getSwf();
if (newTag != null) {
refreshTree(swf);
@@ -4622,8 +4642,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return false;
}
if (item instanceof ShapeTag) {
ShapeTag st = (ShapeTag) item;
if ((item instanceof ShapeTag) || (item instanceof MorphShapeTag)) {
Tag st = (Tag) item;
String filter = "filter.images|*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg";
File selectedFile = showImportFileChooser(filter, true);
if (selectedFile != null) {
@@ -4637,7 +4657,21 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
data = Helper.readFile(selfile.getAbsolutePath());
}
try {
Tag newTag = svgText != null ? new SvgImporter().importSvg(st, svgText, false) : new ShapeImporter().importImage(st, data, 0, false);
Tag newTag = null;
if (st instanceof ShapeTag) {
if (svgText != null) {
newTag = new SvgImporter().importSvg((ShapeTag) st, svgText, false);
} else {
newTag = new ShapeImporter().importImage((ShapeTag) st, data, 0, false);
}
}
if (st instanceof MorphShapeTag) {
if (svgText != null) {
newTag = new SvgImporter().importSvg((MorphShapeTag) st, svgText, false);
} else {
newTag = new ShapeImporter().importImage((MorphShapeTag) st, data, 0, false);
}
}
SWF swf = st.getSwf();
if (newTag != null) {
refreshTree(swf);
@@ -1718,14 +1718,15 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
showSound = false;
showMovie = false;
showSprite = false;
showMorphShape = false;
}
replaceImageButton.setVisible(showImage);
replaceImageAlphaButton.setVisible(showAlpha);
replaceSpriteButton.setVisible(showSprite);
replaceShapeButton.setVisible(showShape);
replaceShapeButton.setVisible(showShape || showMorphShape);
morphShowPanel.setVisible(showMorphShape);
displayEditEditPointsButton.setVisible(showShape || showMorphShape);
replaceShapeUpdateBoundsButton.setVisible(showShape);
replaceShapeUpdateBoundsButton.setVisible(showShape || showMorphShape);
replaceSoundButton.setVisible(showSound);
replaceMovieButton.setVisible(showMovie);
prevFontsButton.setVisible(false);
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@@ -740,3 +740,6 @@ config.description.displayAs12PCodePanel = Show panel with disassembled P-code a
config.name.displayAs3PCodePanel = Show AS3 P-code panel
config.description.displayAs3PCodePanel = Show panel with disassembled P-code instructions for ActionScript 3
config.name.warning.replace.morphshape = Warn on replace morphshape
config.description.warning.replace.morphshape = Show warning on replacing morphshape about same start and end shape
@@ -730,3 +730,6 @@ config.description.displayAs12PCodePanel = Zobrazit panel s akcemi disassemblova
config.name.displayAs3PCodePanel = Zobrazit AS3 panel s P-k\u00f3dem
config.description.displayAs3PCodePanel = Zobrazit panel s instrukcemi disassemblovan\u00e9ho P-k\u00f3du pro ActionScript 3
config.name.warning.replace.morphshape = Varovat p\u0159i nahrazov\u00e1n\u00ed morphshape
config.description.warning.replace.morphshape = Zobrazovat varov\u00e1n\u00ed p\u0159i nahrazov\u00e1n\u00ed morphshape o tom, \u017ee bude startov\u00e1n\u00ed a koncov\u00fd tvar stejn\u00fd
@@ -1197,10 +1197,15 @@ tagInfo.nominalGlyphSz = Nominal glyph size
tagInfo.glyphCount = Glyph count
tagInfo.fontCount = Font count
tag.shape.create = create shape from file...
tag.image.create = create image from file...
tag.sprite.create = create sprite from GIF file...
tag.movie.create = create movie from file...
tag.sound.create = create sound from file...
tag.font.create = create font using dialog...
tag.binaryData.create = create binary data from file...
tag.shape.create = Create shape from file...
tag.image.create = Create image from file...
tag.sprite.create = Create sprite from GIF file...
tag.movie.create = Create movie from file...
tag.sound.create = Create sound from file...
tag.font.create = Create font using dialog...
tag.binaryData.create = Create binary data from file...
tag.morphshape.create = Create morphshape from shape file...
warning.replace.morphshape = In the following dialog you select a shape file.\r\n \
That shape would be set as start and also the end shape of the morphshape.\r\n\
You won't see any morphing animation until you edit start/end shape to be different.
@@ -1174,10 +1174,15 @@ tagInfo.nominalGlyphSz = Nomin\u00e1ln\u00ed velikost glyfu
tagInfo.glyphCount = Po\u010det glyf\u016f
tagInfo.fontCount = Po\u010det p\u00edsem
tag.shape.create = vytvo\u0159it tvar ze souboru...
tag.image.create = vytvo\u0159it obr\u00e1zek ze souboru...
tag.sprite.create = vytvo\u0159it sprite z GIF souboru...
tag.movie.create = vytvo\u0159it video ze souboru...
tag.sound.create = vytvo\u0159it zvuk ze souboru...
tag.font.create = vytvo\u0159it p\u00edsmo pomoc\u00ed dialogu...
tag.binaryData.create = vytvo\u0159it bin\u00e1rn\u00ed data ze souboru...
tag.shape.create = Vytvo\u0159it tvar ze souboru...
tag.image.create = Vytvo\u0159it obr\u00e1zek ze souboru...
tag.sprite.create = Vytvo\u0159it sprite z GIF souboru...
tag.movie.create = Vytvo\u0159it video ze souboru...
tag.sound.create = Vytvo\u0159it zvuk ze souboru...
tag.font.create = Vytvo\u0159it p\u00edsmo pomoc\u00ed dialogu...
tag.binaryData.create = Vytvo\u0159it bin\u00e1rn\u00ed data ze souboru...
tag.morphshape.create = Vytvo\u0159it morphshape ze souboru tvaru...
warning.replace.morphshape = V n\u00e1sleduj\u00edc\u00edm dialogu vyberete soubor s tvarem.\r\n \
Ten tvar bude nastaven jako po\u010d\u00e1te\u010dn\u00ed a tak\u00e9 koncov\u00fd tvar tohot morphshape.\r\n\
Neuvid\u00edte \u017e\u00e1dnou morfuj\u00edc\u00ed animaci do doby ne\u017e uprav\u00edte po\u010d\u00e1te\u010dn\u00ed/koncov\u00fd tvar tak, aby byly odli\u0161n\u00e9.
@@ -50,6 +50,7 @@ import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
import com.jpexs.decompiler.flash.tags.DefineBitsLossless2Tag;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.DefineFont3Tag;
import com.jpexs.decompiler.flash.tags.DefineMorphShape2Tag;
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
import com.jpexs.decompiler.flash.tags.DefineSoundTag;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
@@ -71,6 +72,7 @@ import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.ImageTag;
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
import com.jpexs.decompiler.flash.tags.base.SoundTag;
@@ -1037,7 +1039,7 @@ public class TagTreeContextMenu extends JPopupMenu {
replaceMenuItem.setVisible(true);
}
if (canReplace.test(it -> it instanceof ShapeTag)) {
if (canReplace.test(it -> (it instanceof ShapeTag) || (it instanceof MorphShapeTag))) {
replaceMenuItem.setVisible(true);
replaceNoFillMenuItem.setVisible(true);
}
@@ -1655,6 +1657,15 @@ public class TagTreeContextMenu extends JPopupMenu {
});
addTagMenu.add(createBinaryDataItem);
break;
case TagTreeModel.FOLDER_MORPHSHAPES:
addTagMenu.addSeparator();
JMenuItem createMorphShapeItem = new JMenuItem(AppStrings.translate("tag.morphshape.create"));
createMorphShapeItem.setIcon(View.getIcon("importshape16"));
createMorphShapeItem.addActionListener((ActionEvent ae) -> {
listener.call(ae, item, DefineMorphShape2Tag.class, TreeNodeType.MORPH_SHAPE);
});
addTagMenu.add(createMorphShapeItem);
break;
}
}
@@ -3812,6 +3823,7 @@ public class TagTreeContextMenu extends JPopupMenu {
remove = !mainPanel.replaceSpriteWithGif(tag);
break;
case SHAPE:
case MORPH_SHAPE:
remove = !mainPanel.replaceNoFill(tag);
break;
case FONT: