mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +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 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;
|
||||
|
@ -155,97 +158,39 @@ 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
|
||||
HifiControls.Button {
|
||||
text: "Import Entities (.json)"
|
||||
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: 20
|
||||
onClicked: {
|
||||
editRoot.sendToScript({
|
||||
method: "newEntityButtonClicked", params: { buttonName: "importEntitiesButton" }
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue