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", method: "newEntityButtonClicked",
params: { buttonName: "newParticleButton" } 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) { function fromScript(message) {
switch (message.method) { switch (message.method) {
case 'selectTab': case 'selectTab':
@ -326,9 +311,6 @@ TabBar {
case 'grid': case 'grid':
editTabView.currentIndex = 3; editTabView.currentIndex = 3;
break; break;
case 'particle':
editTabView.currentIndex = 4;
break;
default: default:
console.warn('Attempt to switch to invalid tab:', id); console.warn('Attempt to switch to invalid tab:', id);
} }

View file

@ -18,7 +18,6 @@ TabBar {
readonly property int create: 0 readonly property int create: 0
readonly property int properties: 1 readonly property int properties: 1
readonly property int grid: 2 readonly property int grid: 2
readonly property int particle: 3
} }
readonly property HifiConstants hifi: HifiConstants {} readonly property HifiConstants hifi: HifiConstants {}
@ -182,7 +181,7 @@ TabBar {
method: "newEntityButtonClicked", method: "newEntityButtonClicked",
params: { buttonName: "newParticleButton" } 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) { function fromScript(message) {
switch (message.method) { switch (message.method) {
case 'selectTab': case 'selectTab':
@ -299,7 +283,7 @@ TabBar {
// Changes the current tab based on tab index or title as input // Changes the current tab based on tab index or title as input
function selectTab(id) { function selectTab(id) {
if (typeof id === 'number') { if (typeof id === 'number') {
if (id >= tabIndex.create && id <= tabIndex.particle) { if (id >= tabIndex.create && id <= tabIndex.grid) {
editTabView.currentIndex = id; editTabView.currentIndex = id;
} else { } else {
console.warn('Attempt to switch to invalid tab:', id); console.warn('Attempt to switch to invalid tab:', id);
@ -315,9 +299,6 @@ TabBar {
case 'grid': case 'grid':
editTabView.currentIndex = tabIndex.grid; editTabView.currentIndex = tabIndex.grid;
break; break;
case 'particle':
editTabView.currentIndex = tabIndex.particle;
break;
default: default:
console.warn('Attempt to switch to invalid tab:', id); 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, /* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager,
Overlays, OverlayWebWindow, UserActivityLogger, Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, 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 (function() { // BEGIN LOCAL_SCOPE
@ -32,7 +32,6 @@ Script.include([
"libraries/gridTool.js", "libraries/gridTool.js",
"libraries/entityList.js", "libraries/entityList.js",
"libraries/utils.js", "libraries/utils.js",
"particle_explorer/particleExplorerTool.js",
"libraries/entityIconOverlayManager.js" "libraries/entityIconOverlayManager.js"
]); ]);
@ -109,28 +108,6 @@ var entityListTool = new EntityListTool(shouldUseEditTabletApp);
selectionManager.addEventListener(function () { selectionManager.addEventListener(function () {
selectionDisplay.updateHandles(); selectionDisplay.updateHandles();
entityIconOverlayManager.updatePositions(); 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. var KEY_P = 80; //Key code for letter p used for Parenting hotkey.
@ -359,10 +336,6 @@ var toolBar = (function () {
properties: properties properties: properties
}], [], true); }], [], true);
if (properties.type === "ParticleEffect") {
selectParticleEntity(entityID);
}
var POST_ADJUST_ENTITY_TYPES = ["Model"]; var POST_ADJUST_ENTITY_TYPES = ["Model"];
if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) { if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
// Adjust position of entity per bounding box after it has been created and auto-resized. // 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; orientation = MyAvatar.orientation;
intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation)); intersection = rayPlaneIntersection(pickRay, P, Quat.getForward(orientation));
if (event.isShifted) {
particleExplorerTool.destroyWebView();
}
if (properties.type !== "ParticleEffect") {
particleExplorerTool.destroyWebView();
}
if (!event.isShifted) { if (!event.isShifted) {
selectionManager.setSelections([foundEntity]); selectionManager.setSelections([foundEntity]);
} else { } else {
@ -1604,8 +1570,6 @@ function deleteSelectedEntities() {
if (SelectionManager.hasSelection()) { if (SelectionManager.hasSelection()) {
var deletedIDs = []; var deletedIDs = [];
selectedParticleEntityID = null;
particleExplorerTool.destroyWebView();
SelectionManager.saveProperties(); SelectionManager.saveProperties();
var savedProperties = []; var savedProperties = [];
var newSortedSelection = sortSelectedEntities(selectionManager.selections); var newSortedSelection = sortSelectedEntities(selectionManager.selections);
@ -2572,31 +2536,6 @@ propertyMenu.onSelectMenuItem = function (name) {
var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace"); var showMenuItem = propertyMenu.addMenuItem("Show in Marketplace");
var propertiesTool = new PropertiesTool(); 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) { entityListTool.webView.webEventReceived.connect(function(data) {
try { try {
@ -2610,20 +2549,6 @@ entityListTool.webView.webEventReceived.connect(function(data) {
parentSelectedEntities(); parentSelectedEntities();
} else if (data.type === 'unparent') { } else if (data.type === 'unparent') {
unparentSelectedEntities(); 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="qrc:///qtwebchannel/qwebchannel.js"></script>
<script type="text/javascript" src="js/eventBridgeLoader.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/spinButtons.js"></script>
<script type="text/javascript" src="js/underscore-min.js"></script>
<script type="text/javascript" src="js/entityProperties.js"></script> <script type="text/javascript" src="js/entityProperties.js"></script>
<script src="js/jsoneditor.min.js"></script> <script src="js/jsoneditor.min.js"></script>
</head> </head>

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long