merge particle explorer into properties, resurrect sliders, other tidying/fixes

This commit is contained in:
David Back 2018-10-16 12:39:34 -07:00
parent 62c5fb8e2e
commit 50becb5c37
7 changed files with 863 additions and 406 deletions

View file

@ -175,7 +175,7 @@ TabBar {
method: "newEntityButtonClicked",
params: { buttonName: "newParticleButton" }
});
editTabView.currentIndex = 4
editTabView.currentIndex = 2
}
}
@ -279,21 +279,6 @@ TabBar {
}
}
EditTabButton {
title: "P"
active: true
enabled: true
property string originalUrl: ""
property Component visualItem: Component {
WebView {
id: particleExplorerWebView
url: Paths.defaultScripts + "/system/particle_explorer/particleExplorer.html"
enabled: true
}
}
}
function fromScript(message) {
switch (message.method) {
case 'selectTab':
@ -326,9 +311,6 @@ TabBar {
case 'grid':
editTabView.currentIndex = 3;
break;
case 'particle':
editTabView.currentIndex = 4;
break;
default:
console.warn('Attempt to switch to invalid tab:', id);
}

View file

@ -18,7 +18,6 @@ TabBar {
readonly property int create: 0
readonly property int properties: 1
readonly property int grid: 2
readonly property int particle: 3
}
readonly property HifiConstants hifi: HifiConstants {}
@ -182,7 +181,7 @@ TabBar {
method: "newEntityButtonClicked",
params: { buttonName: "newParticleButton" }
});
editTabView.currentIndex = tabIndex.particle
editTabView.currentIndex = tabIndex.properties
}
}
@ -271,21 +270,6 @@ TabBar {
}
}
EditTabButton {
title: "P"
active: true
enabled: true
property string originalUrl: ""
property Component visualItem: Component {
WebView {
id: particleExplorerWebView
url: Paths.defaultScripts + "/system/particle_explorer/particleExplorer.html"
enabled: true
}
}
}
function fromScript(message) {
switch (message.method) {
case 'selectTab':
@ -299,7 +283,7 @@ TabBar {
// Changes the current tab based on tab index or title as input
function selectTab(id) {
if (typeof id === 'number') {
if (id >= tabIndex.create && id <= tabIndex.particle) {
if (id >= tabIndex.create && id <= tabIndex.grid) {
editTabView.currentIndex = id;
} else {
console.warn('Attempt to switch to invalid tab:', id);
@ -315,9 +299,6 @@ TabBar {
case 'grid':
editTabView.currentIndex = tabIndex.grid;
break;
case 'particle':
editTabView.currentIndex = tabIndex.particle;
break;
default:
console.warn('Attempt to switch to invalid tab:', id);
}

View file

@ -12,7 +12,7 @@
/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager,
Overlays, OverlayWebWindow, UserActivityLogger, Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera,
progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool, OverlaySystemWindow */
progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, OverlaySystemWindow */
(function() { // BEGIN LOCAL_SCOPE
@ -32,7 +32,6 @@ Script.include([
"libraries/gridTool.js",
"libraries/entityList.js",
"libraries/utils.js",
"particle_explorer/particleExplorerTool.js",
"libraries/entityIconOverlayManager.js"
]);
@ -109,28 +108,6 @@ var entityListTool = new EntityListTool(shouldUseEditTabletApp);
selectionManager.addEventListener(function () {
selectionDisplay.updateHandles();
entityIconOverlayManager.updatePositions();
// Update particle explorer
var needToDestroyParticleExplorer = false;
if (selectionManager.selections.length === 1) {
var selectedEntityID = selectionManager.selections[0];
if (selectedEntityID === selectedParticleEntityID) {
return;
}
var type = Entities.getEntityProperties(selectedEntityID, "type").type;
if (type === "ParticleEffect") {
selectParticleEntity(selectedEntityID);
} else {
needToDestroyParticleExplorer = true;
}
} else {
needToDestroyParticleExplorer = true;
}
if (needToDestroyParticleExplorer && selectedParticleEntityID !== null) {
selectedParticleEntityID = null;
particleExplorerTool.destroyWebView();
}
});
var KEY_P = 80; //Key code for letter p used for Parenting hotkey.
@ -359,10 +336,6 @@ var toolBar = (function () {
properties: properties
}], [], true);
if (properties.type === "ParticleEffect") {
selectParticleEntity(entityID);
}
var POST_ADJUST_ENTITY_TYPES = ["Model"];
if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
// Adjust position of entity per bounding box after it has been created and auto-resized.
@ -1178,13 +1151,6 @@ function mouseClickEvent(event) {
orientation = MyAvatar.orientation;
intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation));
if (event.isShifted) {
particleExplorerTool.destroyWebView();
}
if (properties.type !== "ParticleEffect") {
particleExplorerTool.destroyWebView();
}
if (!event.isShifted) {
selectionManager.setSelections([foundEntity]);
} else {
@ -1604,8 +1570,6 @@ function deleteSelectedEntities() {
if (SelectionManager.hasSelection()) {
var deletedIDs = [];
selectedParticleEntityID = null;
particleExplorerTool.destroyWebView();
SelectionManager.saveProperties();
var savedProperties = [];
var newSortedSelection = sortSelectedEntities(selectionManager.selections);
@ -2572,31 +2536,6 @@ propertyMenu.onSelectMenuItem = function (name) {
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
var propertiesTool = new PropertiesTool();
var particleExplorerTool = new ParticleExplorerTool(createToolsWindow);
var selectedParticleEntityID = null;
function selectParticleEntity(entityID) {
selectedParticleEntityID = entityID;
var properties = Entities.getEntityProperties(entityID);
if (properties.emitOrientation) {
properties.emitOrientation = Quat.safeEulerAngles(properties.emitOrientation);
}
particleExplorerTool.destroyWebView();
particleExplorerTool.createWebView();
particleExplorerTool.setActiveParticleEntity(entityID);
// Switch to particle explorer
var selectTabMethod = { method: 'selectTab', params: { id: 'particle' } };
if (shouldUseEditTabletApp()) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet.sendToQml(selectTabMethod);
} else {
createToolsWindow.sendToQml(selectTabMethod);
}
}
entityListTool.webView.webEventReceived.connect(function(data) {
try {
@ -2610,20 +2549,6 @@ entityListTool.webView.webEventReceived.connect(function(data) {
parentSelectedEntities();
} else if (data.type === 'unparent') {
unparentSelectedEntities();
} else if (data.type === "selectionUpdate") {
var ids = data.entityIds;
if (ids.length === 1) {
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") {
if (JSON.stringify(selectedParticleEntityID) === JSON.stringify(ids[0])) {
// This particle entity is already selected, so return
return;
}
// Destroy the old particles web view first
} else {
selectedParticleEntityID = 0;
particleExplorerTool.destroyWebView();
}
}
}
});

File diff suppressed because one or more lines are too long

View file

@ -20,6 +20,7 @@
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
<script type="text/javascript" src="js/spinButtons.js"></script>
<script type="text/javascript" src="js/underscore-min.js"></script>
<script type="text/javascript" src="js/entityProperties.js"></script>
<script src="js/jsoneditor.min.js"></script>
</head>

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long