Merge branch 'master' of github.com:highfidelity/hifi into yellow

This commit is contained in:
Sam Gateau 2019-09-09 11:33:27 -07:00
commit 760eac6f83
42 changed files with 486 additions and 126 deletions

View file

@ -17,7 +17,6 @@
#include <QJsonDocument>
#include <EntityTree.h>
#include <SimpleEntitySimulation.h>
#include <ResourceCache.h>
#include <ScriptCache.h>
#include <EntityEditFilters.h>
@ -36,7 +35,7 @@ const char* LOCAL_MODELS_PERSIST_FILE = "resources/models.svo";
EntityServer::EntityServer(ReceivedMessage& message) :
OctreeServer(message),
_entitySimulation(NULL),
_entitySimulation(nullptr),
_dynamicDomainVerificationTimer(this)
{
DependencyManager::set<ResourceManager>();

View file

@ -16,9 +16,11 @@
#include <memory>
#include "EntityItem.h"
#include <EntityItem.h>
#include <EntityTree.h>
#include <SimpleEntitySimulation.h>
#include "EntityServerConsts.h"
#include "EntityTree.h"
/// Handles assignments of type EntityServer - sending entities to various clients.
@ -27,9 +29,6 @@ struct ViewerSendingStats {
quint64 lastEdited;
};
class SimpleEntitySimulation;
using SimpleEntitySimulationPointer = std::shared_ptr<SimpleEntitySimulation>;
class EntityServer : public OctreeServer, public NewlyCreatedEntityHook {
Q_OBJECT
public:

View file

@ -301,10 +301,17 @@ void EntityScriptServer::run() {
entityScriptingInterface->setEntityTree(_entityViewer.getTree());
DependencyManager::set<AssignmentParentFinder>(_entityViewer.getTree());
auto treePtr = _entityViewer.getTree();
DependencyManager::set<AssignmentParentFinder>(treePtr);
if (!_entitySimulation) {
SimpleEntitySimulationPointer simpleSimulation { new SimpleEntitySimulation() };
simpleSimulation->setEntityTree(treePtr);
treePtr->setSimulation(simpleSimulation);
_entitySimulation = simpleSimulation;
}
auto tree = _entityViewer.getTree().get();
auto tree = treePtr.get();
connect(tree, &EntityTree::deletingEntity, this, &EntityScriptServer::deletingEntity, Qt::QueuedConnection);
connect(tree, &EntityTree::addingEntity, this, &EntityScriptServer::addingEntity, Qt::QueuedConnection);
connect(tree, &EntityTree::entityServerScriptChanging, this, &EntityScriptServer::entityServerScriptChanging, Qt::QueuedConnection);
@ -451,6 +458,7 @@ void EntityScriptServer::resetEntitiesScriptEngine() {
connect(newEngine.data(), &ScriptEngine::update, this, [this] {
_entityViewer.queryOctree();
_entityViewer.getTree()->preUpdate();
_entityViewer.getTree()->update();
});

View file

@ -21,6 +21,7 @@
#include <EntityEditPacketSender.h>
#include <plugins/CodecPlugin.h>
#include <ScriptEngine.h>
#include <SimpleEntitySimulation.h>
#include <ThreadedAssignment.h>
#include "../entities/EntityTreeHeadlessViewer.h"
@ -75,6 +76,7 @@ private:
static int _entitiesScriptEngineCount;
ScriptEnginePointer _entitiesScriptEngine;
SimpleEntitySimulationPointer _entitySimulation;
EntityEditPacketSender _entityEditSender;
EntityTreeHeadlessViewer _entityViewer;

View file

@ -38,7 +38,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(BUILD_ORGANIZATION "High Fidelity")
set(HIGH_FIDELITY_PROTOCOL "hifi")
set(HIGH_FIDELITY_APP_PROTOCOL "hifiapp")
set(INTERFACE_BUNDLE_NAME "Interface")
set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface")
# add definition for this release type
@ -61,7 +61,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(PR_BUILD 1)
set(BUILD_VERSION "PR${RELEASE_NUMBER}")
set(BUILD_ORGANIZATION "High Fidelity - PR${RELEASE_NUMBER}")
set(INTERFACE_BUNDLE_NAME "Interface")
set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface-beta")
# add definition for this release type
@ -70,7 +70,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(DEV_BUILD 1)
set(BUILD_VERSION "dev")
set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}")
set(INTERFACE_BUNDLE_NAME "Interface")
set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface-beta")
# add definition for this release type

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>high-fidelity.hifi</string>
</array>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>

View file

@ -822,6 +822,19 @@
},
"id": "seatedReactionPositiveCheer",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 64,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_agree_acknowledge.fbx"
},
"id": "seatedReactionPositiveAcknowledge",
"type": "clip"
}
],
"data": {
@ -867,6 +880,15 @@
"resume": false,
"transitions": [
]
},
{
"id": "seatedReactionPositiveAcknowledge",
"interpDuration": 1,
"interpTarget": 1,
"priority": 1,
"resume": false,
"transitions": [
]
}
],
"timeScale": 1,
@ -916,6 +938,19 @@
},
"id": "seatedReactionNegativeDisagreeDisbelief",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 70,
"loopFlag": false,
"startFrame": 0,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_disagree_dismiss.fbx"
},
"id": "seatedReactionNegativeDisagreeDismiss",
"type": "clip"
}
],
"data": {
@ -958,6 +993,17 @@
"resume": false,
"transitions": [
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionNegativeDisagreeDismiss",
"interpDuration": 1,
"interpTarget": 1,
"interpType": "evaluateBoth",
"priority": 1,
"resume": false,
"transitions": [
]
}
],
"timeScale": 1,
@ -1046,6 +1092,47 @@
},
"id": "seatedReactionRaiseHand02Outro",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 15,
"loopFlag": false,
"startFrame": 0,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_raisehand03_all.fbx"
},
"id": "seatedReactionRaiseHand03Intro",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 233,
"loopFlag": true,
"mirrorFlag": false,
"startFrame": 15,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_raisehand03_all.fbx"
},
"id": "seatedReactionRaiseHand03Loop",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 296,
"loopFlag": false,
"mirrorFlag": false,
"startFrame": 233,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_raisehand03_all.fbx"
},
"id": "seatedReactionRaiseHand03Outro",
"type": "clip"
}
],
"data": {
@ -1057,7 +1144,7 @@
"easingType": "easeInOutQuad",
"id": "seatedReactionRaiseHandIntro",
"interpDuration": 8,
"interpTarget": 8,
"interpTarget": 9,
"interpType": "evaluateBoth",
"priority": 1,
"resume": false,
@ -1138,6 +1225,49 @@
"var": "reactionRaiseHandEnabled"
}
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionRaiseHand03Intro",
"interpDuration": 8,
"interpTarget": 8,
"interpType": "evaluateBoth",
"priority": 1,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionRaiseHand03Loop",
"var": "seatedReactionRaiseHand03IntroOnDone"
}
]
},
{
"id": "seatedReactionRaiseHand03Loop",
"interpDuration": 1,
"interpTarget": 1,
"priority": 0,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionRaiseHand03Outro",
"var": "reactionRaiseHandDisabled"
}
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionRaiseHand03Outro",
"interpDuration": 12,
"interpTarget": 12,
"interpType": "evaluateBoth",
"priority": 0,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionRaiseHand03Loop",
"var": "reactionRaiseHandEnabled"
}
]
}
],
"triggerRandomSwitch": ""
@ -1224,6 +1354,45 @@
},
"id": "seatedReactionApplaud02Outro",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 17,
"loopFlag": false,
"startFrame": 0,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_clap03_all.fbx"
},
"id": "seatedReactionApplaud03Intro",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 111,
"loopFlag": true,
"startFrame": 17,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_clap03_all.fbx"
},
"id": "seatedReactionApplaud03Loop",
"type": "clip"
},
{
"children": [
],
"data": {
"endFrame": 136,
"loopFlag": false,
"startFrame": 111,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_clap03_all.fbx"
},
"id": "seatedReactionApplaud03Outro",
"type": "clip"
}
],
"data": {
@ -1320,6 +1489,51 @@
"var": "reactionApplaudEnabled"
}
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionApplaud03Intro",
"interpDuration": 8,
"interpTarget": 8,
"interpType": "evaluateBoth",
"priority": 1,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionApplaud03Loop",
"var": "seatedReactionApplaud03IntroOnDone"
}
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionApplaud03Loop",
"interpDuration": 1,
"interpTarget": 1,
"interpType": "evaluateBoth",
"priority": 0,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionApplaud03Outro",
"var": "reactionApplaudDisabled"
}
]
},
{
"easingType": "easeInOutQuad",
"id": "seatedReactionApplaud03Outro",
"interpDuration": 12,
"interpTarget": 12,
"interpType": "evaluateBoth",
"priority": 0,
"resume": false,
"transitions": [
{
"randomSwitchState": "seatedReactionApplaud03Loop",
"var": "reactionApplaudEnabled"
}
]
}
],
"triggerRandomSwitch": ""
@ -1333,7 +1547,7 @@
"children": [
],
"data": {
"endFrame": 22,
"endFrame": 21,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -1346,9 +1560,9 @@
"children": [
],
"data": {
"endFrame": 43,
"endFrame": 100,
"loopFlag": true,
"startFrame": 22,
"startFrame": 21,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_point_all.fbx"
},
@ -1359,9 +1573,10 @@
"children": [
],
"data": {
"endFrame": 71,
"endFrame": 134,
"loopFlag": false,
"startFrame": 43,
"mirrorFlag": false,
"startFrame": 100,
"timeScale": 1,
"url": "qrc:///avatar/animations/sitting_emote_point_all.fbx"
},
@ -1481,6 +1696,10 @@
"state": "seatedTalkOverlay",
"var": "seatedReactionPositiveCheerOnDone"
},
{
"state": "seatedTalkOverlay",
"var": "seatedReactionPositiveAcknowledgeOnDone"
},
{
"state": "seatedReactionNegative",
"var": "reactionNegativeTrigger"
@ -1522,6 +1741,10 @@
"state": "seatedTalkOverlay",
"var": "seatedReactionNegativeDisagreeDisbeliefOnDone"
},
{
"state": "seatedTalkOverlay",
"var": "seatedReactionNegativeDisagreeDismissOnDone"
},
{
"state": "seatedReactionRaiseHand",
"var": "reactionRaiseHandEnabled"
@ -2430,7 +2653,7 @@
"children": [
],
"data": {
"endFrame": 58,
"endFrame": 64,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -2456,7 +2679,7 @@
"children": [
],
"data": {
"endFrame": 78,
"endFrame": 94,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -2469,7 +2692,7 @@
"children": [
],
"data": {
"endFrame": 66,
"endFrame": 68,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -2482,7 +2705,7 @@
"children": [
],
"data": {
"endFrame": 85,
"endFrame": 84,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -2979,7 +3202,7 @@
"children": [
],
"data": {
"endFrame": 18,
"endFrame": 17,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -2992,9 +3215,9 @@
"children": [
],
"data": {
"endFrame": 97,
"endFrame": 111,
"loopFlag": true,
"startFrame": 18,
"startFrame": 17,
"timeScale": 1,
"url": "qrc:///avatar/animations/emote_clap01_all.fbx"
},
@ -3005,9 +3228,9 @@
"children": [
],
"data": {
"endFrame": 146,
"endFrame": 160,
"loopFlag": false,
"startFrame": 97,
"startFrame": 111,
"timeScale": 1,
"url": "qrc:///avatar/animations/emote_clap01_all.fbx"
},
@ -3308,7 +3531,7 @@
"children": [
],
"data": {
"endFrame": 22,
"endFrame": 21,
"loopFlag": false,
"startFrame": 1,
"timeScale": 1,
@ -3321,9 +3544,9 @@
"children": [
],
"data": {
"endFrame": 40,
"endFrame": 100,
"loopFlag": true,
"startFrame": 22,
"startFrame": 21,
"timeScale": 1,
"url": "qrc:///avatar/animations/emote_point01_all.fbx"
},
@ -3334,9 +3557,9 @@
"children": [
],
"data": {
"endFrame": 78,
"endFrame": 134,
"loopFlag": false,
"startFrame": 40,
"startFrame": 100,
"timeScale": 1,
"url": "qrc:///avatar/animations/emote_point01_all.fbx"
},
@ -3405,8 +3628,8 @@
{
"easingType": "easeInOutQuad",
"id": "idleTalkOverlay",
"interpDuration": 24,
"interpTarget": 24,
"interpDuration": 20,
"interpTarget": 20,
"interpType": "evaluateBoth",
"transitions": [
{

View file

@ -35,10 +35,8 @@ TextField {
leftPadding: 0
rightPadding: root.rightGlyph === "" ? 0 : rightGlyphItem.implicitWidth + simplifiedUI.sizes.controls.textField.rightGlyphPadding
onFocusChanged: {
if (focus) {
Tablet.playSound(TabletEnums.ButtonClick);
}
onPressed: {
Tablet.playSound(TabletEnums.ButtonClick);
}
onHoveredChanged: {

View file

@ -313,8 +313,8 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
if (spine2Joint >= 0) {
params.spine2ShapeInfo = hfmModel.joints[spine2Joint].shapeInfo;
}
params.isTalking = head->getTimeWithoutTalking() <= 1.5f;
const float TALKING_TIME_THRESHOLD = 0.75f;
params.isTalking = head->getTimeWithoutTalking() <= TALKING_TIME_THRESHOLD;
myAvatar->updateRigControllerParameters(params);

View file

@ -512,13 +512,13 @@ void OtherAvatar::handleChangedAvatarEntityData() {
entity->setParentID(NULL_ID);
entity->setParentID(oldParentID);
if (entity->stillHasMyGrabAction()) {
if (entity->stillHasMyGrab()) {
// For this case: we want to ignore transform+velocities coming from authoritative OtherAvatar
// because the MyAvatar is grabbing and we expect the local grab state
// to have enough information to prevent simulation drift.
//
// Clever readers might realize this could cause problems. For example,
// if an ignored OtherAvagtar were to simultanously grab the object then there would be
// if an ignored OtherAvatar were to simultanously grab the object then there would be
// a noticeable discrepancy between participants in the distributed physics simulation,
// however the difference would be stable and would not drift.
properties.clearTransformOrVelocityChanges();

View file

@ -14,6 +14,7 @@
#include <QtCore/QProcess>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QLocalSocket>
#include <QLocalServer>
#include <QSharedMemory>
@ -117,21 +118,27 @@ int main(int argc, const char* argv[]) {
}
QString applicationPath;
// A temporary application instance is needed to get the location of the running executable
// Tests using high_resolution_clock show that this takes about 30-50 microseconds (on my machine, YMMV)
// If we wanted to avoid the QCoreApplication, we would need to write our own
// cross-platform implementation.
{
// A temporary application instance is needed to get the location of the running executable
// Tests using high_resolution_clock show that this takes about 30-50 microseconds (on my machine, YMMV)
// If we wanted to avoid the QCoreApplication, we would need to write our own
// cross-platform implementation.
QCoreApplication tempApp(argc, const_cast<char**>(argv));
#ifdef Q_OS_OSX
if (QFileInfo::exists(QCoreApplication::applicationDirPath() + "/../../../config.json")) {
applicationPath = QCoreApplication::applicationDirPath() + "/../../../";
} else {
applicationPath = QCoreApplication::applicationDirPath();
}
#else
applicationPath = QCoreApplication::applicationDirPath();
#endif
}
static const QString APPLICATION_CONFIG_FILENAME = "config.json";
QDir applicationDir(applicationPath);
QString configFileName = applicationDir.filePath(APPLICATION_CONFIG_FILENAME);
QFile configFile(configFileName);
QString launcherPath;
if (configFile.exists()) {
if (!configFile.open(QIODevice::ReadOnly)) {
qWarning() << "Found application config, but could not open it";

View file

@ -71,32 +71,44 @@ static QString getTargetDevice(bool hmd, QAudio::Mode mode) {
Qt::ItemFlags AudioDeviceList::_flags { Qt::ItemIsSelectable | Qt::ItemIsEnabled };
AudioDeviceList::AudioDeviceList(QAudio::Mode mode) : _mode(mode) {
auto& setting1 = getSetting(true, QAudio::AudioInput);
if (setting1.isSet()) {
qDebug() << "Device name in settings for HMD, Input" << setting1.get();
} else {
qDebug() << "Device name in settings for HMD, Input not set";
if (mode == QAudio::AudioInput) {
auto& setting1 = getSetting(true, QAudio::AudioInput);
if (setting1.isSet()) {
qDebug() << "Device name in settings for HMD, Input" << setting1.get();
_backupSelectedHMDDeviceName = setting1.get();
} else {
qDebug() << "Device name in settings for HMD, Input not set";
}
}
auto& setting2 = getSetting(true, QAudio::AudioOutput);
if (setting2.isSet()) {
qDebug() << "Device name in settings for HMD, Output" << setting2.get();
} else {
qDebug() << "Device name in settings for HMD, Output not set";
if (mode == QAudio::AudioOutput) {
auto& setting2 = getSetting(true, QAudio::AudioOutput);
if (setting2.isSet()) {
qDebug() << "Device name in settings for HMD, Output" << setting2.get();
_backupSelectedHMDDeviceName = setting2.get();
} else {
qDebug() << "Device name in settings for HMD, Output not set";
}
}
auto& setting3 = getSetting(false, QAudio::AudioInput);
if (setting3.isSet()) {
qDebug() << "Device name in settings for Desktop, Input" << setting3.get();
} else {
qDebug() << "Device name in settings for Desktop, Input not set";
if (mode == QAudio::AudioInput) {
auto& setting3 = getSetting(false, QAudio::AudioInput);
if (setting3.isSet()) {
qDebug() << "Device name in settings for Desktop, Input" << setting3.get();
_backupSelectedDesktopDeviceName = setting3.get();
} else {
qDebug() << "Device name in settings for Desktop, Input not set";
}
}
auto& setting4 = getSetting(false, QAudio::AudioOutput);
if (setting4.isSet()) {
qDebug() << "Device name in settings for Desktop, Output" << setting4.get();
} else {
qDebug() << "Device name in settings for Desktop, Output not set";
if (mode == QAudio::AudioOutput) {
auto& setting4 = getSetting(false, QAudio::AudioOutput);
if (setting4.isSet()) {
qDebug() << "Device name in settings for Desktop, Output" << setting4.get();
_backupSelectedDesktopDeviceName = setting4.get();
} else {
qDebug() << "Device name in settings for Desktop, Output not set";
}
}
}

View file

@ -126,7 +126,10 @@ add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND updater
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/updater" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/Resources/")
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/updater" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/MacOS/"
# Older versions of Launcher put updater in `/Contents/Resources/updater`.
COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${APP_NAME}.app/Contents/Resources" ln -sf ../MacOS/updater updater
)
install(
TARGETS HQLauncher

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>high-fidelity.hifi</string>
</array>
</dict>
</plist>

View file

@ -50,6 +50,8 @@
repeats: YES];
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
Launcher* sharedLauncher = [Launcher sharedLauncher];
NSString* appPath = [sharedLauncher getAppPath];
NSString *destinationFileName = downloadTask.originalRequest.URL.lastPathComponent;
NSString* finalFilePath = [[[Launcher sharedLauncher] getAppPath] stringByAppendingPathComponent:destinationFileName];
NSURL *destinationURL = [NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
@ -59,7 +61,12 @@
}
[fileManager moveItemAtURL:location toURL:destinationURL error:&error];
Launcher* sharedLauncher = [Launcher sharedLauncher];
NSURL *oldInterfaceURL = [NSURL URLWithString: [[appPath stringByAppendingString:@"interface.app"] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
if([fileManager fileExistsAtPath:[oldInterfaceURL path]])
{
[fileManager removeItemAtURL:oldInterfaceURL error:nil];
}
if (error) {
NSLog(@"Download Interface: failed to move file to destination -> error: %@", error);
@ -68,7 +75,6 @@
return;
}
[sharedLauncher setDownloadFilename:destinationFileName];
NSString* appPath = [sharedLauncher getAppPath];
NSString* downloadFileName = [sharedLauncher getDownloadFilename];
NSLog(@"extract interface zip");

View file

@ -3,6 +3,8 @@
@interface DownloadLauncher : NSObject<NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLDownloadDelegate> {
}
@property (readonly) bool didBecomeDownloadTask;
- (void) downloadLauncher:(NSString*) launcherUrl;
@end

View file

@ -8,6 +8,13 @@ static const NSString *kIOError = @"IOError";
@implementation DownloadLauncher
-(id)init {
if ((self = [super init]) != nil) {
_didBecomeDownloadTask = false;
}
return self;
}
- (void) downloadLauncher:(NSString*)launcherUrl {
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:launcherUrl]
cachePolicy:NSURLRequestUseProtocolCachePolicy
@ -16,8 +23,8 @@ static const NSString *kIOError = @"IOError";
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];
NSURLSessionDownloadTask *downloadTask = [defaultSession downloadTaskWithRequest:request];
[downloadTask resume];
NSURLSessionDataTask *task = [defaultSession dataTaskWithRequest:request];
[task resume];
}
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
@ -45,6 +52,25 @@ static const NSString *kIOError = @"IOError";
}
}
-(void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask
didReceiveResponse:(NSURLResponse *)response
completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler
{
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSURLSessionResponseDisposition disposition = NSURLSessionResponseBecomeDownload;
if (httpResponse.statusCode != 200) {
NSLog(@"expected statusCode 200, got %ld", (long)httpResponse.statusCode);
disposition = NSURLSessionResponseCancel;
}
completionHandler(disposition);
}
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask
didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask
{
_didBecomeDownloadTask = true;
}
-(void)URLSession:(NSURLSession*)session downloadTask:(NSURLSessionDownloadTask*)downloadTask didFinishDownloadingToURL:(NSURL*)location {
NSLog(@"Did finish downloading to url");
@try {
@ -95,9 +121,14 @@ static const NSString *kIOError = @"IOError";
}
- (void)URLSession:(NSURLSession*)session task:(NSURLSessionTask*)task didCompleteWithError:(NSError*)error {
NSLog(@"completed; error: %@", error);
if (error) {
if (_didBecomeDownloadTask && [task class] == [NSURLSessionDataTask class]) {
return;
}
NSLog(@"couldn't complete download: %@", error);
[[Launcher sharedLauncher] displayErrorPage];
} else {
NSLog(@"finished downloading Launcher");
}
}
@end

View file

@ -59,7 +59,7 @@
NSString* defaultBuildTag = [json valueForKey:@"default_tag"];
NSString* launcherVersion = [launcherValues valueForKey:@"version"];
NSString* launcherUrl = [[[launcherValues valueForKey:@"mac"] valueForKey:@"url"] stringByRemovingPercentEncoding];
NSString* launcherUrl = [[launcherValues valueForKey:@"mac"] valueForKey:@"url"];
BOOL appDirectoryExist = [fileManager fileExistsAtPath:[[sharedLauncher getAppPath] stringByAppendingString:@"interface.app"]];

View file

@ -383,6 +383,13 @@ static BOOL const DELETE_ZIP_FILES = TRUE;
[self updateLatestBuildInfo];
NSString *kLauncherUrl = @"LAUNCHER_URL";
NSString *envLauncherUrl = [[NSProcessInfo processInfo] environment][kLauncherUrl];
if (envLauncherUrl != nil) {
NSLog(@"Using launcherUrl from environment: %@ = %@", kLauncherUrl, envLauncherUrl);
launcherUrl = envLauncherUrl;
}
NSDictionary* launcherArguments = [LauncherCommandlineArgs arguments];
if (newLauncherAvailable && ![launcherArguments valueForKey: @"--noUpdate"]) {
[self.downloadLauncher downloadLauncher: launcherUrl];
@ -460,11 +467,36 @@ static BOOL const DELETE_ZIP_FILES = TRUE;
-(void)runAutoupdater
{
NSTask* task = [[NSTask alloc] init];
NSException *exception;
bool launched = false;
NSString* newLauncher = [[[Launcher sharedLauncher] getDownloadPathForContentAndScripts] stringByAppendingPathComponent: @"HQ Launcher.app"];
task.launchPath = [newLauncher stringByAppendingString:@"/Contents/Resources/updater"];
task.arguments = @[[[NSBundle mainBundle] bundlePath], newLauncher];
[task launch];
// Older versions of Launcher put updater in `/Contents/Resources/updater`.
for (NSString *bundlePath in @[@"/Contents/MacOS/updater",
@"/Contents/Resources/updater",
]) {
NSTask* task = [[NSTask alloc] init];
task.launchPath = [newLauncher stringByAppendingString: bundlePath];
task.arguments = @[[[NSBundle mainBundle] bundlePath], newLauncher];
NSLog(@"launching updater: %@ %@", task.launchPath, task.arguments);
@try {
[task launch];
}
@catch (NSException *e) {
NSLog(@"couldn't launch updater: %@, %@", e.name, e.reason);
exception = e;
continue;
}
launched = true;
break;
}
if (!launched) {
@throw exception;
}
[NSApp terminate:self];
}

View file

@ -14,19 +14,32 @@
return sharedSettings;
}
- (NSString*) getOldFilePath {
Launcher* sharedLauncher = [Launcher sharedLauncher];
NSString* appPath = [sharedLauncher getAppPath];
NSString* filePath = [appPath stringByAppendingString:@"interface.app/Contents/MacOS/"];
return filePath;
}
- (NSString*) getFilePath
{
Launcher* sharedLauncher = [Launcher sharedLauncher];
NSString* appPath = [sharedLauncher getAppPath];
NSString* filePath = [appPath stringByAppendingString:@"interface.app/Contents/MacOS/"];
return filePath;
return appPath;
}
- (void) readDataFromJsonFile
{
NSString* oldPath = [self getOldFilePath];
NSString* fileAtOldPath = [oldPath stringByAppendingString:@"config.json"];
NSString* filePath = [self getFilePath];
NSString* fileAtPath = [filePath stringByAppendingString:@"config.json"];
if ([[NSFileManager defaultManager] fileExistsAtPath:fileAtOldPath] && ![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
BOOL success = [[NSFileManager defaultManager] moveItemAtPath:fileAtOldPath toPath:fileAtPath error:nil];
NSLog(@"move config to new location -> status: %@", success ? @"SUCCESS" : @"FAILED");
}
if ([[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
NSString* jsonString = [[NSString alloc] initWithData:[NSData dataWithContentsOfFile:fileAtPath] encoding:NSUTF8StringEncoding];
NSError * err;
@ -34,7 +47,6 @@
NSDictionary * json;
if (data != nil) {
json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err];
self.loggedIn = [[json valueForKey:@"loggedIn"] boolValue];
self.build = [[json valueForKey:@"build_version"] integerValue];
self.launcher = [json valueForKey:@"luancherPath"];
@ -64,18 +76,18 @@
NSError * err;
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:json options:0 error:&err];
NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSString* filePath = [self getFilePath];
NSString* fileAtPath = [filePath stringByAppendingString:@"config.json"];
if (![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
NSError * error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:filePath withIntermediateDirectories:FALSE attributes:nil error:&error];
[[NSFileManager defaultManager] createFileAtPath:fileAtPath contents:nil attributes:nil];
}
[[jsonString dataUsingEncoding:NSUTF8StringEncoding] writeToFile:fileAtPath atomically:NO];
}
-(id)init

View file

@ -2117,7 +2117,7 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
_previousIsTalking = params.isTalking;
const float TOTAL_EASE_IN_TIME = 0.75f;
const float TOTAL_EASE_OUT_TIME = 1.5f;
const float TOTAL_EASE_OUT_TIME = 0.75f;
if (params.isTalking) {
if (_talkIdleInterpTime < 1.0f) {
_talkIdleInterpTime += dt / TOTAL_EASE_IN_TIME;

View file

@ -49,7 +49,7 @@ void Head::simulate(float deltaTime) {
// Update audio trailing average for rendering facial animations
const float AUDIO_AVERAGING_SECS = 0.05f;
const float AUDIO_LONG_TERM_AVERAGING_SECS = 30.0f;
const float AUDIO_LONG_TERM_AVERAGING_SECS = 15.0f;
_averageLoudness = glm::mix(_averageLoudness, audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f));
if (_longTermAverageLoudness == -1.0f) {
@ -84,7 +84,7 @@ void Head::simulate(float deltaTime) {
if (getHasProceduralBlinkFaceMovement()) {
// Detect transition from talking to not; force blink after that and a delay
bool forceBlink = false;
const float TALKING_LOUDNESS = 100.0f;
const float TALKING_LOUDNESS = 150.0f;
const float BLINK_AFTER_TALKING = 0.25f;
_timeWithoutTalking += deltaTime;
if ((_averageLoudness - _longTermAverageLoudness) > TALKING_LOUDNESS) {
@ -176,7 +176,7 @@ void Head::simulate(float deltaTime) {
}
void Head::calculateMouthShapes(float deltaTime) {
const float JAW_OPEN_SCALE = 0.015f;
const float JAW_OPEN_SCALE = 0.35f;
const float JAW_OPEN_RATE = 0.9f;
const float JAW_CLOSE_RATE = 0.90f;
const float TIMESTEP_CONSTANT = 0.0032f;
@ -188,11 +188,13 @@ void Head::calculateMouthShapes(float deltaTime) {
const float FUNNEL_SPEED = 2.335f;
const float STOP_GAIN = 5.0f;
const float NORMAL_HZ = 60.0f; // the update rate the constant values were tuned for
const float MAX_DELTA_LOUDNESS = 100.0f;
float deltaTimeRatio = deltaTime / (1.0f / NORMAL_HZ);
// From the change in loudness, decide how much to open or close the jaw
float audioDelta = sqrtf(glm::max(_averageLoudness - _longTermAverageLoudness, 0.0f)) * JAW_OPEN_SCALE;
float deltaLoudness = glm::max(glm::min(_averageLoudness - _longTermAverageLoudness, MAX_DELTA_LOUDNESS), 0.0f) / MAX_DELTA_LOUDNESS;
float audioDelta = powf(deltaLoudness, 2.0f) * JAW_OPEN_SCALE;
if (audioDelta > _audioJawOpen) {
_audioJawOpen += (audioDelta - _audioJawOpen) * JAW_OPEN_RATE * deltaTimeRatio;
} else {

View file

@ -798,7 +798,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto lastEdited = lastEditedFromBufferAdjusted;
bool otherOverwrites = overwriteLocalData && !weOwnSimulation;
// calculate hasGrab once outside the lambda rather than calling it every time inside
bool hasGrab = stillHasGrabAction();
bool hasGrab = stillHasGrab();
auto shouldUpdate = [lastEdited, otherOverwrites, filterRejection, hasGrab](quint64 updatedTimestamp, bool valueChanged) {
if (hasGrab) {
return false;
@ -1444,7 +1444,7 @@ void EntityItem::getTransformAndVelocityProperties(EntityItemProperties& propert
void EntityItem::upgradeScriptSimulationPriority(uint8_t priority) {
uint8_t newPriority = glm::max(priority, _scriptSimulationPriority);
if (newPriority < SCRIPT_GRAB_SIMULATION_PRIORITY && stillHasMyGrabAction()) {
if (newPriority < SCRIPT_GRAB_SIMULATION_PRIORITY && stillHasMyGrab()) {
newPriority = SCRIPT_GRAB_SIMULATION_PRIORITY;
}
if (newPriority != _scriptSimulationPriority) {
@ -1457,7 +1457,7 @@ void EntityItem::upgradeScriptSimulationPriority(uint8_t priority) {
void EntityItem::clearScriptSimulationPriority() {
// DO NOT markDirtyFlags(Simulation::DIRTY_SIMULATION_OWNERSHIP_PRIORITY) here, because this
// is only ever called from the code that actually handles the dirty flags, and it knows best.
_scriptSimulationPriority = stillHasMyGrabAction() ? SCRIPT_GRAB_SIMULATION_PRIORITY : 0;
_scriptSimulationPriority = stillHasMyGrab() ? SCRIPT_GRAB_SIMULATION_PRIORITY : 0;
}
void EntityItem::setPendingOwnershipPriority(uint8_t priority) {
@ -2204,7 +2204,7 @@ void EntityItem::enableNoBootstrap() {
}
void EntityItem::disableNoBootstrap() {
if (!stillHasMyGrabAction()) {
if (!stillHasMyGrab()) {
_flags &= ~Simulation::SPECIAL_FLAG_NO_BOOTSTRAPPING;
_flags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
@ -2290,33 +2290,25 @@ bool EntityItem::removeAction(EntitySimulationPointer simulation, const QUuid& a
return success;
}
bool EntityItem::stillHasGrabAction() const {
return !_grabActions.empty();
bool EntityItem::stillHasGrab() const {
return !(_grabs.empty());
}
// retutrns 'true' if there exists an action that returns 'true' for EntityActionInterface::isMine()
// returns 'true' if there exists an action that returns 'true' for EntityActionInterface::isMine()
// (e.g. the action belongs to the MyAvatar instance)
bool EntityItem::stillHasMyGrabAction() const {
QList<EntityDynamicPointer> holdActions = getActionsOfType(DYNAMIC_TYPE_HOLD);
QList<EntityDynamicPointer>::const_iterator i = holdActions.begin();
while (i != holdActions.end()) {
EntityDynamicPointer action = *i;
if (action->isMine()) {
return true;
}
i++;
bool EntityItem::stillHasMyGrab() const {
bool foundGrab = false;
if (!_grabs.empty()) {
_grabsLock.withReadLock([&] {
foreach (const GrabPointer &grab, _grabs) {
if (grab->getOwnerID() == Physics::getSessionUUID()) {
foundGrab = true;
break;
}
}
});
}
QList<EntityDynamicPointer> farGrabActions = getActionsOfType(DYNAMIC_TYPE_FAR_GRAB);
i = farGrabActions.begin();
while (i != farGrabActions.end()) {
EntityDynamicPointer action = *i;
if (action->isMine()) {
return true;
}
i++;
}
return false;
return foundGrab;
}
bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPointer simulation) {

View file

@ -569,7 +569,7 @@ public:
static void setPrimaryViewFrustumPositionOperator(std::function<glm::vec3()> getPrimaryViewFrustumPositionOperator) { _getPrimaryViewFrustumPositionOperator = getPrimaryViewFrustumPositionOperator; }
static glm::vec3 getPrimaryViewFrustumPosition() { return _getPrimaryViewFrustumPositionOperator(); }
bool stillHasMyGrabAction() const;
bool stillHasMyGrab() const;
bool needsRenderUpdate() const { return resultWithReadLock<bool>([&] { return _needsRenderUpdate; }); }
void setNeedsRenderUpdate(bool needsRenderUpdate) { withWriteLock([&] { _needsRenderUpdate = needsRenderUpdate; }); }
@ -585,7 +585,7 @@ protected:
void setSimulated(bool simulated) { _simulated = simulated; }
const QByteArray getDynamicDataInternal() const;
bool stillHasGrabAction() const;
bool stillHasGrab() const;
void setDynamicDataInternal(QByteArray dynamicData);
virtual void dimensionsChanged() override;

View file

@ -2246,8 +2246,8 @@ void EntityTree::preUpdate() {
void EntityTree::update(bool simulate) {
PROFILE_RANGE(simulation_physics, "UpdateTree");
PerformanceTimer perfTimer("updateTree");
withWriteLock([&] {
if (simulate && _simulation) {
if (simulate && _simulation) {
withWriteLock([&] {
_simulation->updateEntities();
{
PROFILE_RANGE(simulation_physics, "Deletes");
@ -2265,8 +2265,8 @@ void EntityTree::update(bool simulate) {
deleteEntities(idsToDelete, true);
}
}
}
});
});
}
}
quint64 EntityTree::getAdjustedConsiderSince(quint64 sinceTime) {

View file

@ -274,6 +274,7 @@ enum class EntityVersion : PacketVersion {
TextUnlit,
ShadowBiasAndDistance,
TextEntityFonts,
ScriptServerKinematicMotion,
// Add new versions above here
NUM_PACKET_TYPE,

View file

@ -740,7 +740,8 @@ bool EntityMotionState::shouldSendBid() const {
&& (_region == workload::Region::R1)
&& _ownershipState != EntityMotionState::OwnershipState::Unownable
&& glm::max(glm::max(VOLUNTEER_SIMULATION_PRIORITY, _bumpedPriority), _entity->getScriptSimulationPriority()) >= _entity->getSimulationPriority()
&& !_entity->getLocked();
&& !_entity->getLocked()
&& (!_body->isStaticOrKinematicObject() || _entity->stillHasMyGrab());
}
void EntityMotionState::setRigidBody(btRigidBody* body) {