Merge branch 'master' of git.mosad.xyz:localhorst/TextureSync
This commit is contained in:
commit
86008828f5
@ -35,6 +35,8 @@ class RootController : Controller() {
|
|||||||
|
|
||||||
private lateinit var con: Connection
|
private lateinit var con: Connection
|
||||||
|
|
||||||
|
private lateinit var selectedTexture: Texture
|
||||||
|
|
||||||
private var lastExportDir: String = System.getProperty("user.home")
|
private var lastExportDir: String = System.getProperty("user.home")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +102,7 @@ class RootController : Controller() {
|
|||||||
println(e)
|
println(e)
|
||||||
println("[file] Connection to Server NOT successful")
|
println("[file] Connection to Server NOT successful")
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
println("[file] no address in settings file")
|
println("[file] no address in settings file")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -190,6 +192,7 @@ class RootController : Controller() {
|
|||||||
mvc.setPreview3DTexture(con.getTexturePreview(data.textureHash))
|
mvc.setPreview3DTexture(con.getTexturePreview(data.textureHash))
|
||||||
mvc.setMeta(data.name, data.resolution.toString(), "")
|
mvc.setMeta(data.name, data.resolution.toString(), "")
|
||||||
mvc.setTags(data.tags.toList().observable())
|
mvc.setTags(data.tags.toList().observable())
|
||||||
|
selectedTexture = data
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -212,4 +215,19 @@ class RootController : Controller() {
|
|||||||
dialogDelete.showAndWait()
|
dialogDelete.showAndWait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun updateTexture(chips: ObservableList<String>) {
|
||||||
|
val uuid = UUID.randomUUID()
|
||||||
|
val newTexture = Texture(
|
||||||
|
uuid,
|
||||||
|
selectedTexture.name,
|
||||||
|
chips.toTypedArray(),
|
||||||
|
selectedTexture.format,
|
||||||
|
selectedTexture.resolution,
|
||||||
|
selectedTexture.addedOn,
|
||||||
|
selectedTexture.textureHash
|
||||||
|
)
|
||||||
|
con.updateTexture(selectedTexture, newTexture, con.getTextureFile(selectedTexture.textureHash))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -25,11 +25,18 @@ class GUIModel constructor(var data: Texture, img: Image) : VBox(){
|
|||||||
private val gmc = find(GUIModelController::class)
|
private val gmc = find(GUIModelController::class)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
//super.setPadding(Insets(10.0, 10.0, 10.0, 10.0))
|
super.setPadding(Insets(5.0, 5.0, 5.0, 5.0))
|
||||||
super.getChildren().addAll(image, label)
|
super.getChildren().addAll(image, label)
|
||||||
super.setOnContextMenuRequested { p0 -> contextMenu.show(this@GUIModel, p0.screenX, p0.screenY) }
|
super.setOnContextMenuRequested { p0 -> contextMenu.show(this@GUIModel, p0.screenX, p0.screenY) }
|
||||||
super.setOnMouseClicked{
|
super.setOnMouseClicked{
|
||||||
//this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
if (gmc.isLastSelectedInitialized()) {
|
||||||
|
gmc.lastSelected.background = Background.EMPTY
|
||||||
|
this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
gmc.lastSelected = this
|
||||||
|
} else {
|
||||||
|
this.background = Background(BackgroundFill(Paint.valueOf("#42adaf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
gmc.lastSelected = this
|
||||||
|
}
|
||||||
gmc.previewSelectedAction(data)
|
gmc.previewSelectedAction(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@ class GUIModelController: Controller() {
|
|||||||
|
|
||||||
private val rootc = find(RootController::class)
|
private val rootc = find(RootController::class)
|
||||||
|
|
||||||
|
lateinit var lastSelected: GUIModel
|
||||||
|
fun isLastSelectedInitialized() = ::lastSelected.isInitialized
|
||||||
|
|
||||||
fun export(data: Texture) {
|
fun export(data: Texture) {
|
||||||
rootc.exportTexture(data)
|
rootc.exportTexture(data)
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ import tornadofx.*
|
|||||||
|
|
||||||
class DetailView: View() {
|
class DetailView: View() {
|
||||||
|
|
||||||
|
private val mvc: MainViewController by inject()
|
||||||
|
|
||||||
val preview = Preview3D()
|
val preview = Preview3D()
|
||||||
val metaLabel = Label("Auflösung: 8MP\nName: Texture.png\nAndere: was anderes")
|
val metaLabel = Label("Auflösung: 8MP\nName: Texture.png\nAndere: was anderes")
|
||||||
val cvTags = JFXChipView<String>()
|
val cvTags = JFXChipView<String>()
|
||||||
@ -74,10 +76,5 @@ class DetailView: View() {
|
|||||||
"-jfx-button-type: RAISED;" +
|
"-jfx-button-type: RAISED;" +
|
||||||
"-fx-font-size: 25px"
|
"-fx-font-size: 25px"
|
||||||
}
|
}
|
||||||
|
|
||||||
btnImport.setOnAction {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,9 +10,9 @@ import tornadofx.*
|
|||||||
class FolderView : View("FolderView"){
|
class FolderView : View("FolderView"){
|
||||||
|
|
||||||
override val root = flowpane {
|
override val root = flowpane {
|
||||||
hgap = 15.0
|
hgap = 5.0
|
||||||
vgap = 15.0
|
vgap = 5.0
|
||||||
paddingAll = 12.0
|
paddingAll = 10.0
|
||||||
prefWidth = 732.0
|
prefWidth = 732.0
|
||||||
prefHeight = 401.0
|
prefHeight = 401.0
|
||||||
background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY))
|
background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY))
|
||||||
|
@ -19,6 +19,7 @@ class MainViewController : Controller() {
|
|||||||
private val preview = mv.detailView.preview
|
private val preview = mv.detailView.preview
|
||||||
private val metaLabel = mv.detailView.metaLabel
|
private val metaLabel = mv.detailView.metaLabel
|
||||||
private val cvTags = mv.detailView.cvTags
|
private val cvTags = mv.detailView.cvTags
|
||||||
|
private var lockUpdate: Boolean = false //lock update func when the system changes the detailview chipview
|
||||||
|
|
||||||
// FolderView functions
|
// FolderView functions
|
||||||
fun addElement(element: GUIModel) {
|
fun addElement(element: GUIModel) {
|
||||||
@ -40,12 +41,17 @@ class MainViewController : Controller() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setTags(chips: ObservableList<String>) {
|
fun setTags(chips: ObservableList<String>) {
|
||||||
|
lockUpdate = false //dont trigger update with onChange
|
||||||
cvTags.chips.clear()
|
cvTags.chips.clear()
|
||||||
cvTags.chips.addAll(chips)
|
cvTags.chips.addAll(chips)
|
||||||
|
lockUpdate = true //allow update with onChange
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateTags() {
|
fun updateTags() {
|
||||||
println(cvTags.chips)
|
if (lockUpdate) { //the chipView was changed by the user
|
||||||
|
println("Tags changed")
|
||||||
|
rootc.updateTexture(cvTags.chips)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetailView actions
|
// DetailView actions
|
||||||
@ -70,7 +76,8 @@ class MainViewController : Controller() {
|
|||||||
|
|
||||||
fun removeTextureFromView(data: Texture) {
|
fun removeTextureFromView(data: Texture) {
|
||||||
// stream all children nodes, filter them as GUIModel with data.id == data.id, for any found object if it's still present remove it from the folderView
|
// stream all children nodes, filter them as GUIModel with data.id == data.id, for any found object if it's still present remove it from the folderView
|
||||||
folderView.children.stream().filter { x -> (x as GUIModel).data.id == data.id }.findAny().ifPresent{ x -> folderView.children.remove(x)}
|
folderView.children.stream().filter { x -> (x as GUIModel).data.id == data.id }.findAny()
|
||||||
|
.ifPresent { x -> folderView.children.remove(x) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user