From 42216b69863e3fb393510e0a50122f890621bda7 Mon Sep 17 00:00:00 2001 From: Faye Li Date: Wed, 15 Mar 2017 16:47:31 -0700 Subject: [PATCH 1/4] create import entities button on create tab --- interface/resources/qml/hifi/tablet/Edit.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/interface/resources/qml/hifi/tablet/Edit.qml b/interface/resources/qml/hifi/tablet/Edit.qml index 00856f8212..b9d7326c8e 100644 --- a/interface/resources/qml/hifi/tablet/Edit.qml +++ b/interface/resources/qml/hifi/tablet/Edit.qml @@ -7,6 +7,7 @@ import "../../controls" import "../toolbars" import HFWebEngineProfile 1.0 import QtGraphicalEffects 1.0 +import "../../controls-uit" as HifiControls import "../../styles-uit" StackView { @@ -17,6 +18,8 @@ StackView { property var eventBridge; signal sendToScript(var message); + HifiConstants { id: hifi } + function pushSource(path) { editRoot.push(Qt.resolvedUrl(path)); editRoot.currentItem.eventBridge = editRoot.eventBridge; @@ -247,6 +250,18 @@ StackView { } ] } + + HifiControls.Button { + text: "Import Entities" + color: hifi.buttons.black + colorScheme: hifi.colorSchemes.dark + anchors.right: parent.right + anchors.rightMargin: 55 + anchors.left: parent.left + anchors.leftMargin: 55 + anchors.top: assetServerButton.bottom + anchors.topMargin: 35 + } } } From 10ebb6efd7ffabf97b3f26d262dbe6a54a2cfb6f Mon Sep 17 00:00:00 2001 From: Faye Li Date: Wed, 15 Mar 2017 16:55:21 -0700 Subject: [PATCH 2/4] simplify asset server button --- interface/resources/qml/hifi/tablet/Edit.qml | 101 +++---------------- 1 file changed, 13 insertions(+), 88 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/Edit.qml b/interface/resources/qml/hifi/tablet/Edit.qml index b9d7326c8e..bb3385c874 100644 --- a/interface/resources/qml/hifi/tablet/Edit.qml +++ b/interface/resources/qml/hifi/tablet/Edit.qml @@ -158,97 +158,22 @@ StackView { } } - Item { + HifiControls.Button { id: assetServerButton - width: 370 - height: 38 - anchors.horizontalCenter: parent.horizontalCenter + text: "Open This Domain's Asset Server" + color: hifi.buttons.black + colorScheme: hifi.colorSchemes.dark + anchors.right: parent.right + anchors.rightMargin: 55 + anchors.left: parent.left + anchors.leftMargin: 55 anchors.top: createEntitiesFlow.bottom anchors.topMargin: 35 - - Rectangle { - id: assetServerButtonBg - color: "black" - opacity: 1 - radius: 6 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - anchors.top: parent.top - anchors.topMargin: 0 + onClicked: { + editRoot.sendToScript({ + method: "newEntityButtonClicked", params: { buttonName: "openAssetBrowserButton" } + }); } - - Rectangle { - id: assetServerButtonGradient - gradient: Gradient { - GradientStop { - position: 0 - color: "#383838" - } - - GradientStop { - position: 1 - color: "black" - } - } - opacity: 1 - radius: 6 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - anchors.top: parent.top - anchors.topMargin: 0 - } - - Text { - color: "#ffffff" - text: "OPEN THIS DOMAIN'S ASSET SERVER" - font.bold: true - font.pixelSize: 14 - anchors.centerIn: parent - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - enabled: true - onClicked: { - editRoot.sendToScript({ - method: "newEntityButtonClicked", params: { buttonName: "openAssetBrowserButton" } - }); - } - onEntered: { - assetServerButton.state = "hover state"; - } - onExited: { - assetServerButton.state = "base state"; - } - } - - states: [ - State { - name: "hover state" - - PropertyChanges { - target: assetServerButtonGradient - opacity: 0 - } - }, - State { - name: "base state" - - PropertyChanges { - target: assetServerButtonGradient - opacity: 1 - } - } - ] } HifiControls.Button { @@ -260,7 +185,7 @@ StackView { anchors.left: parent.left anchors.leftMargin: 55 anchors.top: assetServerButton.bottom - anchors.topMargin: 35 + anchors.topMargin: 20 } } } From 6531efffbcd2e100e5cc5832b7ab049dd2c9dba4 Mon Sep 17 00:00:00 2001 From: Faye Li Date: Fri, 17 Mar 2017 11:22:07 -0700 Subject: [PATCH 3/4] hook up qml button to edit.js --- interface/resources/qml/hifi/tablet/Edit.qml | 5 +++++ scripts/system/edit.js | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/Edit.qml b/interface/resources/qml/hifi/tablet/Edit.qml index bb3385c874..815f6b5f3c 100644 --- a/interface/resources/qml/hifi/tablet/Edit.qml +++ b/interface/resources/qml/hifi/tablet/Edit.qml @@ -186,6 +186,11 @@ StackView { anchors.leftMargin: 55 anchors.top: assetServerButton.bottom anchors.topMargin: 20 + onClicked: { + editRoot.sendToScript({ + method: "newEntityButtonClicked", params: { buttonName: "importEntitiesButton" } + }); + } } } } diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 55bd11b286..ecf8167e43 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -294,7 +294,21 @@ var toolBar = (function () { that.toggle(); }); - addButton("openAssetBrowserButton", "assets-01.svg", function(){ + addButton("importEntitiesButton", "assets-01.svg", function() { + var importURL = null; + var fullPath = Window.browse("Select Model to Import", "", "*.json"); + if (fullPath) { + importURL = "file:///" + fullPath; + } + if (importURL) { + if (!isActive && (Entities.canRez() && Entities.canRezTmp())) { + toolBar.toggle(); + } + importSVO(importURL); + } + }); + + addButton("openAssetBrowserButton", "assets-01.svg", function() { Window.showAssetServer(); }); From 33a7ff825ee9ccccfdb6795e132f32138a511a94 Mon Sep 17 00:00:00 2001 From: Faye Li Date: Fri, 17 Mar 2017 11:37:38 -0700 Subject: [PATCH 4/4] indicate expecting json file on button text --- interface/resources/qml/hifi/tablet/Edit.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/Edit.qml b/interface/resources/qml/hifi/tablet/Edit.qml index 815f6b5f3c..4abe698fbc 100644 --- a/interface/resources/qml/hifi/tablet/Edit.qml +++ b/interface/resources/qml/hifi/tablet/Edit.qml @@ -177,7 +177,7 @@ StackView { } HifiControls.Button { - text: "Import Entities" + text: "Import Entities (.json)" color: hifi.buttons.black colorScheme: hifi.colorSchemes.dark anchors.right: parent.right