mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 12:38:46 +02:00
remove debug tracing
This commit is contained in:
parent
eb97f99db1
commit
8021434984
1 changed files with 0 additions and 88 deletions
|
@ -32,16 +32,8 @@ function executeLater(callback) {
|
|||
function getMyAvatarWearables() {
|
||||
var wearablesArray = MyAvatar.getAvatarEntitiesVariant();
|
||||
|
||||
console.debug('avatarapp.js: getMyAvatarWearables(): wearables count: ', wearablesArray.length);
|
||||
for(var i = 0; i < wearablesArray.length; ++i) {
|
||||
var wearable = wearablesArray[i];
|
||||
console.debug('updating localRotationAngles for wearable: ',
|
||||
wearable.properties.id,
|
||||
wearable.properties.itemName,
|
||||
wearable.properties.parentID,
|
||||
wearable.properties.owningAvatarID,
|
||||
isGrabbable(wearable.properties.id));
|
||||
|
||||
var localRotation = wearable.properties.localRotation;
|
||||
wearable.properties.localRotationAngles = Quat.safeEulerAngles(localRotation)
|
||||
}
|
||||
|
@ -55,8 +47,6 @@ function getMyAvatar() {
|
|||
avatar[ENTRY_AVATAR_SCALE] = MyAvatar.getAvatarScale();
|
||||
avatar[ENTRY_AVATAR_ATTACHMENTS] = MyAvatar.getAttachmentsVariant();
|
||||
avatar[ENTRY_AVATAR_ENTITIES] = getMyAvatarWearables();
|
||||
console.debug('getMyAvatar: ', JSON.stringify(avatar, null, 4));
|
||||
|
||||
return avatar;
|
||||
}
|
||||
|
||||
|
@ -70,11 +60,7 @@ function getMyAvatarSettings() {
|
|||
}
|
||||
|
||||
function updateAvatarWearables(avatar, bookmarkAvatarName) {
|
||||
console.debug('avatarapp.js: scheduling wearablesUpdated notify for', bookmarkAvatarName);
|
||||
|
||||
executeLater(function() {
|
||||
console.debug('avatarapp.js: executing wearablesUpdated notify for', bookmarkAvatarName);
|
||||
|
||||
var wearables = getMyAvatarWearables();
|
||||
avatar[ENTRY_AVATAR_ENTITIES] = wearables;
|
||||
|
||||
|
@ -87,10 +73,8 @@ var adjustWearables = {
|
|||
cameraMode : '',
|
||||
setOpened : function(value) {
|
||||
if(this.opened !== value) {
|
||||
console.debug('avatarapp.js: adjustWearables.setOpened: ', value)
|
||||
if(value) {
|
||||
this.cameraMode = Camera.mode;
|
||||
console.debug('avatarapp.js: adjustWearables.setOpened: storing camera mode: ', this.cameraMode);
|
||||
|
||||
if(!HMD.active) {
|
||||
Camera.mode = 'mirror';
|
||||
|
@ -110,7 +94,6 @@ var currentAvatarSettings = getMyAvatarSettings();
|
|||
|
||||
var notifyScaleChanged = true;
|
||||
function onTargetScaleChanged() {
|
||||
console.debug('onTargetScaleChanged: ', MyAvatar.getAvatarScale());
|
||||
if(currentAvatar.scale !== MyAvatar.getAvatarScale()) {
|
||||
currentAvatar.scale = MyAvatar.getAvatarScale();
|
||||
if(notifyScaleChanged) {
|
||||
|
@ -120,7 +103,6 @@ function onTargetScaleChanged() {
|
|||
}
|
||||
|
||||
function onDominantHandChanged(dominantHand) {
|
||||
console.debug('onDominantHandChanged: ', dominantHand);
|
||||
if(currentAvatarSettings.dominantHand !== dominantHand) {
|
||||
currentAvatarSettings.dominantHand = dominantHand;
|
||||
sendToQml({'method' : 'settingChanged', 'name' : 'dominantHand', 'value' : dominantHand})
|
||||
|
@ -128,7 +110,6 @@ function onDominantHandChanged(dominantHand) {
|
|||
}
|
||||
|
||||
function onCollisionsEnabledChanged(enabled) {
|
||||
console.debug('onCollisionsEnabledChanged: ', enabled);
|
||||
if(currentAvatarSettings.collisionsEnabled !== enabled) {
|
||||
currentAvatarSettings.collisionsEnabled = enabled;
|
||||
sendToQml({'method' : 'settingChanged', 'name' : 'collisionsEnabled', 'value' : enabled})
|
||||
|
@ -136,7 +117,6 @@ function onCollisionsEnabledChanged(enabled) {
|
|||
}
|
||||
|
||||
function onNewCollisionSoundUrl(url) {
|
||||
console.debug('onNewCollisionSoundUrl: ', url);
|
||||
if(currentAvatarSettings.collisionSoundUrl !== url) {
|
||||
currentAvatarSettings.collisionSoundUrl = url;
|
||||
sendToQml({'method' : 'settingChanged', 'name' : 'collisionSoundUrl', 'value' : url})
|
||||
|
@ -144,7 +124,6 @@ function onNewCollisionSoundUrl(url) {
|
|||
}
|
||||
|
||||
function onAnimGraphUrlChanged(url) {
|
||||
console.debug('onAnimGraphUrlChanged: ', url);
|
||||
if(currentAvatarSettings.animGraphUrl !== url) {
|
||||
currentAvatarSettings.animGraphUrl = url;
|
||||
sendToQml({'method' : 'settingChanged', 'name' : 'animGraphUrl', 'value' : url})
|
||||
|
@ -160,8 +139,6 @@ var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
|
|||
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("html/js/marketplacesInject.js");
|
||||
|
||||
function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml.
|
||||
console.debug('fromQml: message = ', JSON.stringify(message, null, '\t'))
|
||||
|
||||
switch (message.method) {
|
||||
case 'getAvatars':
|
||||
currentAvatar = getMyAvatar();
|
||||
|
@ -174,33 +151,25 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
'currentAvatarSettings' : currentAvatarSettings
|
||||
};
|
||||
|
||||
console.debug('avatarapp.js: currentAvatarSettings: ', JSON.stringify(message.data.currentAvatarSettings, null, '\t'))
|
||||
console.debug('avatarapp.js: currentAvatar: ', JSON.stringify(message.data.currentAvatar, null, '\t'))
|
||||
sendToQml(message)
|
||||
break;
|
||||
case 'selectAvatar':
|
||||
console.debug('avatarapp.js: selecting avatar: ', message.name);
|
||||
AvatarBookmarks.loadBookmark(message.name);
|
||||
break;
|
||||
case 'deleteAvatar':
|
||||
console.debug('avatarapp.js: deleting avatar: ', message.name);
|
||||
AvatarBookmarks.removeBookmark(message.name);
|
||||
break;
|
||||
case 'addAvatar':
|
||||
console.debug('avatarapp.js: saving avatar: ', message.name);
|
||||
AvatarBookmarks.addBookmark(message.name);
|
||||
break;
|
||||
case 'adjustWearable':
|
||||
if(message.properties.localRotationAngles) {
|
||||
message.properties.localRotation = Quat.fromVec3Degrees(message.properties.localRotationAngles)
|
||||
}
|
||||
console.debug('Entities.editEntity(message.entityID, message.properties)'.replace('message.entityID', message.entityID).replace('message.properties', JSON.stringify(message.properties)));
|
||||
Entities.editEntity(message.entityID, message.properties);
|
||||
sendToQml({'method' : 'wearableUpdated', 'entityID' : message.entityID, wearableIndex : message.wearableIndex, properties : message.properties, updateUI : false})
|
||||
break;
|
||||
case 'adjustWearablesOpened':
|
||||
console.debug('avatarapp.js: adjustWearablesOpened');
|
||||
|
||||
currentAvatarWearablesBackup = getMyAvatarWearables();
|
||||
adjustWearables.setOpened(true);
|
||||
|
||||
|
@ -209,17 +178,13 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
Messages.messageReceived.connect(handleWearableMessages);
|
||||
break;
|
||||
case 'adjustWearablesClosed':
|
||||
console.debug('avatarapp.js: adjustWearablesClosed');
|
||||
|
||||
if(!message.save) {
|
||||
// revert changes using snapshot of wearables
|
||||
console.debug('reverting... ');
|
||||
if(currentAvatarWearablesBackup !== null) {
|
||||
AvatarBookmarks.updateAvatarEntities(currentAvatarWearablesBackup);
|
||||
updateAvatarWearables(currentAvatar, message.avatarName);
|
||||
}
|
||||
} else {
|
||||
console.debug('saving... ');
|
||||
sendToQml({'method' : 'updateAvatarInBookmarks'});
|
||||
}
|
||||
|
||||
|
@ -233,19 +198,16 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
ensureWearableSelected(message.entityID);
|
||||
break;
|
||||
case 'deleteWearable':
|
||||
console.debug('avatarapp.js: deleteWearable: ', message.entityID, 'from avatar: ', message.avatarName);
|
||||
Entities.deleteEntity(message.entityID);
|
||||
updateAvatarWearables(currentAvatar, message.avatarName);
|
||||
break;
|
||||
case 'changeDisplayName':
|
||||
console.debug('avatarapp.js: changeDisplayName: ', message.displayName);
|
||||
if (MyAvatar.displayName !== message.displayName) {
|
||||
MyAvatar.displayName = message.displayName;
|
||||
UserActivityLogger.palAction("display_name_change", message.displayName);
|
||||
}
|
||||
break;
|
||||
case 'applyExternalAvatar':
|
||||
console.debug('avatarapp.js: applyExternalAvatar: ', message.avatarURL);
|
||||
var currentAvatarURL = MyAvatar.getFullAvatarURLFromPreferences();
|
||||
if(currentAvatarURL !== message.avatarURL) {
|
||||
MyAvatar.useFullAvatarURL(message.avatarURL);
|
||||
|
@ -253,7 +215,6 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
}
|
||||
break;
|
||||
case 'navigate':
|
||||
console.debug('avatarapp.js: navigate: ', message.url);
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system")
|
||||
if(message.url.indexOf('app://') === 0) {
|
||||
if(message.url === 'app://marketplace') {
|
||||
|
@ -270,19 +231,16 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
|
||||
break;
|
||||
case 'setScale':
|
||||
console.debug('avatarapp.js: setScale: ', message.avatarScale);
|
||||
notifyScaleChanged = false;
|
||||
MyAvatar.setAvatarScale(message.avatarScale);
|
||||
currentAvatar.avatarScale = message.avatarScale;
|
||||
notifyScaleChanged = true;
|
||||
break;
|
||||
case 'revertScale':
|
||||
console.debug('avatarapp.js: revertScale: ', message.avatarScale);
|
||||
MyAvatar.setAvatarScale(message.avatarScale);
|
||||
currentAvatar.avatarScale = message.avatarScale;
|
||||
break;
|
||||
case 'saveSettings':
|
||||
console.debug('avatarapp.js: saveSettings: ', JSON.stringify(message.settings, 0, 4));
|
||||
MyAvatar.setAvatarScale(message.avatarScale);
|
||||
currentAvatar.avatarScale = message.avatarScale;
|
||||
|
||||
|
@ -292,7 +250,6 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
MyAvatar.setAnimGraphUrl(message.settings.animGraphUrl);
|
||||
|
||||
settings = getMyAvatarSettings();
|
||||
console.debug('saveSettings: settings: ', JSON.stringify(settings, 0, 4));
|
||||
break;
|
||||
default:
|
||||
print('Unrecognized message from AvatarApp.qml:', JSON.stringify(message));
|
||||
|
@ -320,8 +277,6 @@ function isGrabbable(entityID) {
|
|||
}
|
||||
|
||||
function setGrabbable(entityID, grabbable) {
|
||||
console.debug('making entity', entityID, grabbable ? 'grabbable' : 'not grabbable');
|
||||
|
||||
var properties = Entities.getEntityProperties(entityID, ['clientOnly', 'userData']);
|
||||
if (properties.clientOnly) {
|
||||
var userData;
|
||||
|
@ -351,8 +306,6 @@ function ensureWearableSelected(entityID) {
|
|||
}
|
||||
|
||||
selectedAvatarEntityID = entityID;
|
||||
console.debug('ensureWearableSelected: selectedAvatarEntity = ', selectedAvatarEntityID);
|
||||
|
||||
selectedAvatarEntityGrabbable = isGrabbable(entityID);
|
||||
|
||||
if(selectedAvatarEntityID !== null) {
|
||||
|
@ -370,12 +323,8 @@ function isEntityBeingWorn(entityID) {
|
|||
};
|
||||
|
||||
function onSelectedEntity(entityID, pointerEvent) {
|
||||
console.debug('onSelectedEntity: clicked on wearable', entityID);
|
||||
|
||||
if(selectedAvatarEntityID !== entityID && isEntityBeingWorn(entityID))
|
||||
{
|
||||
console.debug('onSelectedEntity: clicked on worn wearable', entityID);
|
||||
|
||||
if(ensureWearableSelected(entityID)) {
|
||||
sendToQml({'method' : 'selectAvatarEntity', 'entityID' : selectedAvatarEntityID});
|
||||
}
|
||||
|
@ -391,28 +340,18 @@ function handleWearableMessages(channel, message, sender) {
|
|||
|
||||
try {
|
||||
parsedMessage = JSON.parse(message);
|
||||
console.debug('handleWearableMessages: ', JSON.stringify(parsedMessage, null, 4));
|
||||
} catch (e) {
|
||||
print('error parsing wearable message');
|
||||
return;
|
||||
}
|
||||
|
||||
var entityID = parsedMessage.grabbedEntity;
|
||||
console.debug('item worn: ', isEntityBeingWorn(entityID))
|
||||
|
||||
if(parsedMessage.action === 'grab') {
|
||||
console.debug('handleWearableMessages: grab: ', JSON.stringify(parsedMessage, null, 4));
|
||||
|
||||
if(selectedAvatarEntityID !== entityID) {
|
||||
ensureWearableSelected(entityID);
|
||||
sendToQml({'method' : 'selectAvatarEntity', 'entityID' : selectedAvatarEntityID});
|
||||
}
|
||||
|
||||
console.debug('creating grabbedAvatarEntityChangeNotifier: ', grabbedAvatarEntityChangeNotifier);
|
||||
|
||||
grabbedAvatarEntityChangeNotifier = Script.setInterval(function() {
|
||||
console.debug('grabbedAvatarEntityChangeNotifier callback')
|
||||
|
||||
// for some reasons Entities.getEntityProperties returns more than was asked..
|
||||
var propertyNames = ['localPosition', 'localRotation', 'dimensions', 'naturalDimensions'];
|
||||
var entityProperties = Entities.getEntityProperties(selectedAvatarEntityID, propertyNames);
|
||||
|
@ -427,10 +366,7 @@ function handleWearableMessages(channel, message, sender) {
|
|||
|
||||
}, 1000);
|
||||
} else if(parsedMessage.action === 'release') {
|
||||
console.debug('handleWearableMessages: release: ', JSON.stringify(parsedMessage, null, 4));
|
||||
|
||||
if(grabbedAvatarEntityChangeNotifier !== null) {
|
||||
console.debug('clearing grabbedAvatarEntityChangeNotifier: ', grabbedAvatarEntityChangeNotifier);
|
||||
Script.clearInterval(grabbedAvatarEntityChangeNotifier);
|
||||
grabbedAvatarEntityChangeNotifier = null;
|
||||
}
|
||||
|
@ -438,27 +374,21 @@ function handleWearableMessages(channel, message, sender) {
|
|||
}
|
||||
|
||||
function sendToQml(message) {
|
||||
console.debug('avatarapp.js: sendToQml: ', JSON.stringify(message, 0, 4));
|
||||
tablet.sendToQml(message);
|
||||
}
|
||||
|
||||
function onBookmarkLoaded(bookmarkName) {
|
||||
console.debug('avatarapp.js: scheduling onBookmarkLoaded: ', bookmarkName);
|
||||
|
||||
executeLater(function() {
|
||||
currentAvatar = getMyAvatar();
|
||||
console.debug('avatarapp.js: executing onBookmarkLoaded: ', JSON.stringify(currentAvatar, 0, 4));
|
||||
sendToQml({'method' : 'bookmarkLoaded', 'data' : {'name' : bookmarkName, 'currentAvatar' : currentAvatar} });
|
||||
});
|
||||
}
|
||||
|
||||
function onBookmarkDeleted(bookmarkName) {
|
||||
console.debug('avatarapp.js: onBookmarkDeleted: ', bookmarkName);
|
||||
sendToQml({'method' : 'bookmarkDeleted', 'name' : bookmarkName});
|
||||
}
|
||||
|
||||
function onBookmarkAdded(bookmarkName) {
|
||||
console.debug('avatarapp.js: onBookmarkAdded: ', bookmarkName);
|
||||
sendToQml({ 'method': 'bookmarkAdded', 'bookmarkName': bookmarkName, 'bookmark': AvatarBookmarks.getBookmark(bookmarkName) });
|
||||
}
|
||||
|
||||
|
@ -485,8 +415,6 @@ startup();
|
|||
|
||||
var isWired = false;
|
||||
function off() {
|
||||
console.debug('entering avatarapp.js: off');
|
||||
|
||||
if (isWired) { // It is not ok to disconnect these twice, hence guard.
|
||||
tablet.tabletShownChanged.disconnect(tabletVisibilityChanged);
|
||||
isWired = false;
|
||||
|
@ -510,13 +438,9 @@ function off() {
|
|||
MyAvatar.newCollisionSoundURL.disconnect(onNewCollisionSoundUrl);
|
||||
MyAvatar.animGraphUrlChanged.disconnect(onAnimGraphUrlChanged);
|
||||
MyAvatar.targetScaleChanged.disconnect(onTargetScaleChanged);
|
||||
|
||||
console.debug('exiting avatarapp.js: off');
|
||||
}
|
||||
|
||||
function on() {
|
||||
console.debug('entering avatarapp.js: on');
|
||||
|
||||
AvatarBookmarks.bookmarkLoaded.connect(onBookmarkLoaded);
|
||||
AvatarBookmarks.bookmarkDeleted.connect(onBookmarkDeleted);
|
||||
AvatarBookmarks.bookmarkAdded.connect(onBookmarkAdded);
|
||||
|
@ -526,8 +450,6 @@ function on() {
|
|||
MyAvatar.newCollisionSoundURL.connect(onNewCollisionSoundUrl);
|
||||
MyAvatar.animGraphUrlChanged.connect(onAnimGraphUrlChanged);
|
||||
MyAvatar.targetScaleChanged.connect(onTargetScaleChanged);
|
||||
|
||||
console.debug('exiting avatarapp.js: on');
|
||||
}
|
||||
|
||||
function tabletVisibilityChanged() {
|
||||
|
@ -551,13 +473,11 @@ var hasEventBridge = false;
|
|||
function wireEventBridge(on) {
|
||||
if (on) {
|
||||
if (!hasEventBridge) {
|
||||
console.debug('tablet.fromQml.connect')
|
||||
tablet.fromQml.connect(fromQml);
|
||||
hasEventBridge = true;
|
||||
}
|
||||
} else {
|
||||
if (hasEventBridge) {
|
||||
console.debug('tablet.fromQml.disconnect')
|
||||
tablet.fromQml.disconnect(fromQml);
|
||||
hasEventBridge = false;
|
||||
}
|
||||
|
@ -566,18 +486,14 @@ function wireEventBridge(on) {
|
|||
|
||||
var onAvatarAppScreen = false;
|
||||
function onTabletScreenChanged(type, url) {
|
||||
console.debug('avatarapp.js: onTabletScreenChanged: ', type, url);
|
||||
|
||||
var onAvatarAppScreenNow = (type === "QML" && url === AVATARAPP_QML_SOURCE);
|
||||
wireEventBridge(onAvatarAppScreenNow);
|
||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
||||
button.editProperties({isActive: onAvatarAppScreenNow});
|
||||
|
||||
if (!onAvatarAppScreen && onAvatarAppScreenNow) {
|
||||
console.debug('entering avatarapp');
|
||||
on();
|
||||
} else if(onAvatarAppScreen && !onAvatarAppScreenNow) {
|
||||
console.debug('leaving avatarapp');
|
||||
off();
|
||||
}
|
||||
|
||||
|
@ -593,13 +509,9 @@ function onTabletScreenChanged(type, url) {
|
|||
|
||||
sendToQml(message)
|
||||
}
|
||||
|
||||
console.debug('onAvatarAppScreenNow: ', onAvatarAppScreenNow);
|
||||
}
|
||||
|
||||
function shutdown() {
|
||||
console.debug('shutdown: adjustWearables.opened', adjustWearables.opened);
|
||||
|
||||
if (onAvatarAppScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue