mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 00:29:40 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into commerce_QmlWhitelist
This commit is contained in:
commit
c1e990e7be
19 changed files with 28 additions and 278 deletions
|
@ -22,8 +22,7 @@ RowLayout {
|
|||
property var sample: null;
|
||||
property bool isPlaying: false;
|
||||
function createSampleSound() {
|
||||
var SOUND = Qt.resolvedUrl("../../../sounds/sample.wav");
|
||||
sound = SoundCache.getSound(SOUND);
|
||||
sound = ApplicationInterface.getSampleSound();
|
||||
sample = null;
|
||||
}
|
||||
function playSound() {
|
||||
|
|
|
@ -760,7 +760,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_notifiedPacketVersionMismatchThisDomain(false),
|
||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||
_lastFaceTrackerUpdate(0),
|
||||
_snapshotSound(nullptr)
|
||||
_snapshotSound(nullptr),
|
||||
_sampleSound(nullptr)
|
||||
|
||||
{
|
||||
auto steamClient = PluginManager::getInstance()->getSteamClientPlugin();
|
||||
setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
|
||||
|
@ -805,7 +807,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||
#endif
|
||||
|
||||
|
||||
_logger = new FileLogger(this);
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
||||
|
@ -982,6 +983,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
connect(myAvatar.get(), &MyAvatar::positionGoneTo,
|
||||
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
||||
|
||||
// Inititalize sample before registering
|
||||
QFileInfo infSample = QFileInfo(PathUtils::resourcesPath() + "sounds/sample.wav");
|
||||
_sampleSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSample.absoluteFilePath()));
|
||||
|
||||
auto scriptEngines = DependencyManager::get<ScriptEngines>().data();
|
||||
scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){
|
||||
registerScriptEngineWithApplicationServices(engine);
|
||||
|
@ -1788,9 +1793,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
return entityServerNode && !isPhysicsEnabled();
|
||||
});
|
||||
|
||||
QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
||||
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||
|
||||
QFileInfo infSnap = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
|
||||
_snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSnap.absoluteFilePath()));
|
||||
|
||||
QVariant testProperty = property(hifi::properties::TEST);
|
||||
qDebug() << testProperty;
|
||||
if (testProperty.isValid()) {
|
||||
|
@ -4228,6 +4233,7 @@ void Application::initDisplay() {
|
|||
}
|
||||
|
||||
void Application::init() {
|
||||
|
||||
// Make sure Login state is up to date
|
||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||
|
||||
|
@ -6836,6 +6842,10 @@ void Application::loadScriptURLDialog() const {
|
|||
});
|
||||
}
|
||||
|
||||
SharedSoundPointer Application::getSampleSound() const {
|
||||
return _sampleSound;
|
||||
}
|
||||
|
||||
void Application::loadLODToolsDialog() {
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
|
||||
|
|
|
@ -326,6 +326,7 @@ public slots:
|
|||
void toggleEntityScriptServerLogDialog();
|
||||
Q_INVOKABLE void showAssetServerWidget(QString filePath = "");
|
||||
Q_INVOKABLE void loadAddAvatarBookmarkDialog() const;
|
||||
Q_INVOKABLE SharedSoundPointer getSampleSound() const;
|
||||
|
||||
void showDialog(const QUrl& widgetUrl, const QUrl& tabletUrl, const QString& name) const;
|
||||
|
||||
|
@ -702,6 +703,7 @@ private:
|
|||
FileScriptingInterface* _fileDownload;
|
||||
AudioInjectorPointer _snapshotSoundInjector;
|
||||
SharedSoundPointer _snapshotSound;
|
||||
SharedSoundPointer _sampleSound;
|
||||
|
||||
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
|
||||
QString _autoSwitchDisplayModeSupportedHMDPluginName;
|
||||
|
|
|
@ -23,7 +23,6 @@ class SoundCache : public ResourceCache, public Dependency {
|
|||
|
||||
public:
|
||||
Q_INVOKABLE SharedSoundPointer getSound(const QUrl& url);
|
||||
|
||||
protected:
|
||||
virtual QSharedPointer<Resource> createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||
const void* extra) override;
|
||||
|
|
|
@ -138,7 +138,7 @@ void main(void) {
|
|||
}
|
||||
|
||||
// Mix with background at far range
|
||||
const float BLEND_DISTANCE = 30000.0;
|
||||
const float BLEND_DISTANCE = 27000.0;
|
||||
if (distance > BLEND_DISTANCE) {
|
||||
outFragColor = mix(potentialFragColor, fragColor, hazeParams.backgroundBlendValue);
|
||||
} else {
|
||||
|
|
|
@ -97,7 +97,6 @@ static const bool HIFI_AUTOREFRESH_FILE_SCRIPTS { true };
|
|||
Q_DECLARE_METATYPE(QScriptEngine::FunctionSignature)
|
||||
int functionSignatureMetaID = qRegisterMetaType<QScriptEngine::FunctionSignature>();
|
||||
|
||||
Q_DECLARE_METATYPE(ScriptEnginePointer)
|
||||
int scriptEnginePointerMetaID = qRegisterMetaType<ScriptEnginePointer>();
|
||||
|
||||
Q_LOGGING_CATEGORY(scriptengineScript, "hifi.scriptengine.script")
|
||||
|
|
|
@ -55,6 +55,8 @@ static const int DEFAULT_ENTITY_PPS_PER_SCRIPT = 900;
|
|||
|
||||
class ScriptEngines;
|
||||
|
||||
Q_DECLARE_METATYPE(ScriptEnginePointer)
|
||||
|
||||
class CallbackData {
|
||||
public:
|
||||
QScriptValue function;
|
||||
|
|
|
@ -119,6 +119,7 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
this.actionID = null; // action this script created...
|
||||
this.entityWithContextOverlay = false;
|
||||
this.contextOverlayTimer = false;
|
||||
this.previousCollisionStatus = false;
|
||||
this.reticleMinX = MARGIN;
|
||||
this.reticleMaxX;
|
||||
this.reticleMinY = MARGIN;
|
||||
|
@ -342,7 +343,9 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
if (this.madeDynamic) {
|
||||
var props = {};
|
||||
props.dynamic = false;
|
||||
props.collisionless = this.previousCollisionStatus;
|
||||
props.localVelocity = {x: 0, y: 0, z: 0};
|
||||
props.localRotation = {x: 0, y: 0, z: 0};
|
||||
Entities.editEntity(this.grabbedThingID, props);
|
||||
this.madeDynamic = false;
|
||||
}
|
||||
|
@ -507,10 +510,12 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
if (entityIsGrabbable(targetProps)) {
|
||||
if (!entityIsDistanceGrabbable(targetProps)) {
|
||||
targetProps.dynamic = true;
|
||||
this.previousCollisionStatus = targetProps.collisionless;
|
||||
targetProps.collisionless = true;
|
||||
Entities.editEntity(entityID, targetProps);
|
||||
this.madeDynamic = true;
|
||||
}
|
||||
|
||||
|
||||
if (!this.distanceRotating) {
|
||||
this.grabbedThingID = entityID;
|
||||
this.grabbedDistance = rayPickInfo.distance;
|
||||
|
|
|
@ -1373,7 +1373,7 @@ function loaded() {
|
|||
elShape.addEventListener('change', createEmitTextPropertyUpdateFunction('shape'));
|
||||
|
||||
elWebSourceURL.addEventListener('change', createEmitTextPropertyUpdateFunction('sourceUrl'));
|
||||
elWebDPI.addEventListener('change', createEmitNumberPropertyUpdateFunction('dpi'));
|
||||
elWebDPI.addEventListener('change', createEmitNumberPropertyUpdateFunction('dpi', 0));
|
||||
|
||||
elModelURL.addEventListener('change', createEmitTextPropertyUpdateFunction('modelURL'));
|
||||
elShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType'));
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,89 +0,0 @@
|
|||
//
|
||||
// spawnStopwatch.js
|
||||
//
|
||||
// Created by Ryan Huffman on 1/20/17.
|
||||
// Copyright 2017 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
|
||||
//
|
||||
|
||||
var forward = Quat.getFront(MyAvatar.orientation);
|
||||
Vec3.print("Forward: ", forward);
|
||||
var positionToSpawn = Vec3.sum(MyAvatar.position, Vec3.multiply(3, forward));
|
||||
var scale = 0.5;
|
||||
positionToSpawn.y += 0.5;
|
||||
|
||||
var stopwatchID = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "stopwatch/base",
|
||||
position: positionToSpawn,
|
||||
modelURL: Script.resolvePath("models/Stopwatch.fbx"),
|
||||
dimensions: Vec3.multiply(scale, {"x":4.129462242126465,"y":1.058512806892395,"z":5.773681640625}),
|
||||
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0))
|
||||
});
|
||||
|
||||
var secondHandID = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "stopwatch/seconds",
|
||||
parentID: stopwatchID,
|
||||
localPosition: Vec3.multiply(scale, {"x":-0.004985813982784748,"y":0.39391064643859863,"z":0.8312804698944092}),
|
||||
dimensions: Vec3.multiply(scale, {"x":0.14095762372016907,"y":0.02546107769012451,"z":1.6077008247375488}),
|
||||
registrationPoint: {"x":0.5,"y":0.5,"z":1},
|
||||
modelURL: Script.resolvePath("models/Stopwatch-sec-hand.fbx"),
|
||||
});
|
||||
|
||||
var minuteHandID = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "stopwatch/minutes",
|
||||
parentID: stopwatchID,
|
||||
localPosition: Vec3.multiply(scale, {"x":-0.0023056098725646734,"y":0.3308190703392029,"z":0.21810021996498108}),
|
||||
dimensions: Vec3.multiply(scale, {"x":0.045471154153347015,"y":0.015412690117955208,"z":0.22930574417114258}),
|
||||
registrationPoint: {"x":0.5,"y":0.5,"z":1},
|
||||
modelURL: Script.resolvePath("models/Stopwatch-min-hand.fbx"),
|
||||
});
|
||||
|
||||
var startStopButtonID = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "stopwatch/startStop",
|
||||
parentID: stopwatchID,
|
||||
dimensions: Vec3.multiply(scale, { x: 0.8, y: 0.8, z: 1.0 }),
|
||||
localPosition: Vec3.multiply(scale, { x: 0, y: -0.1, z: -2.06 }),
|
||||
modelURL: Script.resolvePath("models/transparent-box.fbx")
|
||||
});
|
||||
|
||||
var resetButtonID = Entities.addEntity({
|
||||
type: "Model",
|
||||
name: "stopwatch/startStop",
|
||||
parentID: stopwatchID,
|
||||
dimensions: Vec3.multiply(scale, { x: 0.6, y: 0.6, z: 0.8 }),
|
||||
localPosition: Vec3.multiply(scale, { x: -1.5, y: -0.1, z: -1.2 }),
|
||||
localRotation: Quat.fromVec3Degrees({ x: 0, y: 36, z: 0 }),
|
||||
modelURL: Script.resolvePath("models/transparent-box.fbx")
|
||||
});
|
||||
|
||||
Entities.editEntity(stopwatchID, {
|
||||
userData: JSON.stringify({
|
||||
secondHandID: secondHandID,
|
||||
minuteHandID: minuteHandID
|
||||
}),
|
||||
serverScripts: Script.resolvePath("stopwatchServer.js")
|
||||
});
|
||||
|
||||
Entities.editEntity(startStopButtonID, {
|
||||
userData: JSON.stringify({
|
||||
stopwatchID: stopwatchID,
|
||||
grabbableKey: { wantsTrigger: true }
|
||||
}),
|
||||
script: Script.resolvePath("stopwatchStartStop.js")
|
||||
});
|
||||
|
||||
Entities.editEntity(resetButtonID, {
|
||||
userData: JSON.stringify({
|
||||
stopwatchID: stopwatchID,
|
||||
grabbableKey: { wantsTrigger: true }
|
||||
}),
|
||||
script: Script.resolvePath("stopwatchReset.js")
|
||||
});
|
||||
|
||||
Script.stop()
|
|
@ -1,22 +0,0 @@
|
|||
//
|
||||
// stopwatchReset.js
|
||||
//
|
||||
// Created by David Rowe on 26 May 2017.
|
||||
// Copyright 2017 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
|
||||
//
|
||||
|
||||
(function () {
|
||||
this.preload = function (entityID) {
|
||||
var properties = Entities.getEntityProperties(entityID, "userData");
|
||||
this.messageChannel = "STOPWATCH-" + JSON.parse(properties.userData).stopwatchID;
|
||||
};
|
||||
function click() {
|
||||
Messages.sendMessage(this.messageChannel, "reset");
|
||||
}
|
||||
this.startNearTrigger = click;
|
||||
this.startFarTrigger = click;
|
||||
this.clickDownOnEntity = click;
|
||||
});
|
|
@ -1,132 +0,0 @@
|
|||
//
|
||||
// stopwatchServer.js
|
||||
//
|
||||
// Created by Ryan Huffman on 1/20/17.
|
||||
// Copyright 2017 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
|
||||
//
|
||||
|
||||
(function() {
|
||||
var self = this;
|
||||
|
||||
self.equipped = false;
|
||||
self.isActive = false;
|
||||
self.seconds = 0;
|
||||
|
||||
self.secondHandID = null;
|
||||
self.minuteHandID = null;
|
||||
|
||||
self.tickSound = SoundCache.getSound(Script.resolvePath("sounds/tick.wav"));
|
||||
self.tickInjector = null;
|
||||
self.tickIntervalID = null;
|
||||
|
||||
self.chimeSound = SoundCache.getSound(Script.resolvePath("sounds/chime.wav"));
|
||||
|
||||
self.preload = function(entityID) {
|
||||
print("Preloading stopwatch: ", entityID);
|
||||
self.entityID = entityID;
|
||||
self.messageChannel = "STOPWATCH-" + entityID;
|
||||
|
||||
var userData = Entities.getEntityProperties(self.entityID, 'userData').userData;
|
||||
var data = JSON.parse(userData);
|
||||
self.secondHandID = data.secondHandID;
|
||||
self.minuteHandID = data.minuteHandID;
|
||||
|
||||
self.resetTimer();
|
||||
|
||||
Messages.subscribe(self.messageChannel);
|
||||
Messages.messageReceived.connect(this, self.messageReceived);
|
||||
};
|
||||
self.unload = function() {
|
||||
print("Unloading stopwatch:", self.entityID);
|
||||
self.resetTimer();
|
||||
Messages.unsubscribe(self.messageChannel);
|
||||
Messages.messageReceived.disconnect(this, self.messageReceived);
|
||||
};
|
||||
self.messageReceived = function(channel, message, sender) {
|
||||
print("Message received", channel, sender, message);
|
||||
if (channel === self.messageChannel) {
|
||||
switch (message) {
|
||||
case "startStop":
|
||||
if (self.isActive) {
|
||||
self.stopTimer();
|
||||
} else {
|
||||
self.startTimer();
|
||||
}
|
||||
break;
|
||||
case "reset":
|
||||
self.stopTimer();
|
||||
self.resetTimer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
self.getStopwatchPosition = function() {
|
||||
return Entities.getEntityProperties(self.entityID, "position").position;
|
||||
};
|
||||
self.resetTimer = function() {
|
||||
print("Resetting stopwatch");
|
||||
Entities.editEntity(self.secondHandID, {
|
||||
localRotation: Quat.fromPitchYawRollDegrees(0, 0, 0),
|
||||
angularVelocity: { x: 0, y: 0, z: 0 },
|
||||
});
|
||||
Entities.editEntity(self.minuteHandID, {
|
||||
localRotation: Quat.fromPitchYawRollDegrees(0, 0, 0),
|
||||
angularVelocity: { x: 0, y: 0, z: 0 },
|
||||
});
|
||||
self.seconds = 0;
|
||||
};
|
||||
self.startTimer = function() {
|
||||
print("Starting stopwatch");
|
||||
if (!self.tickInjector) {
|
||||
self.tickInjector = Audio.playSound(self.tickSound, {
|
||||
position: self.getStopwatchPosition(),
|
||||
volume: 0.7,
|
||||
loop: true
|
||||
});
|
||||
} else {
|
||||
self.tickInjector.restart();
|
||||
}
|
||||
|
||||
self.tickIntervalID = Script.setInterval(function() {
|
||||
if (self.tickInjector) {
|
||||
self.tickInjector.setOptions({
|
||||
position: self.getStopwatchPosition(),
|
||||
volume: 0.7,
|
||||
loop: true
|
||||
});
|
||||
}
|
||||
self.seconds++;
|
||||
const degreesPerTick = -360 / 60;
|
||||
Entities.editEntity(self.secondHandID, {
|
||||
localRotation: Quat.fromPitchYawRollDegrees(0, self.seconds * degreesPerTick, 0),
|
||||
});
|
||||
|
||||
if (self.seconds % 60 == 0) {
|
||||
Entities.editEntity(self.minuteHandID, {
|
||||
localRotation: Quat.fromPitchYawRollDegrees(0, (self.seconds / 60) * degreesPerTick, 0),
|
||||
});
|
||||
Audio.playSound(self.chimeSound, {
|
||||
position: self.getStopwatchPosition(),
|
||||
volume: 1.0,
|
||||
loop: false
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
self.isActive = true;
|
||||
};
|
||||
self.stopTimer = function () {
|
||||
print("Stopping stopwatch");
|
||||
if (self.tickInjector) {
|
||||
self.tickInjector.stop();
|
||||
}
|
||||
if (self.tickIntervalID !== null) {
|
||||
Script.clearInterval(self.tickIntervalID);
|
||||
self.tickIntervalID = null;
|
||||
}
|
||||
self.isActive = false;
|
||||
};
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// stopwatchStartStop.js
|
||||
//
|
||||
// Created by David Rowe on 26 May 2017.
|
||||
// Copyright 2017 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
|
||||
//
|
||||
|
||||
(function () {
|
||||
var messageChannel;
|
||||
this.preload = function (entityID) {
|
||||
var properties = Entities.getEntityProperties(entityID, "userData");
|
||||
this.messageChannel = "STOPWATCH-" + JSON.parse(properties.userData).stopwatchID;
|
||||
};
|
||||
function click() {
|
||||
Messages.sendMessage(this.messageChannel, "startStop");
|
||||
}
|
||||
this.startNearTrigger = click;
|
||||
this.startFarTrigger = click;
|
||||
this.clickDownOnEntity = click;
|
||||
});
|
Loading…
Reference in a new issue