Deep-Copies the CustomImageObjects from the original Object List in the GuiObjectManager to prevent the dirty check when closing the GUI from failing
This commit is contained in:
@@ -24,6 +24,20 @@ public class CustomImageObject implements GuiEntryListEntry {
|
|||||||
setLinkedAsset(assetUUID);
|
setLinkedAsset(assetUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CustomImageObject copy() throws IOException {
|
||||||
|
CustomImageObject copy = new CustomImageObject(this.name, this.getLinkedAsset());
|
||||||
|
|
||||||
|
copy.textureWidth = this.textureWidth;
|
||||||
|
copy.textureHeight = this.textureHeight;
|
||||||
|
|
||||||
|
copy.width = width;
|
||||||
|
copy.height = height;
|
||||||
|
|
||||||
|
copy.transformations = transformations;
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
@Getter @Setter private String name;
|
@Getter @Setter private String name;
|
||||||
@Getter private UUID linkedAsset;
|
@Getter private UUID linkedAsset;
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,11 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
|
|||||||
nameInput.hint = I18n.format("replaymod.gui.objects.properties.name");
|
nameInput.hint = I18n.format("replaymod.gui.objects.properties.name");
|
||||||
|
|
||||||
for(CustomImageObject customImageObject : initialObjects) {
|
for(CustomImageObject customImageObject : initialObjects) {
|
||||||
objectList.addElement(customImageObject);
|
try {
|
||||||
|
objectList.addElement(customImageObject.copy());
|
||||||
|
} catch(IOException ioe) {
|
||||||
|
ioe.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
objectList.addSelectionListener(new SelectionListener() {
|
objectList.addSelectionListener(new SelectionListener() {
|
||||||
|
|||||||
Reference in New Issue
Block a user