Added #1231 Button transforming

Fixed BUTTONRECORD display does not use its Matrix
Fixed Editation status not cleared after Sprite transforming
This commit is contained in:
Jindra Petřík
2022-12-20 21:08:33 +01:00
parent 9b717017ae
commit 65d0ebc87e
4 changed files with 170 additions and 105 deletions

View File

@@ -18,6 +18,9 @@ package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
import com.jpexs.decompiler.flash.tags.DefineButtonCxformTag;
import com.jpexs.decompiler.flash.tags.DefineButtonTag;
import com.jpexs.decompiler.flash.tags.PlaceObject3Tag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
import com.jpexs.decompiler.flash.treeitems.Openable;
@@ -189,4 +192,38 @@ public class BUTTONRECORD implements Serializable, TreeItem, HasSwfAndTag, HasCh
public void setCharacterId(int characterId) {
this.characterId = characterId;
}
public PlaceObject3Tag toPlaceObject() {
PlaceObject3Tag placeTag = new PlaceObject3Tag(swf);
placeTag.depth = placeDepth;
placeTag.characterId = characterId;
placeTag.placeFlagHasCharacter = true;
if (colorTransform != null) {
placeTag.colorTransform = colorTransform;
placeTag.placeFlagHasColorTransform = true;
}
ButtonTag buttonTag = getTag();
if (buttonTag instanceof DefineButtonTag) {
DefineButtonTag button1Tag = (DefineButtonTag) buttonTag;
DefineButtonCxformTag cxformTag = (DefineButtonCxformTag) button1Tag.getSwf().getCharacterIdTag(button1Tag.getCharacterId(), DefineButtonCxformTag.ID);
if (cxformTag != null) {
placeTag.colorTransform = new CXFORMWITHALPHA(cxformTag.buttonColorTransform);
placeTag.placeFlagHasColorTransform = true;
}
}
placeTag.matrix = new MATRIX(placeMatrix);
placeTag.placeFlagHasMatrix = true;
if (buttonHasBlendMode) {
placeTag.blendMode = blendMode;
placeTag.placeFlagHasBlendMode = true;
}
if (buttonHasFilterList) {
placeTag.surfaceFilterList = filterList;
placeTag.placeFlagHasFilterList = true;
}
return placeTag;
}
}