[Editor] Add Tile Sets list to project structure sidebar
This commit is contained in:
@@ -49,6 +49,10 @@ class MainView : View("BASE Game Editor") {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
left = projectStructureView.root
|
left = drawer(multiselect = true) {
|
||||||
|
item("Project Structure", expanded = true) {
|
||||||
|
this += projectStructureView
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.bartlomiejpluta.base.editor.main.view
|
package com.bartlomiejpluta.base.editor.main.view
|
||||||
|
|
||||||
|
import com.bartlomiejpluta.base.editor.asset.model.Asset
|
||||||
import com.bartlomiejpluta.base.editor.main.controller.MainController
|
import com.bartlomiejpluta.base.editor.main.controller.MainController
|
||||||
import com.bartlomiejpluta.base.editor.map.asset.GameMapAsset
|
import com.bartlomiejpluta.base.editor.map.asset.GameMapAsset
|
||||||
import com.bartlomiejpluta.base.editor.project.context.ProjectContext
|
import com.bartlomiejpluta.base.editor.project.context.ProjectContext
|
||||||
|
import com.bartlomiejpluta.base.editor.tileset.asset.TileSetAsset
|
||||||
import javafx.beans.binding.Bindings
|
import javafx.beans.binding.Bindings
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
import javafx.collections.ObservableList
|
import javafx.collections.ObservableList
|
||||||
import javafx.scene.control.TreeItem
|
import javafx.scene.control.TreeItem
|
||||||
import javafx.scene.input.MouseEvent
|
|
||||||
import org.kordamp.ikonli.javafx.FontIcon
|
import org.kordamp.ikonli.javafx.FontIcon
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
|
|
||||||
@@ -17,14 +18,19 @@ class ProjectStructureView : View() {
|
|||||||
private val mainController: MainController by di()
|
private val mainController: MainController by di()
|
||||||
|
|
||||||
private val structureMaps = StructureCategory("Maps")
|
private val structureMaps = StructureCategory("Maps")
|
||||||
|
private val structureTileSets = StructureCategory("Tile Sets")
|
||||||
|
|
||||||
private val structureRoot = StructureCategory(name = "Project", items = observableListOf(structureMaps))
|
private val structureRoot = StructureCategory(name = "Project", items = observableListOf(
|
||||||
|
structureMaps,
|
||||||
|
structureTileSets
|
||||||
|
))
|
||||||
|
|
||||||
init {
|
init {
|
||||||
projectContext.projectProperty.addListener { _, _, project ->
|
projectContext.projectProperty.addListener { _, _, project ->
|
||||||
project?.let {
|
project?.let {
|
||||||
structureRoot.nameProperty.bind(it.nameProperty)
|
structureRoot.nameProperty.bind(it.nameProperty)
|
||||||
Bindings.bindContent(structureMaps.items, project.maps)
|
Bindings.bindContent(structureMaps.items, it.maps)
|
||||||
|
Bindings.bindContent(structureTileSets.items, it.tileSets)
|
||||||
root.root.expandAll()
|
root.root.expandAll()
|
||||||
root.refresh()
|
root.refresh()
|
||||||
}
|
}
|
||||||
@@ -39,12 +45,13 @@ class ProjectStructureView : View() {
|
|||||||
structureRoot -> FontIcon("fa-cog")
|
structureRoot -> FontIcon("fa-cog")
|
||||||
is StructureCategory -> FontIcon("fa-folder")
|
is StructureCategory -> FontIcon("fa-folder")
|
||||||
is GameMapAsset -> FontIcon("fa-map")
|
is GameMapAsset -> FontIcon("fa-map")
|
||||||
|
is TileSetAsset -> FontIcon("fa-th")
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
text = when (it) {
|
text = when (it) {
|
||||||
is StructureCategory -> it.name
|
is StructureCategory -> it.name
|
||||||
is GameMapAsset -> it.name
|
is Asset -> it.name
|
||||||
else -> throw IllegalStateException("Unsupported structure item type")
|
else -> throw IllegalStateException("Unsupported structure item type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user