Skip to content

Commit

Permalink
Merge pull request #201 from Dgzt/removed-terrain-in-helper-lines-fix
Browse files Browse the repository at this point in the history
Removed terrain in helper lines fix
  • Loading branch information
JamesTKhan authored Jul 14, 2023
2 parents 6ca7d82 + 412442b commit e611f4c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions editor/CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Outline.OutlineNode, GameObject, Outline.NodeTable>? = null
private var tree: Tree<Outline.OutlineNode, GameObject>? = null
Expand Down Expand Up @@ -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))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down

0 comments on commit e611f4c

Please sign in to comment.