diff --git a/interface/resources/qml/hifi/tablet/NewModelDialog.qml b/interface/resources/qml/hifi/tablet/NewModelDialog.qml new file mode 100644 index 0000000000..f2aaf0f3a5 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/NewModelDialog.qml @@ -0,0 +1,118 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.5 + +Item { + id: newModelDialog + property var eventBridge; + + Column { + id: column1 + anchors.rightMargin: 10 + anchors.leftMargin: 10 + anchors.bottomMargin: 10 + anchors.topMargin: 10 + anchors.fill: parent + spacing: 5 + + Text { + id: text1 + text: qsTr("Model URL") + font.pixelSize: 12 + } + + TextInput { + id: textInput1 + height: 20 + text: qsTr("") + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + font.pixelSize: 12 + } + + Row { + id: row1 + height: 400 + spacing: 30 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.right: parent.right + anchors.rightMargin: 0 + + Column { + id: column2 + width: 200 + height: 400 + + CheckBox { + id: checkBox1 + text: qsTr("Dynamic") + } + + Row { + id: row2 + width: 200 + height: 400 + spacing: 20 + + Image { + id: image1 + width: 30 + height: 30 + source: "qrc:/qtquickplugin/images/template_image.png" + } + + Text { + id: text2 + width: 160 + text: qsTr("Models with automatic collisions set to 'Exact' cannot be dynamic") + wrapMode: Text.WordWrap + font.pixelSize: 12 + } + } + } + + Column { + id: column3 + height: 400 + + Text { + id: text3 + text: qsTr("Automatic Collisions") + font.pixelSize: 12 + } + + ComboBox { + id: comboBox1 + width: 200 + transformOrigin: Item.Center + model: ListModel { + id: collisionDropdown + ListElement { text: "No Collision" } + ListElement { text: "Basic - Whole model" } + ListElement { text: "Good - Sub-meshes" } + ListElement { text: "Exact - All polygons" } + } + } + + Row { + id: row3 + width: 200 + height: 400 + + Button { + id: button1 + text: qsTr("Add") + } + + Button { + id: button2 + text: qsTr("Cancel") + } + } + } + } + } +} diff --git a/scripts/system/edit.js b/scripts/system/edit.js index c91e97cf56..9df6a30322 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -287,30 +287,33 @@ var toolBar = (function () { var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_STATIC_MESH; var DYNAMIC_DEFAULT = false; - var result = Window.customPrompt({ - textInput: { - label: "Model URL" - }, - comboBox: { - label: "Automatic Collisions", - index: SHAPE_TYPE_DEFAULT, - items: SHAPE_TYPES - }, - checkBox: { - label: "Dynamic", - checked: DYNAMIC_DEFAULT, - disableForItems: [ - SHAPE_TYPE_STATIC_MESH - ], - checkStateOnDisable: false, - warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic" - } - }); - if (result) { - var url = result.textInput; - var shapeType; - switch (result.comboBox) { + if (Settings.getValue("HUDUIEnabled")) { + // HUD-ui version of new-model dialog + var result = Window.customPrompt({ + textInput: { + label: "Model URL" + }, + comboBox: { + label: "Automatic Collisions", + index: SHAPE_TYPE_DEFAULT, + items: SHAPE_TYPES + }, + checkBox: { + label: "Dynamic", + checked: DYNAMIC_DEFAULT, + disableForItems: [ + SHAPE_TYPE_STATIC_MESH + ], + checkStateOnDisable: false, + warningOnDisable: "Models with automatic collisions set to 'Exact' cannot be dynamic" + } + }); + + if (result) { + var url = result.textInput; + var shapeType; + switch (result.comboBox) { case SHAPE_TYPE_SIMPLE_HULL: shapeType = "simple-hull"; break; @@ -322,21 +325,26 @@ var toolBar = (function () { break; default: shapeType = "none"; - } + } - var dynamic = result.checkBox !== null ? result.checkBox : DYNAMIC_DEFAULT; - if (shapeType === "static-mesh" && dynamic) { - // The prompt should prevent this case - print("Error: model cannot be both static mesh and dynamic. This should never happen."); - } else if (url) { - createNewEntity({ - type: "Model", - modelURL: url, - shapeType: shapeType, - dynamic: dynamic, - gravity: dynamic ? { x: 0, y: -10, z: 0 } : { x: 0, y: 0, z: 0 } - }); + var dynamic = result.checkBox !== null ? result.checkBox : DYNAMIC_DEFAULT; + if (shapeType === "static-mesh" && dynamic) { + // The prompt should prevent this case + print("Error: model cannot be both static mesh and dynamic. This should never happen."); + } else if (url) { + createNewEntity({ + type: "Model", + modelURL: url, + shapeType: shapeType, + dynamic: dynamic, + gravity: dynamic ? { x: 0, y: -10, z: 0 } : { x: 0, y: 0, z: 0 } + }); + } } + } else { + // tablet version of new-model dialog + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.loadQMLSource("NewModelDialog.qml"); } });