Added: Simple editor - edit parameters of items inside buttons

This commit is contained in:
Jindra Petřík
2025-05-17 13:38:53 +02:00
parent 5683544d35
commit 5fecb497b4
7 changed files with 187 additions and 23 deletions
@@ -49,6 +49,7 @@ import com.jpexs.decompiler.flash.timeline.DepthState;
import com.jpexs.decompiler.flash.timeline.Frame;
import com.jpexs.decompiler.flash.timeline.Timelined;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
import com.jpexs.decompiler.flash.types.MATRIX;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@@ -187,13 +188,19 @@ public class EasySwfPanel extends JPanel {
for (int i = 0; i < depths.size(); i++) {
int depth = depths.get(i);
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
wasModified.add(ds.placeObjectTag.isModified());
wasModified.add(ds.placeObjectTag == null ? false : ds.placeObjectTag.isModified());
Matrix contMat = newMatrix.concatenate(new Matrix(fpreviousMatrices.get(i)));
ds.placeObjectTag.setMatrix(contMat.toMATRIX());
ds.placeObjectTag.setPlaceFlagHasMatrix(newMatrix != null);
ds.placeObjectTag.setModified(true);
if (timelined instanceof ButtonTag) {
ButtonTag button = (ButtonTag) timelined;
BUTTONRECORD rec = button.getButtonRecordAt(frame, depth, true);
rec.placeMatrix = contMat.toMATRIX();
} else {
ds.placeObjectTag.setMatrix(contMat.toMATRIX());
ds.placeObjectTag.setPlaceFlagHasMatrix(newMatrix != null);
ds.placeObjectTag.setModified(true);
}
}
timelined.resetTimeline();
stagePanel.repaint();
@@ -216,10 +223,16 @@ public class EasySwfPanel extends JPanel {
for (int i = 0; i < depths.size(); i++) {
int depth = depths.get(i);
DepthState ds = stagePanel.getTimelined().getTimeline().getFrame(frame).layers.get(depth);
ds.placeObjectTag.setMatrix(fpreviousMatrices.get(i));
ds.placeObjectTag.setPlaceFlagHasMatrix(fpreviousMatrices != null);
if (!wasModified.get(i)) {
ds.placeObjectTag.setModified(false);
if (timelined instanceof ButtonTag) {
ButtonTag button = (ButtonTag) timelined;
BUTTONRECORD rec = button.getButtonRecordAt(frame, depth, true);
rec.placeMatrix = fpreviousMatrices.get(i);
} else {
ds.placeObjectTag.setMatrix(fpreviousMatrices.get(i));
ds.placeObjectTag.setPlaceFlagHasMatrix(fpreviousMatrices != null);
if (ds.placeObjectTag != null && !wasModified.get(i)) {
ds.placeObjectTag.setModified(false);
}
}
}
stagePanel.getTimelined().resetTimeline();
@@ -675,7 +688,11 @@ public class EasySwfPanel extends JPanel {
if (ds == null) {
ret.add(null);
} else {
ret.add(ds.placeObjectTag);
if (ds.placeObjectTag == null) {
ret.add(ds.toPlaceObjectTag(ds.depth));
} else {
ret.add(ds.placeObjectTag);
}
}
}
return ret;
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.gui.PopupButton;
import com.jpexs.decompiler.flash.gui.RegistrationPointPosition;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.ViewMessages;
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag;
import com.jpexs.decompiler.flash.tags.converters.PlaceObjectTypeConverter;
import com.jpexs.decompiler.flash.timeline.DepthState;
@@ -1093,13 +1094,20 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
for (int i = 0; i < fdepths.size(); i++) {
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
PlaceObjectTypeTag placeObjectAfter = placeObjectsAfter.get(i);
int index = timelined.indexOfTag(placeObjectBefore);
timelined.removeTag(index);
timelined.addTag(index, placeObjectAfter);
timelined.setModified(true);
if (!(timelined instanceof ButtonTag)) {
int index = timelined.indexOfTag(placeObjectBefore);
timelined.removeTag(index);
timelined.addTag(index, placeObjectAfter);
timelined.setModified(true);
}
DepthState depthStateBefore = depthStatesBefore.get(i);
doPlaceOperation(placeObjectAfter, depthStateBefore);
if (timelined instanceof ButtonTag) {
ButtonTag button = (ButtonTag) timelined;
button.setRecordFromPlaceObject(fframe, placeObjectAfter);
}
}
timelined.resetTimeline();
@@ -1113,9 +1121,14 @@ public class InstancePropertiesPanel extends AbstractPropertiesPanel {
for (int i = 0; i < placeObjectsAfter.size(); i++) {
PlaceObjectTypeTag placeObjectAfter = placeObjectsAfter.get(i);
PlaceObjectTypeTag placeObjectBefore = placeObjectsBefore.get(i);
int index = timelined.indexOfTag(placeObjectAfter);
timelined.removeTag(index);
timelined.addTag(index, placeObjectBefore);
if (timelined instanceof ButtonTag) {
ButtonTag button = (ButtonTag) timelined;
button.setRecordFromPlaceObject(fframe, placeObjectBefore);
} else {
int index = timelined.indexOfTag(placeObjectAfter);
timelined.removeTag(index);
timelined.addTag(index, placeObjectBefore);
}
}
if (!timelinedModifiedBefore) {
timelined.setModified(false);
@@ -5394,7 +5394,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
} else {
depthStateUnderCursor = null;
}
if (showObjectsUnderCursor && autoPlayed) {
boolean first = true;
for (int i = renderContext.stateUnderCursor.size() - 1; i >= 0; i--) {