diff --git a/h2d-libgdx-typinglabel-extension b/h2d-libgdx-typinglabel-extension index c2690a20..345ceda9 160000 --- a/h2d-libgdx-typinglabel-extension +++ b/h2d-libgdx-typinglabel-extension @@ -1 +1 @@ -Subproject commit c2690a20e90a3c1627601c532a80a8a7e139e3cc +Subproject commit 345ceda93813d682674322e29a7d026dca57c0f2 diff --git a/hyperlap2d-runtime-libgdx b/hyperlap2d-runtime-libgdx index e6ff3a64..c01a5e40 160000 --- a/hyperlap2d-runtime-libgdx +++ b/hyperlap2d-runtime-libgdx @@ -1 +1 @@ -Subproject commit e6ff3a644f4fbc968eb3496e45be54d3283413f8 +Subproject commit c01a5e40d469b0a0ebc00146094f99334169183a diff --git a/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java b/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java index 8b765440..72746ac6 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/DeleteItemsCommand.java @@ -76,6 +76,7 @@ public class DeleteItemsCommand extends EntityModifyRevertibleCommand { public void undoAction() { Json json = HyperJson.getJson(); CompositeItemVO compositeVO = json.fromJson(CompositeItemVO.class, backup); + compositeVO.cleanIds(); Set newEntitiesList = PasteItemsCommand.createEntitiesFromVO(compositeVO); sandbox.getEngine().process(); diff --git a/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java b/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java index 7d8cc0dc..c5d49d48 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/RemoveComponentFromItemCommand.java @@ -2,7 +2,6 @@ package games.rednblack.editor.controller.commands; import com.artemis.Component; import games.rednblack.editor.HyperLap2DFacade; -import games.rednblack.editor.renderer.components.RemovableObject; import games.rednblack.editor.utils.runtime.ComponentCloner; import games.rednblack.editor.utils.runtime.SandboxComponentRetriever; import games.rednblack.h2d.common.MsgAPI; @@ -23,15 +22,12 @@ public class RemoveComponentFromItemCommand extends EntityModifyRevertibleComman Object[] payload = getNotification().getBody(); entity = (int) payload[0]; componentClass = (Class) payload[1]; - component = ComponentCloner.get(SandboxComponentRetriever.get(entity, componentClass)); + component = ComponentCloner.get(SandboxComponentRetriever.get(entity, componentClass), true); } @Override public void doAction() { collectData(); - if (component instanceof RemovableObject) { - ((RemovableObject) component).onRemove(); - } sandbox.getEngine().edit(entity).remove(component.getClass()); sandbox.getEngine().process(); diff --git a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java index 9511a8a4..a65e91cf 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/component/UpdateSensorDataCommand.java @@ -43,8 +43,6 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand { sensorComponent.rightSpanPercent = vo.rightSpanPercent; sensorComponent.topSpanPercent = vo.topSpanPercent; - sensorComponent.scheduleRefresh(); - HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } @@ -62,8 +60,6 @@ public class UpdateSensorDataCommand extends EntityModifyRevertibleCommand { sensorComponent.leftSpanPercent = backup.leftSpanPercent; sensorComponent.rightSpanPercent = backup.rightSpanPercent; sensorComponent.topSpanPercent = backup.topSpanPercent; - - sensorComponent.scheduleRefresh(); HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity); } diff --git a/src/main/java/games/rednblack/editor/utils/runtime/ComponentCloner.java b/src/main/java/games/rednblack/editor/utils/runtime/ComponentCloner.java index bcf0e2fd..ef90bc0d 100644 --- a/src/main/java/games/rednblack/editor/utils/runtime/ComponentCloner.java +++ b/src/main/java/games/rednblack/editor/utils/runtime/ComponentCloner.java @@ -32,7 +32,7 @@ import java.util.Collection; */ public class ComponentCloner { - public static E get(E source) { + public static E get(E source, boolean ignoreTransient) { Class eClass = source.getClass(); E target = null; try { @@ -42,6 +42,9 @@ public class ComponentCloner { for(int i = 0; i < targetFields.length; i++) { int modifiers = targetFields[i].getModifiers(); if(Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers) && !Modifier.isFinal(modifiers)) { + if (ignoreTransient && Modifier.isTransient(modifiers)) + continue; + targetFields[i].set(target, sourceFields[i].get(source)); } } @@ -51,6 +54,9 @@ public class ComponentCloner { return target; } + public static E get(E source) { + return get(source, false); + } public static void set(E target, E source) {