put new-entity buttons in a tab of the edit app

This commit is contained in:
Seth Alves 2017-02-10 15:18:01 -08:00
parent 0b358a2ac7
commit fead52f626
4 changed files with 160 additions and 28 deletions

View file

@ -31,11 +31,112 @@ StackView {
anchors.fill: parent
Tab {
title: "Entity List"
title: "Create Entities"
active: true
enabled: true
property string originalUrl: ""
Flow {
id: createEntitiesFlow
spacing: 16
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/assets-01.svg"
text: "ASSETS"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "openAssetBrowserButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/model-01.svg"
text: "MODEL"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newModelButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/cube-01.svg"
text: "CUBE"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newCubeButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/sphere-01.svg"
text: "SPHERE"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newSphereButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/light-01.svg"
text: "LIGHT"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newLightButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/text-01.svg"
text: "TEXT"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newTextButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/web-01.svg"
text: "WEB"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newWebButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/zone-01.svg"
text: "ZONE"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newZoneButton" }
});
}
}
Button {
iconSource: "../../../../../scripts/system/assets/images/tools/particle-01.svg"
text: "PARTICLE"
onClicked: {
editRoot.sendToScript({
method: "newEntityButtonClicked", params: { buttonName: "newParticleButton" }
});
}
}
}
}
Tab {
title: "Entity List"
active: true
enabled: true
property string originalUrl: ""
WebView {
id: entityListToolWebView
@ -68,13 +169,28 @@ StackView {
property string originalUrl: ""
WebView {
id: entityPropertiesWebView
id: gridControlsWebView
url: "../../../../../scripts/system/html/gridControls.html"
eventBridge: editRoot.eventBridge
anchors.fill: parent
enabled: true
}
}
Tab {
title: "Particle Explorer"
active: true
enabled: true
property string originalUrl: ""
WebView {
id: particleExplorerWebView
url: "../../../../../scripts/system/particle_explorer/particleExplorer.html"
eventBridge: editRoot.eventBridge
anchors.fill: parent
enabled: true
}
}
}
}
}

View file

@ -123,7 +123,7 @@ Rectangle {
text: qsTr("Add")
onClicked: {
newModelDialog.sendToScript({
method: 'newModelDialogAdd',
method: "newModelDialogAdd",
params: {
textInput: modelURL.text,
checkBox: dynamic.checked,
@ -137,7 +137,7 @@ Rectangle {
id: button2
text: qsTr("Cancel")
onClicked: {
newModelDialog.sendToScript({method: 'newModelDialogCancel'})
newModelDialog.sendToScript({method: "newModelDialogCancel"})
}
}
}

View file

@ -201,24 +201,30 @@ var toolBar = (function () {
}
}
var buttonHandlers = {}; // only used to tablet mode
function addButton(name, image, handler) {
var imageUrl = TOOLS_PATH + image;
var button = toolBar.addButton({
objectName: name,
imageURL: imageUrl,
imageOffOut: 1,
imageOffIn: 2,
imageOnOut: 0,
imageOnIn: 2,
alpha: 0.9,
visible: true
});
if (handler) {
button.clicked.connect(function () {
Script.setTimeout(handler, 100);
if (Settings.getValue("HUDUIEnabled")) {
var imageUrl = TOOLS_PATH + image;
var button = toolBar.addButton({
objectName: name,
imageURL: imageUrl,
imageOffOut: 1,
imageOffIn: 2,
imageOnOut: 0,
imageOnIn: 2,
alpha: 0.9,
visible: true
});
if (handler) {
button.clicked.connect(function () {
Script.setTimeout(handler, 100);
});
}
return button;
} else {
buttonHandlers[name] = handler;
}
return button;
}
var SHAPE_TYPE_NONE = 0;
@ -269,6 +275,9 @@ var toolBar = (function () {
case "newModelDialogAdd":
handleNewModelDialogResult(message.params);
break;
case "newEntityButtonClicked":
buttonHandlers[message.params.buttonName]();
break;
}
}

View file

@ -18,12 +18,17 @@ ParticleExplorerTool = function() {
var that = {};
that.createWebView = function() {
var url = PARTICLE_EXPLORER_HTML_URL;
that.webView = new OverlayWebWindow({
title: 'Particle Explorer',
source: url,
toolWindow: true
});
if (Settings.getValue("HUDUIEnabled")) {
var url = PARTICLE_EXPLORER_HTML_URL;
that.webView = new OverlayWebWindow({
title: 'Particle Explorer',
source: url,
toolWindow: true
});
} else {
that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
that.webView.setVisible = function(value) {};
}
that.webView.setVisible(true);
that.webView.webEventReceived.connect(that.webEventReceived);
@ -35,8 +40,10 @@ ParticleExplorerTool = function() {
return;
}
that.webView.close();
that.webView = null;
if (Settings.getValue("HUDUIEnabled")) {
that.webView.close();
that.webView = null;
}
that.activeParticleEntity = 0;
}
@ -55,4 +62,4 @@ ParticleExplorerTool = function() {
return that;
};
};