Merge branch 'master' into oauth2-wordpress

This commit is contained in:
Kasen IO 2020-08-05 15:41:13 -04:00
commit 5ba33a521f
9 changed files with 124 additions and 21 deletions

View file

@ -3951,12 +3951,15 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
qCDebug(interfaceapp) << "HMD:" << hasHMD << ", Hand Controllers: " << hasHandControllers << ", Using HMD: " << isUsingHMDAndHandControllers;
// when --url in command line, teleport to location
const QString HIFI_URL_COMMAND_LINE_KEY = "--url";
int urlIndex = arguments().indexOf(HIFI_URL_COMMAND_LINE_KEY);
QString addressLookupString;
if (urlIndex != -1) {
QUrl url(arguments().value(urlIndex + 1));
// when --url in command line, teleport to location
QCommandLineParser parser;
QCommandLineOption urlOption("url", "", "value");
parser.addOption(urlOption);
parser.parse(arguments());
if (parser.isSet(urlOption)) {
QUrl url = QUrl(parser.value(urlOption));
if (url.scheme() == URL_SCHEME_HIFIAPP) {
Setting::Handle<QVariant>("startUpApp").set(url.path());
} else {

View file

@ -407,13 +407,13 @@ void MyCharacterController::clearDetailedMotionStates() {
}
void MyCharacterController::buildPhysicsTransaction(PhysicsEngine::Transaction& transaction) {
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
_detailedMotionStates[i]->forceActive();
for (auto& detailedMotionState : _detailedMotionStates) {
detailedMotionState->forceActive();
}
if (_pendingFlags & PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION) {
_pendingFlags &= ~PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION;
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
transaction.objectsToRemove.push_back(_detailedMotionStates[i]);
for (auto& detailedMotionState : _detailedMotionStates) {
transaction.objectsToRemove.push_back(detailedMotionState);
}
// NOTE: the DetailedMotionStates are deleted after being added to PhysicsEngine::Transaction::_objectsToRemove
// See AvatarManager::handleProcessedPhysicsTransaction()

View file

@ -116,10 +116,10 @@ void OtherAvatar::updateSpaceProxy(workload::Transaction& transaction) const {
int OtherAvatar::parseDataFromBuffer(const QByteArray& buffer) {
int32_t bytesRead = Avatar::parseDataFromBuffer(buffer);
for (size_t i = 0; i < _detailedMotionStates.size(); i++) {
for (auto& detailedMotionState : _detailedMotionStates) {
// NOTE: we activate _detailedMotionStates is because they are KINEMATIC
// and Bullet will automagically call DetailedMotionState::getWorldTransform() when active.
_detailedMotionStates[i]->forceActive();
detailedMotionState->forceActive();
}
if (_moving && _motionState) {
_motionState->addDirtyFlags(Simulation::DIRTY_POSITION);

View file

@ -2793,6 +2793,17 @@ bool EntityTree::sendEntitiesOperation(const OctreeElementPointer& element, void
}
}
QVector<QUuid> oldRenderWithZones = properties.getRenderWithZones();
if (!oldRenderWithZones.isEmpty()) {
QVector<QUuid> newRenderWithZones;
for (QUuid oldRenderWithZoneID : oldRenderWithZones) {
if (args->ourTree->findEntityByEntityItemID(oldRenderWithZoneID)) {
newRenderWithZones.append(getMapped(oldRenderWithZoneID));
}
}
properties.setRenderWithZones(newRenderWithZones);
}
properties.setXNNeighborID(getMapped(properties.getXNNeighborID()));
properties.setXPNeighborID(getMapped(properties.getXPNeighborID()));
properties.setYNNeighborID(getMapped(properties.getYNNeighborID()));

View file

@ -543,12 +543,8 @@ void CharacterController::setLocalBoundingBox(const glm::vec3& minCorner, const
_minStepHeight = DEFAULT_MIN_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
_maxStepHeight = DEFAULT_MAX_STEP_HEIGHT_FACTOR * (_halfHeight + _radius);
if (_physicsEngine) {
// must REMOVE from world prior to shape update
_pendingFlags |= PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION;
}
_pendingFlags |= PENDING_FLAG_UPDATE_SHAPE;
_pendingFlags |= PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION;
_pendingFlags |= PENDING_FLAG_UPDATE_SHAPE | PENDING_FLAG_REMOVE_FROM_SIMULATION | PENDING_FLAG_REMOVE_DETAILED_FROM_SIMULATION |
PENDING_FLAG_ADD_TO_SIMULATION | PENDING_FLAG_ADD_DETAILED_TO_SIMULATION;
}
// it's ok to change offset immediately -- there are no thread safety issues here

View file

@ -389,7 +389,8 @@
function time() {
var d = new Date();
var month = (d.getMonth()).toString();
// Months are returned in range 0-11 instead of 1-12, so we have to add 1.
var month = (d.getMonth() + 1).toString();
var day = (d.getDate()).toString();
var h = (d.getHours()).toString();
var m = (d.getMinutes()).toString();

View file

@ -6,6 +6,7 @@
//
// Created by Fluffy Jenkins January 2020.
// Copyright 2020 Fluffy Jenkins
// Copyright 2020 Vircadia contributors.
//
// For any future coders, please keep me in the loop when making changes.
// Please tag me in any Pull Requests.
@ -98,6 +99,8 @@ function init() {
chatBar.sendToQml(JSON.stringify({visible: false, history: chatBarHistory}));
Controller.keyPressEvent.connect(keyPressEvent);
Messages.messageReceived.connect(messageReceived);
AvatarManager.avatarAddedEvent.connect(avatarJoinsDomain);
AvatarManager.avatarRemovedEvent.connect(avatarLeavesDomain);
connectWebSocket();
}
@ -510,13 +513,17 @@ function messageReceived(channel, message) {
}));
}
}
if (cmd.type === "ShowChatWindow") {
toggleMainChatWindow();
}
}
}
}
function time() {
var d = new Date();
var month = (d.getMonth()).toString();
// Months are returned in range 0-11 instead of 1-12, so we have to add 1.
var month = (d.getMonth() + 1).toString();
var day = (d.getDate()).toString();
var h = (d.getHours()).toString();
var m = (d.getMinutes()).toString();
@ -618,6 +625,46 @@ function setVisible(_visible) {
visible = _visible;
}
function avatarJoinsDomain(sessionID) {
Script.setTimeout(function () {
var messageText = AvatarManager.getPalData([sessionID]).data[0].sessionDisplayName + " has joined."
var messageColor = { red: 122, green: 122, blue: 122 };
addToLog(messageText, "Notice", messageColor, "Domain");
if (!mutedAudio["Domain"]) {
playNotificationSound();
}
if (!muted["Domain"]) {
Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({
sender: "(D)",
text: messageText,
colour: { text: messageColor }
}));
}
}, 500); // Wait 500ms for the avatar to load to properly get info about them.
}
function avatarLeavesDomain(sessionID) {
var messageText = AvatarManager.getPalData([sessionID]).data[0].sessionDisplayName + " has left."
var messageColor = { red: 122, green: 122, blue: 122 };
addToLog(messageText, "Notice", messageColor, "Domain");
if (!mutedAudio["Domain"]) {
playNotificationSound();
}
if (!muted["Domain"]) {
Messages.sendLocalMessage(FLOOF_NOTIFICATION_CHANNEL, JSON.stringify({
sender: "(D)",
text: messageText,
colour: { text: messageColor }
}));
}
}
function keyPressEvent(event) {
if (event.key === H_KEY && !event.isAutoRepeat && event.isControl) {
toggleMainChatWindow()
@ -636,11 +683,25 @@ function shutdown() {
} catch (e) {
// empty
}
try {
AvatarManager.avatarAddedEvent.disconnect(avatarJoinsDomain);
} catch (e) {
// empty
}
try {
AvatarManager.avatarRemovedEvent.disconnect(avatarLeavesDomain);
} catch (e) {
// empty
}
try {
Controller.keyPressEvent.disconnect(keyPressEvent);
} catch (e) {
// empty
}
chatBar.close();
chatHistory.close();
}

View file

@ -1,3 +1,17 @@
//
// notificationCore.js
//
// Created by Fluffy Jenkins January 2020.
// Copyright 2020 Fluffy Jenkins
// Copyright 2020 Vircadia contributors.
//
// For any future coders, please keep me in the loop when making changes.
// Please tag me in any Pull Requests.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
"use strict";
var notificationList = [];
@ -6,6 +20,7 @@ var sizeData = {30: {widthMul: 1.8, heightMul: 2.05, split: 35, size: 30}};
var DEFAULT_SIZE = 30;
var DEFAULT_OFFSET = 10;
var FLOOF_NOTIFICATION_CHANNEL = "Floof-Notif";
var MAIN_CHAT_APP_CHANNEL = "Chat";
var offset = DEFAULT_OFFSET;
@ -161,4 +176,19 @@ function notif(text, colour) {
notificationList.push(noti);
}
Script.scriptEnding.connect(cleanUp);
Controller.mousePressEvent.connect(function (event) {
// Overlays.getOverlayAtPoint applies only to 2D overlays.
var overlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
if (overlay) {
for (var i = 0; i < notificationList.length; i++) {
if (overlay === notificationList[i].id) {
Overlays.deleteOverlay(notificationList[i].id)
Messages.sendMessage(MAIN_CHAT_APP_CHANNEL, JSON.stringify({
type: "ShowChatWindow",
}));
}
}
}
});
Script.scriptEnding.connect(cleanUp);

View file

@ -474,9 +474,10 @@ function takeSnapshot() {
volume: 1.0
});
HMD.closeTablet();
var DOUBLE_RENDER_TIME_TO_MS = 2000; // If rendering is bogged down, allow double the render time to close the tablet.
Script.setTimeout(function () {
Window.takeSnapshot(false, includeAnimated, 1.91);
}, SNAPSHOT_DELAY);
}, Math.max(SNAPSHOT_DELAY, DOUBLE_RENDER_TIME_TO_MS / Rates.render ));
}, FINISH_SOUND_DELAY);
UserActivityLogger.logAction("snaphshot_taken", { location: location.href });
}