mirror of
https://github.com/overte-org/overte.git
synced 2025-06-06 09:41:41 +02:00
Merge pull request #9934 from fayeli/edit-import-entities
Adding Import Entities button on the Create tab of Edit
This commit is contained in:
commit
2e29ff3114
2 changed files with 45 additions and 86 deletions
|
@ -7,6 +7,7 @@ import "../../controls"
|
||||||
import "../toolbars"
|
import "../toolbars"
|
||||||
import HFWebEngineProfile 1.0
|
import HFWebEngineProfile 1.0
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import "../../controls-uit" as HifiControls
|
||||||
import "../../styles-uit"
|
import "../../styles-uit"
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
|
@ -17,6 +18,8 @@ StackView {
|
||||||
property var eventBridge;
|
property var eventBridge;
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
function pushSource(path) {
|
function pushSource(path) {
|
||||||
editRoot.push(Qt.resolvedUrl(path));
|
editRoot.push(Qt.resolvedUrl(path));
|
||||||
editRoot.currentItem.eventBridge = editRoot.eventBridge;
|
editRoot.currentItem.eventBridge = editRoot.eventBridge;
|
||||||
|
@ -155,97 +158,39 @@ StackView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
HifiControls.Button {
|
||||||
id: assetServerButton
|
id: assetServerButton
|
||||||
width: 370
|
text: "Open This Domain's Asset Server"
|
||||||
height: 38
|
color: hifi.buttons.black
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 55
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 55
|
||||||
anchors.top: createEntitiesFlow.bottom
|
anchors.top: createEntitiesFlow.bottom
|
||||||
anchors.topMargin: 35
|
anchors.topMargin: 35
|
||||||
|
onClicked: {
|
||||||
Rectangle {
|
editRoot.sendToScript({
|
||||||
id: assetServerButtonBg
|
method: "newEntityButtonClicked", params: { buttonName: "openAssetBrowserButton" }
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
HifiControls.Button {
|
||||||
id: assetServerButtonGradient
|
text: "Import Entities (.json)"
|
||||||
gradient: Gradient {
|
color: hifi.buttons.black
|
||||||
GradientStop {
|
colorScheme: hifi.colorSchemes.dark
|
||||||
position: 0
|
anchors.right: parent.right
|
||||||
color: "#383838"
|
anchors.rightMargin: 55
|
||||||
}
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 55
|
||||||
GradientStop {
|
anchors.top: assetServerButton.bottom
|
||||||
position: 1
|
anchors.topMargin: 20
|
||||||
color: "black"
|
onClicked: {
|
||||||
}
|
editRoot.sendToScript({
|
||||||
}
|
method: "newEntityButtonClicked", params: { buttonName: "importEntitiesButton" }
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,21 @@ var toolBar = (function () {
|
||||||
that.toggle();
|
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();
|
Window.showAssetServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue