mirror of
https://github.com/JulianGro/overte.git
synced 2025-07-16 13:17:30 +02:00
Add profiling to edit.js fof the entity list
This commit is contained in:
parent
133ac0662a
commit
f6ac755bae
2 changed files with 109 additions and 75 deletions
|
@ -23,6 +23,18 @@ const DELETE = 46; // Key code for the delete key.
|
|||
const KEY_P = 80; // Key code for letter p used for Parenting hotkey.
|
||||
const MAX_ITEMS = Number.MAX_VALUE; // Used to set the max length of the list of discovered entities.
|
||||
|
||||
var profileIndent = '';
|
||||
PROFILE = function(name, fn, args) {
|
||||
EventBridge.emitWebEvent("PROFILE-Web " + profileIndent + "(" + name + ") Begin");
|
||||
var previousIndent = profileIndent;
|
||||
profileIndent += ' ';
|
||||
var before = Date.now();
|
||||
fn.apply(this, args);
|
||||
var delta = Date.now() - before;
|
||||
profileIndent = previousIndent;
|
||||
EventBridge.emitWebEvent("PROFILE-Web " + profileIndent + "(" + name + ") End " + delta + "ms");
|
||||
}
|
||||
|
||||
debugPrint = function (message) {
|
||||
console.log(message);
|
||||
};
|
||||
|
@ -363,6 +375,7 @@ function loaded() {
|
|||
refreshEntities();
|
||||
}
|
||||
} else if (data.type === "update" && data.selectedIDs !== undefined) {
|
||||
PROFILE("update", function() {
|
||||
var newEntities = data.entities;
|
||||
if (newEntities && newEntities.length == 0) {
|
||||
elNoEntitiesMessage.style.display = "block";
|
||||
|
@ -384,6 +397,7 @@ function loaded() {
|
|||
scheduleRefreshEntityList();
|
||||
resize();
|
||||
}
|
||||
});
|
||||
} else if (data.type === "removeEntities" && data.deletedIDs !== undefined && data.selectedIDs !== undefined) {
|
||||
removeEntities(data.deletedIDs);
|
||||
updateSelectedEntities(data.selectedIDs);
|
||||
|
|
|
@ -11,6 +11,18 @@
|
|||
/* global EntityListTool, Tablet, selectionManager, Entities, Camera, MyAvatar, Vec3, Menu, Messages,
|
||||
cameraManager, MENU_EASE_ON_FOCUS, deleteSelectedEntities, toggleSelectedEntitiesLocked, toggleSelectedEntitiesVisible */
|
||||
|
||||
var profileIndent = '';
|
||||
PROFILE = function(name, fn, args) {
|
||||
console.log("PROFILE-Script " + profileIndent + "(" + name + ") Begin");
|
||||
var previousIndent = profileIndent;
|
||||
profileIndent += ' ';
|
||||
var before = Date.now();
|
||||
fn.apply(this, args);
|
||||
var delta = Date.now() - before;
|
||||
profileIndent = previousIndent;
|
||||
console.log("PROFILE-Script " + profileIndent + "(" + name + ") End " + delta + "ms");
|
||||
}
|
||||
|
||||
EntityListTool = function(shouldUseEditTabletApp) {
|
||||
var that = {};
|
||||
|
||||
|
@ -66,11 +78,16 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
that.setVisible(false);
|
||||
|
||||
function emitJSONScriptEvent(data) {
|
||||
var dataString = JSON.stringify(data);
|
||||
var dataString;
|
||||
PROFILE("Script-JSON.stringify", function() {
|
||||
dataString = JSON.stringify(data);
|
||||
});
|
||||
PROFILE("Script-emitScriptEvent", function() {
|
||||
webView.emitScriptEvent(dataString);
|
||||
if (entityListWindow.window) {
|
||||
entityListWindow.window.emitScriptEvent(dataString);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
that.toggleVisible = function() {
|
||||
|
@ -116,6 +133,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
}
|
||||
|
||||
that.sendUpdate = function() {
|
||||
PROFILE('Script-sendUpdate', function() {
|
||||
var entities = [];
|
||||
|
||||
var ids;
|
||||
|
@ -170,6 +188,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
entities: entities,
|
||||
selectedIDs: selectedIDs,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function onFileSaveChanged(filename) {
|
||||
|
@ -186,7 +205,8 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
try {
|
||||
data = JSON.parse(data);
|
||||
} catch(e) {
|
||||
print("entityList.js: Error parsing JSON: " + e.name + " data " + data);
|
||||
console.log(data);
|
||||
//print("entityList.js: Error parsing JSON: " + e.name + " data " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue