From 2a042a24f6590eb077fdd9b63c7f0574804d28f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsur=C3=B3=20Tibor?= Date: Thu, 13 Jul 2023 14:40:53 +0000 Subject: [PATCH 1/3] Fix for removed terrain in helper lines --- .../mundus/editor/ui/modules/outline/OutlineRightClickMenu.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/editor/src/main/com/mbrlabs/mundus/editor/ui/modules/outline/OutlineRightClickMenu.kt b/editor/src/main/com/mbrlabs/mundus/editor/ui/modules/outline/OutlineRightClickMenu.kt index 3e7d5623a..dbe3a8e2b 100644 --- a/editor/src/main/com/mbrlabs/mundus/editor/ui/modules/outline/OutlineRightClickMenu.kt +++ b/editor/src/main/com/mbrlabs/mundus/editor/ui/modules/outline/OutlineRightClickMenu.kt @@ -103,6 +103,7 @@ class OutlineRightClickMenu(outline: Outline) : PopupMenu() { val terrainComponent = selectedGO!!.findComponentByType(Component.Type.TERRAIN) as TerrainComponent? if (terrainComponent != null) { + projectManager.current().currScene.terrains.removeValue(terrainComponent, true) Mundus.postEvent(TerrainRemovedEvent(terrainComponent)) } } From 56b575ae224564136a70ec12577c7da7f80ab0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsur=C3=B3=20Tibor?= Date: Thu, 13 Jul 2023 14:41:27 +0000 Subject: [PATCH 2/3] Update CHANGES --- editor/CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/editor/CHANGES b/editor/CHANGES index 8d6da3fd5..3b6d8ee6e 100644 --- a/editor/CHANGES +++ b/editor/CHANGES @@ -1,5 +1,6 @@ [0.5.1] - Fix mouse picking by not rendering inactive game objects to picker +- Fix removed terrain in helper lines [0.5.0] - [Breaking Change] Lighting systems updated, visibly different. See PR#184 From 412442b44683e6aa23b100687395334d449ad093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsur=C3=B3=20Tibor?= Date: Fri, 14 Jul 2023 15:21:07 +0000 Subject: [PATCH 3/3] Fix undo method for removed terrain --- .../editor/history/commands/DeleteCommand.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/editor/src/main/com/mbrlabs/mundus/editor/history/commands/DeleteCommand.kt b/editor/src/main/com/mbrlabs/mundus/editor/history/commands/DeleteCommand.kt index 1651e7055..15bcdfb5a 100644 --- a/editor/src/main/com/mbrlabs/mundus/editor/history/commands/DeleteCommand.kt +++ b/editor/src/main/com/mbrlabs/mundus/editor/history/commands/DeleteCommand.kt @@ -19,9 +19,12 @@ import com.badlogic.gdx.scenes.scene2d.ui.Tree import com.mbrlabs.mundus.commons.scene3d.GameObject import com.mbrlabs.mundus.commons.scene3d.ModelCacheManager import com.mbrlabs.mundus.commons.scene3d.components.Component +import com.mbrlabs.mundus.commons.scene3d.components.TerrainComponent import com.mbrlabs.mundus.editor.Mundus +import com.mbrlabs.mundus.editor.core.project.ProjectManager import com.mbrlabs.mundus.editor.events.ComponentAddedEvent import com.mbrlabs.mundus.editor.events.SceneGraphChangedEvent +import com.mbrlabs.mundus.editor.events.TerrainAddedEvent import com.mbrlabs.mundus.editor.history.Command import com.mbrlabs.mundus.editor.ui.modules.outline.Outline import com.mbrlabs.mundus.editor.utils.Log @@ -38,6 +41,8 @@ class DeleteCommand(private var go: GameObject?, private var node: Outline.Outli private val TAG = DeleteCommand::class.java.simpleName } + private val projectManager: ProjectManager = Mundus.inject() + private var parentGO: GameObject? = null private var parentNode: Tree.Node? = null private var tree: Tree? = null @@ -73,9 +78,15 @@ class DeleteCommand(private var go: GameObject?, private var node: Outline.Outli // For components that utilize gizmos we should send a ComponentAddedEvent // so that GizmoManager can update as needed. - val component = go!!.findComponentByType(Component.Type.LIGHT) - if (component != null) { - Mundus.postEvent(ComponentAddedEvent(component)) + val lightComponent = go!!.findComponentByType(Component.Type.LIGHT) + if (lightComponent != null) { + Mundus.postEvent(ComponentAddedEvent(lightComponent)) + } + + val terrainComponent = go!!.findComponentByType(Component.Type.TERRAIN) as TerrainComponent? + if (terrainComponent != null) { + projectManager.current().currScene.terrains.add(terrainComponent) + Mundus.postEvent(TerrainAddedEvent(terrainComponent)) } }