mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-11 16:08:17 +00:00
Not allow set position to inside DefineSprite for sprites which cannot be there
Fixed selecting wrong timeline on set position Correctly set timelined of positioned tag
This commit is contained in:
@@ -3655,8 +3655,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
//}
|
||||
}
|
||||
} else if ((treeItem instanceof PlaceObjectTypeTag)) {// && (previewPanel != dumpPreviewPanel)) {
|
||||
//TreePath path = tagTree.getModel().getTreePath(treeItem);
|
||||
//Frame frame = (Frame) path.getParentPath().getLastPathComponent();
|
||||
previewPanel.showPlaceTagPanel((PlaceObjectTypeTag) treeItem, frame);
|
||||
} else if (treeItem instanceof MetadataTag) {
|
||||
MetadataTag metadataTag = (MetadataTag) treeItem;
|
||||
|
||||
@@ -96,6 +96,7 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
|
||||
private Tag selectedTag = null;
|
||||
private Timelined selectedTimelined = null;
|
||||
private boolean allowInsideSprites;
|
||||
|
||||
private static class MyTreeNode implements TreeNode {
|
||||
|
||||
@@ -216,7 +217,9 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
frameNode.addChild(node);
|
||||
|
||||
if (t instanceof DefineSpriteTag) {
|
||||
populateNodes(node, (DefineSpriteTag) t, 1);
|
||||
if (allowInsideSprites) {
|
||||
populateNodes(node, (DefineSpriteTag) t, 1);
|
||||
}
|
||||
}
|
||||
if (t instanceof ShowFrameTag) {
|
||||
f++;
|
||||
@@ -259,8 +262,8 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public SelectTagPositionDialog(Window parent, SWF swf) {
|
||||
this(parent, swf, null, null);
|
||||
public SelectTagPositionDialog(Window parent, SWF swf, boolean allowInsideSprites) {
|
||||
this(parent, swf, null, null, allowInsideSprites);
|
||||
}
|
||||
|
||||
private static class PositionTreeCellRenderer extends DefaultTreeCellRenderer {
|
||||
@@ -342,11 +345,12 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
|
||||
}
|
||||
|
||||
public SelectTagPositionDialog(Window parent, SWF swf, Tag selectedTag, Timelined selectedTimelined) {
|
||||
public SelectTagPositionDialog(Window parent, SWF swf, Tag selectedTag, Timelined selectedTimelined, boolean allowInsideSprites) {
|
||||
super(parent);
|
||||
this.swf = swf;
|
||||
this.selectedTag = selectedTag;
|
||||
this.selectedTimelined = selectedTimelined;
|
||||
this.allowInsideSprites = allowInsideSprites;
|
||||
setTitle(translate("dialog.title"));
|
||||
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
Container cnt = getContentPane();
|
||||
@@ -461,7 +465,7 @@ public class SelectTagPositionDialog extends AppDialog {
|
||||
|
||||
private Timelined getCurrentSelectedTimelined() {
|
||||
TreePath path = positionTree.getSelectionPath();
|
||||
for (int i = path.getPathCount() - 1; i >= 0; i--) {
|
||||
for (int i = path.getPathCount() - 1 - 1 /*sprite can be last, use its parent*/; i >= 0; i--) {
|
||||
MyTreeNode node = (MyTreeNode) path.getPathComponent(i);
|
||||
if ("root".equals(node.getData())) {
|
||||
return swf;
|
||||
|
||||
@@ -44,14 +44,23 @@ import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoABC2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DoActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.EndTag;
|
||||
import com.jpexs.decompiler.flash.tags.ExportAssetsTag;
|
||||
import com.jpexs.decompiler.flash.tags.FrameLabelTag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObject4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.PlaceObjectTag;
|
||||
import com.jpexs.decompiler.flash.tags.RemoveObject2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.RemoveObjectTag;
|
||||
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamBlockTag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamHead2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.SoundStreamHeadTag;
|
||||
import com.jpexs.decompiler.flash.tags.StartSoundTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.UnknownTag;
|
||||
import com.jpexs.decompiler.flash.tags.VideoFrameTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
@@ -1841,7 +1850,26 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
return;
|
||||
}
|
||||
|
||||
SelectTagPositionDialog dialog = new SelectTagPositionDialog(Main.getDefaultDialogsOwner(), t.getSwf(), t, timelined);
|
||||
boolean allowedInsideSprite = false;
|
||||
switch(t.getId()){
|
||||
case ShowFrameTag.ID:
|
||||
case PlaceObjectTag.ID:
|
||||
case PlaceObject2Tag.ID:
|
||||
case PlaceObject3Tag.ID:
|
||||
case PlaceObject4Tag.ID:
|
||||
case RemoveObjectTag.ID:
|
||||
case RemoveObject2Tag.ID:
|
||||
case StartSoundTag.ID:
|
||||
case FrameLabelTag.ID:
|
||||
case SoundStreamHeadTag.ID:
|
||||
case SoundStreamHead2Tag.ID:
|
||||
case SoundStreamBlockTag.ID:
|
||||
case VideoFrameTag.ID:
|
||||
case EndTag.ID:
|
||||
allowedInsideSprite = true;
|
||||
}
|
||||
|
||||
SelectTagPositionDialog dialog = new SelectTagPositionDialog(Main.getDefaultDialogsOwner(), t.getSwf(), t, timelined, allowedInsideSprite);
|
||||
if (dialog.showDialog() == AppDialog.OK_OPTION){
|
||||
Tag selectedTag = dialog.getSelectedTag();
|
||||
Timelined selectedTimelined = dialog.getSelectedTimelined();
|
||||
@@ -1855,6 +1883,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
} else {
|
||||
selectedTimelined.addTag(selectedTimelined.indexOfTag(selectedTag), t);
|
||||
}
|
||||
t.setTimelined(selectedTimelined);
|
||||
timelined.resetTimeline();
|
||||
if (timelined != selectedTimelined) {
|
||||
selectedTimelined.resetTimeline();
|
||||
|
||||
Reference in New Issue
Block a user