3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-27 16:55:26 +02:00

Merge branch 'android' into android_new

This commit is contained in:
Brad Davis 2018-01-19 14:40:01 -08:00
commit 3e7872637d
20 changed files with 261 additions and 85 deletions

Binary file not shown.

After

(image error) Size: 52 KiB

View file

@ -214,6 +214,7 @@
#include "commerce/QmlCommerce.h"
#include "webbrowser/WebBrowserSuggestionsEngine.h"
#include <DesktopPreviewProvider.h>
#if defined(Q_OS_WIN)
#include <VersionHelpers.h>
@ -631,6 +632,24 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, cacheDir);
}
// FIXME fix the OSX installer to install the resources.rcc binary instead of resource files and remove
// this conditional exclusion
#if !defined(Q_OS_OSX)
{
#if defined(Q_OS_ANDROID)
const QString resourcesBinaryFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/resources.rcc";
#else
const QString resourcesBinaryFile = QCoreApplication::applicationDirPath() + "/resources.rcc";
#endif
if (!QFile::exists(resourcesBinaryFile)) {
throw std::runtime_error("Unable to find primary resources");
}
if (!QResource::registerResource(resourcesBinaryFile)) {
throw std::runtime_error("Unable to load primary resources");
}
}
#endif
Setting::init();
// Tell the plugin manager about our statically linked plugins
@ -670,6 +689,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
DependencyManager::set<PickScriptingInterface>();
DependencyManager::set<Cursor::Manager>();
DependencyManager::set<VirtualPad::Manager>();
DependencyManager::set<DesktopPreviewProvider>();
DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp));
DependencyManager::set<StatTracker>();
DependencyManager::set<ScriptEngines>(ScriptEngine::CLIENT_SCRIPT);
@ -817,24 +837,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
{
// FIXME fix the OSX installer to install the resources.rcc binary instead of resource files and remove
// this conditional exclusion
#if !defined(Q_OS_OSX)
{
#if defined(Q_OS_ANDROID)
const QString resourcesBinaryFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/resources.rcc";
#else
const QString resourcesBinaryFile = applicationDirPath() + "/resources.rcc";
#endif
if (!QFile::exists(resourcesBinaryFile)) {
throw std::runtime_error("Unable to find primary resources");
}
if (!QResource::registerResource(resourcesBinaryFile)) {
throw std::runtime_error("Unable to load primary resources");
}
}
#endif
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
@ -5853,6 +5855,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor);
scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
scriptEngine->registerGlobalObject("DesktopPreviewProvider", DependencyManager::get<DesktopPreviewProvider>().data());
scriptEngine->registerGlobalObject("Stats", Stats::getInstance());
scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
scriptEngine->registerGlobalObject("Snapshot", DependencyManager::get<Snapshot>().data());

View file

@ -277,7 +277,8 @@ void WindowScriptingInterface::browseAsync(const QString& title, const QString&
if (!result.isEmpty()) {
setPreviousBrowseLocation(QFileInfo(result).absolutePath());
}
emit openFileChanged(result);
emit browseChanged(result);
emit openFileChanged(result); // Deprecated signal; to be removed in due course.
});
}

View file

@ -197,18 +197,19 @@ public slots:
/**jsdoc
* Prompt the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A
* {@link Window.openFileChanged|openFileChanged} signal is emitted when a file is chosen; no signal is emitted if the user
* {@link Window.browseChanged|browseChanged} signal is emitted when a file is chosen; no signal is emitted if the user
* cancels the dialog.
* @deprecated A deprecated {@link Window.openFileChanged|openFileChanged} signal is also emitted when a file is chosen.
* @function Window.browseAsync
* @param {string} title="" - The title to display at the top of the dialog.
* @param {string} directory="" - The initial directory to start browsing at.
* @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and
* <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified.
* @example <caption>Ask the user to choose an image file without waiting for the answer.</caption>
* function onOpenFileChanged(filename) {
* function onBrowseChanged(filename) {
* print("File: " + filename);
* }
* Window.openFileChanged.connect(onOpenFileChanged);
* Window.browseChanged.connect(onBrowseChanged);
*
* Window.browseAsync("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)");
* print("Script continues without waiting");
@ -659,9 +660,18 @@ signals:
*/
void saveFileChanged(QString filename);
/**jsdoc
* Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog.
* @function Window.browseChanged
* @param {string} filename - The path and name of the file the user chose in the dialog.
* @returns {Signal}
*/
void browseChanged(QString filename);
/**jsdoc
* Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog.
* @function Window.openFileChanged
* @deprecated This signal is being replaced with {@link Window.browseChanged|browseChanged} and will be removed.
* @param {string} filename - The path and name of the file the user chose in the dialog.
* @returns {Signal}
*/

View file

@ -33,6 +33,7 @@
#include "../Logging.h"
#include "../CompositorHelper.h"
#include "DesktopPreviewProvider.h"
#include "render-utils/hmd_ui_vert.h"
#include "render-utils/hmd_ui_frag.h"
@ -254,17 +255,9 @@ void HmdDisplayPlugin::internalPresent() {
swapBuffers();
} else if (_clearPreviewFlag) {
QImage image;
if (_vsyncEnabled) {
image = QImage(PathUtils::resourcesPath() + "images/preview.png");
} else {
image = QImage(PathUtils::resourcesPath() + "images/preview-disabled.png");
}
image = image.mirrored();
image = image.convertToFormat(QImage::Format_RGBA8888);
if (!_previewTexture) {
_previewTexture = gpu::Texture::createStrict(
QImage image = DesktopPreviewProvider::getInstance()->getPreviewDisabledImage(_vsyncEnabled);
_previewTexture = gpu::Texture::createStrict(
gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA),
image.width(), image.height(),
gpu::Texture::MAX_NUM_MIPS,
@ -274,7 +267,6 @@ void HmdDisplayPlugin::internalPresent() {
_previewTexture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA));
_previewTexture->assignStoredMip(0, image.byteCount(), image.constBits());
_previewTexture->setAutoGenerateMips(true);
}
auto viewport = getViewportForSourceSize(uvec2(_previewTexture->getDimensions()));

View file

@ -1394,8 +1394,14 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
// That is where _currentFrame and _lastAnimated were updated.
if (_animating) {
DETAILED_PROFILE_RANGE(simulation_physics, "Animate");
if (!jointsMapped()) {
mapJoints(entity, model->getJointNames());
//else the joint have been mapped before but we have a new animation to load
} else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
_jointMappingCompleted = false;
mapJoints(entity, model->getJointNames());
}
if (!(entity->getAnimationFirstFrame() < 0) && !(entity->getAnimationFirstFrame() > entity->getAnimationLastFrame())) {
animate(entity);

View file

@ -368,6 +368,7 @@ public:
void* getPhysicsInfo() const { return _physicsInfo; }
void setPhysicsInfo(void* data) { _physicsInfo = data; }
EntityTreeElementPointer getElement() const { return _element; }
EntityTreePointer getTree() const;
virtual SpatialParentTree* getParentTree() const override;

View file

@ -256,25 +256,32 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
assert(_entity);
assert(entityTreeIsLocked());
measureBodyAcceleration();
bool positionSuccess;
_entity->setWorldPosition(bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset(), positionSuccess, false);
if (!positionSuccess) {
static QString repeatedMessage =
LogHandler::getInstance().addRepeatedMessageRegex("EntityMotionState::setWorldTransform "
"setPosition failed.*");
qCDebug(physics) << "EntityMotionState::setWorldTransform setPosition failed" << _entity->getID();
// If transform or velocities are flagged as dirty it means a network or scripted change
// occured between the beginning and end of the stepSimulation() and we DON'T want to apply
// these physics simulation results.
uint32_t flags = _entity->getDirtyFlags() & (Simulation::DIRTY_TRANSFORM | Simulation::DIRTY_VELOCITIES);
if (!flags) {
// flags are clear
_entity->setWorldTransform(bulletToGLM(worldTrans.getOrigin()), bulletToGLM(worldTrans.getRotation()));
_entity->setWorldVelocity(getBodyLinearVelocity());
_entity->setWorldAngularVelocity(getBodyAngularVelocity());
_entity->setLastSimulated(usecTimestampNow());
} else {
// only set properties NOT flagged
if (!(flags & Simulation::DIRTY_TRANSFORM)) {
_entity->setWorldTransform(bulletToGLM(worldTrans.getOrigin()), bulletToGLM(worldTrans.getRotation()));
}
if (!(flags & Simulation::DIRTY_LINEAR_VELOCITY)) {
_entity->setWorldVelocity(getBodyLinearVelocity());
}
if (!(flags & Simulation::DIRTY_ANGULAR_VELOCITY)) {
_entity->setWorldAngularVelocity(getBodyAngularVelocity());
}
if (flags != (Simulation::DIRTY_TRANSFORM | Simulation::DIRTY_VELOCITIES)) {
_entity->setLastSimulated(usecTimestampNow());
}
}
bool orientationSuccess;
_entity->setWorldOrientation(bulletToGLM(worldTrans.getRotation()), orientationSuccess, false);
if (!orientationSuccess) {
static QString repeatedMessage =
LogHandler::getInstance().addRepeatedMessageRegex("EntityMotionState::setWorldTransform "
"setOrientation failed.*");
qCDebug(physics) << "EntityMotionState::setWorldTransform setOrientation failed" << _entity->getID();
}
_entity->setVelocity(getBodyLinearVelocity());
_entity->setAngularVelocity(getBodyAngularVelocity());
_entity->setLastSimulated(usecTimestampNow());
if (_entity->getSimulatorID().isNull()) {
_loopsWithoutOwner++;
@ -530,9 +537,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
if (!_body->isActive()) {
// make sure all derivatives are zero
_entity->setVelocity(Vectors::ZERO);
_entity->setAngularVelocity(Vectors::ZERO);
_entity->setAcceleration(Vectors::ZERO);
zeroCleanObjectVelocities();
_numInactiveUpdates++;
} else {
glm::vec3 gravity = _entity->getGravity();
@ -559,9 +564,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
if (movingSlowly) {
// velocities might not be zero, but we'll fake them as such, which will hopefully help convince
// other simulating observers to deactivate their own copies
glm::vec3 zero(0.0f);
_entity->setVelocity(zero);
_entity->setAngularVelocity(zero);
zeroCleanObjectVelocities();
}
}
_numInactiveUpdates = 0;
@ -818,3 +821,22 @@ bool EntityMotionState::shouldBeLocallyOwned() const {
void EntityMotionState::upgradeOutgoingPriority(uint8_t priority) {
_outgoingPriority = glm::max<uint8_t>(_outgoingPriority, priority);
}
void EntityMotionState::zeroCleanObjectVelocities() const {
// If transform or velocities are flagged as dirty it means a network or scripted change
// occured between the beginning and end of the stepSimulation() and we DON'T want to apply
// these physics simulation results.
uint32_t flags = _entity->getDirtyFlags() & (Simulation::DIRTY_TRANSFORM | Simulation::DIRTY_VELOCITIES);
if (!flags) {
_entity->setWorldVelocity(glm::vec3(0.0f));
_entity->setWorldAngularVelocity(glm::vec3(0.0f));
} else {
if (!(flags & Simulation::DIRTY_LINEAR_VELOCITY)) {
_entity->setWorldVelocity(glm::vec3(0.0f));
}
if (!(flags & Simulation::DIRTY_ANGULAR_VELOCITY)) {
_entity->setWorldAngularVelocity(glm::vec3(0.0f));
}
}
_entity->setAcceleration(glm::vec3(0.0f));
}

View file

@ -87,6 +87,7 @@ public:
protected:
// changes _outgoingPriority only if priority is larger
void upgradeOutgoingPriority(uint8_t priority);
void zeroCleanObjectVelocities() const;
#ifdef WANT_DEBUG_ENTITY_TREE_LOCKS
bool entityTreeIsLocked() const;

View file

@ -186,7 +186,7 @@ float specularDistribution(SurfaceData surface) {
// Add geometric factors G1(n,l) and G1(n,v)
float smithInvG1NdotL = evalSmithInvG1(surface.roughness4, surface.ndotl);
denom *= surface.smithInvG1NdotV * smithInvG1NdotL;
// Don't divide by PI as it will be done later
// Don't divide by PI as this is part of the light normalization factor
float power = surface.roughness4 / denom;
return power;
}
@ -202,12 +202,11 @@ vec4 evalPBRShading(float metallic, vec3 fresnel, SurfaceData surface) {
vec3 specular = fresnelColor * power * angleAttenuation;
float diffuse = (1.0 - metallic) * angleAttenuation * (1.0 - fresnelColor.x);
diffuse /= 3.1415926;
// Diffuse is divided by PI but specular isn't because an infinitesimal volume light source
// has a multiplier of PI, says Naty Hoffman.
// We don't divided by PI, as the "normalized" equations state we should, because we decide, as Naty Hoffman, that
// we wish to have a similar color as raw albedo on a perfectly diffuse surface perpendicularly lit
// by a white light of intensity 1. But this is an arbitrary normalization of what light intensity "means".
// (see http://blog.selfshadow.com/publications/s2013-shading-course/hoffman/s2013_pbs_physics_math_notes.pdf
// page 23 paragraph "Punctual light sources")
return vec4(specular, diffuse);
}
@ -222,9 +221,9 @@ vec4 evalPBRShadingDielectric(SurfaceData surface, float fresnel) {
vec3 specular = vec3(fresnelScalar) * power * angleAttenuation;
float diffuse = angleAttenuation * (1.0 - fresnelScalar);
diffuse /= 3.1415926;
// Diffuse is divided by PI but specular isn't because an infinitesimal volume light source
// has a multiplier of PI, says Naty Hoffman.
// We don't divided by PI, as the "normalized" equations state we should, because we decide, as Naty Hoffman, that
// we wish to have a similar color as raw albedo on a perfectly diffuse surface perpendicularly lit
// by a white light of intensity 1. But this is an arbitrary normalization of what light intensity "means".
// (see http://blog.selfshadow.com/publications/s2013-shading-course/hoffman/s2013_pbs_physics_math_notes.pdf
// page 23 paragraph "Punctual light sources")
return vec4(specular, diffuse);
@ -239,8 +238,9 @@ vec4 evalPBRShadingMetallic(SurfaceData surface, vec3 fresnel) {
float power = specularDistribution(surface);
vec3 specular = fresnelColor * power * angleAttenuation;
// Specular isn't divided by PI because an infinitesimal volume light source
// has a multiplier of PI, says Naty Hoffman.
// We don't divided by PI, as the "normalized" equations state we should, because we decide, as Naty Hoffman, that
// we wish to have a similar color as raw albedo on a perfectly diffuse surface perpendicularly lit
// by a white light of intensity 1. But this is an arbitrary normalization of what light intensity "means".
// (see http://blog.selfshadow.com/publications/s2013-shading-course/hoffman/s2013_pbs_physics_math_notes.pdf
// page 23 paragraph "Punctual light sources")
return vec4(specular, 0.f);

View file

@ -253,6 +253,7 @@ glm::vec2 getFacingDir2D(const glm::mat4& m);
inline bool isNaN(const glm::vec3& value) { return isNaN(value.x) || isNaN(value.y) || isNaN(value.z); }
inline bool isNaN(const glm::quat& value) { return isNaN(value.w) || isNaN(value.x) || isNaN(value.y) || isNaN(value.z); }
inline bool isNaN(const glm::mat3& value) { return isNaN(value * glm::vec3(1.0f)); }
glm::mat4 orthoInverse(const glm::mat4& m);

View file

@ -464,6 +464,36 @@ glm::vec3 SpatiallyNestable::localToWorldDimensions(const glm::vec3& dimensions,
return dimensions;
}
void SpatiallyNestable::setWorldTransform(const glm::vec3& position, const glm::quat& orientation) {
// guard against introducing NaN into the transform
if (isNaN(orientation) || isNaN(position)) {
return;
}
bool changed = false;
bool success = true;
Transform parentTransform = getParentTransform(success);
_transformLock.withWriteLock([&] {
Transform myWorldTransform;
Transform::mult(myWorldTransform, parentTransform, _transform);
if (myWorldTransform.getRotation() != orientation) {
changed = true;
myWorldTransform.setRotation(orientation);
}
if (myWorldTransform.getTranslation() != position) {
changed = true;
myWorldTransform.setTranslation(position);
}
if (changed) {
Transform::inverseMult(_transform, parentTransform, myWorldTransform);
_translationChanged = usecTimestampNow();
}
});
if (success && changed) {
locationChanged(false);
}
}
glm::vec3 SpatiallyNestable::getWorldPosition(bool& success) const {
return getTransform(success).getTranslation();
}

View file

@ -87,6 +87,7 @@ public:
virtual Transform getParentTransform(bool& success, int depth = 0) const;
void setWorldTransform(const glm::vec3& position, const glm::quat& orientation);
virtual glm::vec3 getWorldPosition(bool& success) const;
virtual glm::vec3 getWorldPosition() const;
virtual void setWorldPosition(const glm::vec3& position, bool& success, bool tellPhysics = true);

View file

@ -0,0 +1,46 @@
#include "DesktopPreviewProvider.h"
#include <PathUtils.h>
#include <QMetaEnum>
#include <QtPlugin>
#include <cassert>
DesktopPreviewProvider::DesktopPreviewProvider() {
}
constexpr const char* DesktopPreviewProvider::imagePaths[];
QSharedPointer<DesktopPreviewProvider> DesktopPreviewProvider::getInstance() {
static QSharedPointer<DesktopPreviewProvider> instance = DependencyManager::get<DesktopPreviewProvider>();
return instance;
}
QImage DesktopPreviewProvider::getPreviewDisabledImage(bool vsyncEnabled) const {
auto imageIndex = vsyncEnabled ? VSYNC : m_previewDisabledReason;
assert(imageIndex >= 0 && imageIndex <= VSYNC);
return !m_previewDisabled[imageIndex].isNull() ? m_previewDisabled[imageIndex] : loadPreviewImage(m_previewDisabled[imageIndex], PathUtils::resourcesPath() + imagePaths[imageIndex]);
}
void DesktopPreviewProvider::setPreviewDisabledReason(PreviewDisabledReasons reason) {
if (reason == VSYNC) {
qDebug() << "Preview disabled reason can't be forced to " << QMetaEnum::fromType<DesktopPreviewProvider::PreviewDisabledReasons>().valueToKey(reason);
return; // Not settable via this interface, as VSYNC is controlled by HMD plugin..
}
m_previewDisabledReason = reason;
}
void DesktopPreviewProvider::setPreviewDisabledReason(const QString& reasonString) {
PreviewDisabledReasons reason = USER;
bool ok = false;
reason = (PreviewDisabledReasons) QMetaEnum::fromType<DesktopPreviewProvider::PreviewDisabledReasons>().keyToValue(reasonString.toLatin1().data(), &ok);
if (ok) {
setPreviewDisabledReason(reason);
}
}
QImage& DesktopPreviewProvider::loadPreviewImage(QImage& image, const QString& path) const {
return image = QImage(path).mirrored().convertToFormat(QImage::Format_RGBA8888);
}

View file

@ -0,0 +1,47 @@
//
// Created by Alexander Ivash on 2018/01/08
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <DependencyManager.h>
#include <QImage>
class DesktopPreviewProvider : public QObject, public Dependency {
SINGLETON_DEPENDENCY
Q_OBJECT
DesktopPreviewProvider();
DesktopPreviewProvider(const DesktopPreviewProvider& other) = delete;
constexpr static const char* imagePaths[] = {
"images/preview-disabled.png", // USER
"images/preview-privacy.png", // SECURE_SCREEN
"images/preview.png", // VSYNC
};
public:
enum PreviewDisabledReasons {
USER = 0,
SECURE_SCREEN,
VSYNC // Not settable via this interface, as VSYNC is controlled by HMD plugin..
};
Q_ENUM(PreviewDisabledReasons)
static QSharedPointer<DesktopPreviewProvider> getInstance();
QImage getPreviewDisabledImage(bool vsyncEnabled) const;
void setPreviewDisabledReason(PreviewDisabledReasons reason);
public slots:
void setPreviewDisabledReason(const QString& reason);
private:
QImage& loadPreviewImage(QImage& image, const QString& path) const;
PreviewDisabledReasons m_previewDisabledReason = { USER };
mutable QImage m_previewDisabled[3];
};

View file

@ -562,9 +562,11 @@
break;
case 'disableHmdPreview':
isHmdPreviewDisabled = Menu.isOptionChecked("Disable Preview");
DesktopPreviewProvider.setPreviewDisabledReason("SECURE_SCREEN");
Menu.setIsOptionChecked("Disable Preview", true);
break;
case 'maybeEnableHmdPreview':
DesktopPreviewProvider.setPreviewDisabledReason("USER");
Menu.setIsOptionChecked("Disable Preview", isHmdPreviewDisabled);
break;
case 'passphraseReset':
@ -635,7 +637,11 @@
// -Called when the TabletScriptingInterface::screenChanged() signal is emitted. The "type" argument can be either the string
// value of "Home", "Web", "Menu", "QML", or "Closed". The "url" argument is only valid for Web and QML.
function onTabletScreenChanged(type, url) {
onWalletScreen = (type === "QML" && url === WALLET_QML_SOURCE);
var onWalletScreenNow = (type === "QML" && url === WALLET_QML_SOURCE);
if (!onWalletScreenNow && onWalletScreen) {
DesktopPreviewProvider.setPreviewDisabledReason("USER");
}
onWalletScreen = onWalletScreenNow;
wireEventBridge(onWalletScreen);
// Change button to active when window is first openend, false otherwise.
if (button) {

View file

@ -370,20 +370,23 @@ Script.include("/~/system/libraries/Xform.js");
};
this.isReady = function (controllerData) {
if (this.notPointingAtEntity(controllerData)) {
return makeRunningValues(false, [], []);
}
if (HMD.active) {
if (this.notPointingAtEntity(controllerData)) {
return makeRunningValues(false, [], []);
}
this.distanceHolding = false;
this.distanceRotating = false;
this.distanceHolding = false;
this.distanceRotating = false;
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE) {
this.prepareDistanceRotatingData(controllerData);
return makeRunningValues(true, [], []);
} else {
this.destroyContextOverlay();
return makeRunningValues(false, [], []);
if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE) {
this.prepareDistanceRotatingData(controllerData);
return makeRunningValues(true, [], []);
} else {
this.destroyContextOverlay();
return makeRunningValues(false, [], []);
}
}
return makeRunningValues(false, [], []);
};
this.run = function (controllerData) {

View file

@ -89,7 +89,7 @@
this.isReady = function (controllerData) {
var otherModuleRunning = this.getOtherModule().running;
if (!otherModuleRunning) {
if (!otherModuleRunning && HMD.active) {
if (this.processLaser(controllerData)) {
this.running = true;
return ControllerDispatcherUtils.makeRunningValues(true, [], []);

View file

@ -448,7 +448,7 @@ var toolBar = (function () {
});
addButton("importEntitiesButton", "assets-01.svg", function() {
Window.openFileChanged.connect(onFileOpenChanged);
Window.browseChanged.connect(onFileOpenChanged);
Window.browseAsync("Select Model to Import", "", "*.json");
});
@ -1497,7 +1497,7 @@ function onFileOpenChanged(filename) {
// disconnect the event, otherwise the requests will stack up
try {
// Not all calls to onFileOpenChanged() connect an event.
Window.openFileChanged.disconnect(onFileOpenChanged);
Window.browseChanged.disconnect(onFileOpenChanged);
} catch (e) {
// Ignore.
}
@ -1549,7 +1549,7 @@ function handeMenuEvent(menuItem) {
}
} else if (menuItem === "Import Entities" || menuItem === "Import Entities from URL") {
if (menuItem === "Import Entities") {
Window.openFileChanged.connect(onFileOpenChanged);
Window.browseChanged.connect(onFileOpenChanged);
Window.browseAsync("Select Model to Import", "", "*.json");
} else {
Window.promptTextChanged.connect(onPromptTextChanged);

View file

@ -539,8 +539,14 @@
return startingUp;
}
function onDomainConnectionRefused(reason) {
createNotification("Connection refused: " + reason, NotificationType.CONNECTION_REFUSED);
function onDomainConnectionRefused(reason, reasonCode) {
// the "login error" reason means that the DS couldn't decrypt the username signature
// since this eventually resolves itself for good actors we don't need to show a notification for it
var LOGIN_ERROR_REASON_CODE = 2;
if (reasonCode != LOGIN_ERROR_REASON_CODE) {
createNotification("Connection refused: " + reason, NotificationType.CONNECTION_REFUSED);
}
}
function onEditError(msg) {