From d4461a0095f3c84f781fcfa318615dda7701aafe Mon Sep 17 00:00:00 2001 From: DolicaAkelloEgwel Date: Mon, 8 Apr 2019 16:46:55 +0100 Subject: [PATCH 1/5] Call to camera.viewAll() when model changes... --- resources/Qtmodels/Main.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/Qtmodels/Main.qml b/resources/Qtmodels/Main.qml index 7f1cc0246..ef1469f6d 100644 --- a/resources/Qtmodels/Main.qml +++ b/resources/Qtmodels/Main.qml @@ -238,7 +238,11 @@ ApplicationWindow { // When the model updates, request new json for the view if desired Connections { target: components - onModel_updated: jsonConnector.request_filewriter_json(components) + onModel_updated: { + jsonConnector.request_filewriter_json(components) + console.log("I just updated.") + instrumentEntity.camera.viewAll() + } enabled: jsonMode == "liveFW" } From dceb39cec2615313e156b6e51a92585c76c36c8d Mon Sep 17 00:00:00 2001 From: DolicaAkelloEgwel Date: Tue, 9 Apr 2019 12:33:38 +0100 Subject: [PATCH 2/5] Send camera to origin before calling viewAll --- resources/Qtmodels/AnimatedEntity.qml | 7 +++++++ resources/Qtmodels/Main.qml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/Qtmodels/AnimatedEntity.qml b/resources/Qtmodels/AnimatedEntity.qml index d731c334d..3fb2886ae 100644 --- a/resources/Qtmodels/AnimatedEntity.qml +++ b/resources/Qtmodels/AnimatedEntity.qml @@ -10,6 +10,7 @@ Entity { property InstrumentModel instrument property alias camera: camera + property real negativeOne: -1.0 Camera { id: camera @@ -22,6 +23,12 @@ Entity { viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) } + function updateView() { + camera.translateWorld(camera.position.times(-1.0)) + console.log(camera.position) + camera.viewAll() + } + FirstPersonCameraController { camera: camera linearSpeed: 20} diff --git a/resources/Qtmodels/Main.qml b/resources/Qtmodels/Main.qml index ef1469f6d..2b625e78b 100644 --- a/resources/Qtmodels/Main.qml +++ b/resources/Qtmodels/Main.qml @@ -241,7 +241,7 @@ ApplicationWindow { onModel_updated: { jsonConnector.request_filewriter_json(components) console.log("I just updated.") - instrumentEntity.camera.viewAll() + instrumentEntity.updateView() } enabled: jsonMode == "liveFW" } From 7c775158ab6603ffa999747f0096762226d6302b Mon Sep 17 00:00:00 2001 From: DolicaAkelloEgwel Date: Tue, 9 Apr 2019 14:02:54 +0100 Subject: [PATCH 3/5] Removing return to origin --- resources/Qtmodels/AnimatedEntity.qml | 1 - resources/Qtmodels/ComponentControls.qml | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/Qtmodels/AnimatedEntity.qml b/resources/Qtmodels/AnimatedEntity.qml index 3fb2886ae..e814d2213 100644 --- a/resources/Qtmodels/AnimatedEntity.qml +++ b/resources/Qtmodels/AnimatedEntity.qml @@ -24,7 +24,6 @@ Entity { } function updateView() { - camera.translateWorld(camera.position.times(-1.0)) console.log(camera.position) camera.viewAll() } diff --git a/resources/Qtmodels/ComponentControls.qml b/resources/Qtmodels/ComponentControls.qml index a772ba39c..f092753b2 100644 --- a/resources/Qtmodels/ComponentControls.qml +++ b/resources/Qtmodels/ComponentControls.qml @@ -206,7 +206,11 @@ Pane { anchors.top: editorButton.top anchors.right: parent.right text: "Delete" - onClicked: components.remove_component(index) + onClicked: { + console.log("Gonna delete something.") + components.remove_component(index) + console.log("Done deleting something.") + } buttonEnabled: removable // The sample (at index 0) should never be removed. Don't even show it as an option. visible: index != 0 From 1bebc768be55763cba04479a1317b6e8bfb7c1ab Mon Sep 17 00:00:00 2001 From: DolicaAkelloEgwel Date: Tue, 9 Apr 2019 14:40:53 +0100 Subject: [PATCH 4/5] Removing function from AnimatedEntity --- resources/Qtmodels/AnimatedEntity.qml | 5 ----- resources/Qtmodels/Main.qml | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/resources/Qtmodels/AnimatedEntity.qml b/resources/Qtmodels/AnimatedEntity.qml index e814d2213..8bc677772 100644 --- a/resources/Qtmodels/AnimatedEntity.qml +++ b/resources/Qtmodels/AnimatedEntity.qml @@ -23,11 +23,6 @@ Entity { viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) } - function updateView() { - console.log(camera.position) - camera.viewAll() - } - FirstPersonCameraController { camera: camera linearSpeed: 20} diff --git a/resources/Qtmodels/Main.qml b/resources/Qtmodels/Main.qml index 2b625e78b..27677e5a9 100644 --- a/resources/Qtmodels/Main.qml +++ b/resources/Qtmodels/Main.qml @@ -240,8 +240,7 @@ ApplicationWindow { target: components onModel_updated: { jsonConnector.request_filewriter_json(components) - console.log("I just updated.") - instrumentEntity.updateView() + instrumentEntity.camera.viewAll() } enabled: jsonMode == "liveFW" } From 460f63c95d831eab09f3c79ef84275c0a2fd968b Mon Sep 17 00:00:00 2001 From: DolicaAkelloEgwel Date: Tue, 9 Apr 2019 14:44:35 +0100 Subject: [PATCH 5/5] tidying --- resources/Qtmodels/AnimatedEntity.qml | 1 - resources/Qtmodels/ComponentControls.qml | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/resources/Qtmodels/AnimatedEntity.qml b/resources/Qtmodels/AnimatedEntity.qml index 8bc677772..d731c334d 100644 --- a/resources/Qtmodels/AnimatedEntity.qml +++ b/resources/Qtmodels/AnimatedEntity.qml @@ -10,7 +10,6 @@ Entity { property InstrumentModel instrument property alias camera: camera - property real negativeOne: -1.0 Camera { id: camera diff --git a/resources/Qtmodels/ComponentControls.qml b/resources/Qtmodels/ComponentControls.qml index f092753b2..a772ba39c 100644 --- a/resources/Qtmodels/ComponentControls.qml +++ b/resources/Qtmodels/ComponentControls.qml @@ -206,11 +206,7 @@ Pane { anchors.top: editorButton.top anchors.right: parent.right text: "Delete" - onClicked: { - console.log("Gonna delete something.") - components.remove_component(index) - console.log("Done deleting something.") - } + onClicked: components.remove_component(index) buttonEnabled: removable // The sample (at index 0) should never be removed. Don't even show it as an option. visible: index != 0