Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed terrain in helper lines fix #201

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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