From dac2ae19a427fc64450c129cd7481d145102d463 Mon Sep 17 00:00:00 2001 From: LaShonda Hopper Date: Wed, 8 Nov 2017 12:24:16 -0500 Subject: [PATCH 1/3] [Case 6569] Add protection for dynamic vs static collision type (details below). When creating a model, it was possible to elect Exact collision with the dynamic property even though this combination is prohibited. This combination would silently fail rather than notifying the user of the error. This commit implements safeguards against the invalid combination: * If the user elects the Exact collision type and the dynamic field is unchecked, then dynamic field is disabled. * If the user elects a different collision type and the dynamic filed is unchecked, then the dynamic field is enabled. * If the user has checked the dynamic field and subsequently elects the Exact collision type, then the selection is void and the previous collision selection is retained; however, an error dialog is presented informing the user of the error. Changes Committed: modified: interface/resources/qml/hifi/tablet/NewModelDialog.qml --- .../qml/hifi/tablet/NewModelDialog.qml | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/NewModelDialog.qml b/interface/resources/qml/hifi/tablet/NewModelDialog.qml index 47d28486a9..e6459fe7bb 100644 --- a/interface/resources/qml/hifi/tablet/NewModelDialog.qml +++ b/interface/resources/qml/hifi/tablet/NewModelDialog.qml @@ -11,8 +11,11 @@ import QtQuick 2.5 import QtQuick.Controls 1.4 +import QtQuick.Dialogs 1.2 as OriginalDialogs + import "../../styles-uit" import "../../controls-uit" +import "../dialogs" Rectangle { id: newModelDialog @@ -25,6 +28,15 @@ Rectangle { property bool punctuationMode: false property bool keyboardRasied: false + function errorMessageBox(message) { + return desktop.messageBox({ + icon: hifi.icons.warning, + defaultButton: OriginalDialogs.StandardButton.Ok, + title: "Error", + text: message + }); + } + Item { id: column1 anchors.rightMargin: 10 @@ -98,7 +110,6 @@ Rectangle { CheckBox { id: dynamic text: qsTr("Dynamic") - } Row { @@ -139,15 +150,39 @@ Rectangle { ComboBox { id: collisionType + + property int priorIndex: 0 + property string staticMeshCollisionText: "Exact - All polygons" + property var collisionArray: ["No Collision", + "Basic - Whole model", + "Good - Sub-meshes", + staticMeshCollisionText, + "Box", + "Sphere"] + width: 200 z: 100 transformOrigin: Item.Center - model: ["No Collision", - "Basic - Whole model", - "Good - Sub-meshes", - "Exact - All polygons", - "Box", - "Sphere"] + model: collisionArray + + onCurrentIndexChanged: { + if (collisionArray[currentIndex] === staticMeshCollisionText) { + + if (dynamic.checked) { + currentIndex = priorIndex; + + errorMessageBox("Models with Automatic Collisions set to \"" + staticMeshCollisionText + "\" cannot be dynamic."); + //--EARLY EXIT--( Can't have a static mesh model that's dynamic ) + return; + } + + dynamic.enabled = false; + } else { + dynamic.enabled = true; + } + + priorIndex = currentIndex; + } } Row { From a057cb914f65c37b3ac7b4a823488c9068ae8e1c Mon Sep 17 00:00:00 2001 From: LaShonda Hopper Date: Wed, 8 Nov 2017 14:18:04 -0500 Subject: [PATCH 2/3] [Case 6569] Fixes clipping of cancel button by window edge. Changes Committed: modified: interface/resources/qml/hifi/tablet/NewModelDialog.qml --- interface/resources/qml/hifi/tablet/NewModelDialog.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/NewModelDialog.qml b/interface/resources/qml/hifi/tablet/NewModelDialog.qml index e6459fe7bb..da77464325 100644 --- a/interface/resources/qml/hifi/tablet/NewModelDialog.qml +++ b/interface/resources/qml/hifi/tablet/NewModelDialog.qml @@ -128,6 +128,7 @@ Rectangle { Text { id: text2 width: 160 + x: dynamic.width / 2 color: "#ffffff" text: qsTr("Models with automatic collisions set to 'Exact' cannot be dynamic, and should not be used as floors") wrapMode: Text.WordWrap @@ -190,10 +191,10 @@ Rectangle { width: 200 height: 400 spacing: 5 - - anchors { - rightMargin: 15 - } + + anchors.horizontalCenter: column3.horizontalCenter + anchors.horizontalCenterOffset: -20 + Button { id: button1 text: qsTr("Add") From 0e90c92cf5038c732cc2449fd39a4b840da9eee6 Mon Sep 17 00:00:00 2001 From: LaShonda Hopper Date: Wed, 8 Nov 2017 18:35:12 -0500 Subject: [PATCH 3/3] [Case 6569] Minor: Break up line to pass column count guidelines. Changes Committed: modified: interface/resources/qml/hifi/tablet/NewModelDialog.qml --- interface/resources/qml/hifi/tablet/NewModelDialog.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/NewModelDialog.qml b/interface/resources/qml/hifi/tablet/NewModelDialog.qml index da77464325..3debc8b9e7 100644 --- a/interface/resources/qml/hifi/tablet/NewModelDialog.qml +++ b/interface/resources/qml/hifi/tablet/NewModelDialog.qml @@ -172,7 +172,8 @@ Rectangle { if (dynamic.checked) { currentIndex = priorIndex; - errorMessageBox("Models with Automatic Collisions set to \"" + staticMeshCollisionText + "\" cannot be dynamic."); + errorMessageBox("Models with Automatic Collisions set to \"" + + staticMeshCollisionText + "\" cannot be dynamic."); //--EARLY EXIT--( Can't have a static mesh model that's dynamic ) return; }