From a9de5a0a71ce47a7fe9ba2ac7625d4a0e28f6150 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Fri, 9 Feb 2018 22:29:02 +0100 Subject: [PATCH] Warning before overwriting existing animation --- .../rhubarb_for_spine/AudioFileModel.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/AudioFileModel.kt b/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/AudioFileModel.kt index 11b81c2..27f5905 100644 --- a/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/AudioFileModel.kt +++ b/extras/rhubarb-for-spine/src/main/kotlin/com/rhubarb_lip_sync/rhubarb_for_spine/AudioFileModel.kt @@ -8,6 +8,7 @@ import javafx.beans.property.SimpleBooleanProperty import javafx.beans.property.SimpleObjectProperty import javafx.beans.property.SimpleStringProperty import javafx.scene.control.Alert +import javafx.scene.control.ButtonType import tornadofx.getValue import tornadofx.setValue import java.util.concurrent.ExecutorService @@ -141,6 +142,17 @@ class AudioFileModel( fun performAction() { if (future == null) { + if (animated) { + Alert(Alert.AlertType.CONFIRMATION).apply { + headerText = "Animation '$animationName' already exists." + contentText = "Do you want to replace the existing animation?" + val result = showAndWait() + if (result.get() != ButtonType.OK) { + return + } + } + } + startAnimation() } else { cancelAnimation() @@ -170,7 +182,7 @@ class AudioFileModel( } catch (e: Exception) { Platform.runLater { Alert(Alert.AlertType.ERROR).apply { - headerText = "Error performing lip-sync for event '$eventName'." + headerText = "Error performing lip sync for event '$eventName'." contentText = e.message show() }