diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index b66226e1a5..c545262967 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -194,7 +194,7 @@ void Agent::run() { // setup an Avatar for the script to use ScriptableAvatar scriptedAvatar(&_scriptEngine); - scriptedAvatar.setForceFaceshiftConnected(true); + scriptedAvatar.setForceFaceTrackerConnected(true); // call model URL setters with empty URLs so our avatar, if user, will have the default models scriptedAvatar.setFaceModelURL(QUrl()); diff --git a/examples/entityScripts/portal.js b/examples/entityScripts/portal.js index e1f00b0afc..5dd7849c38 100644 --- a/examples/entityScripts/portal.js +++ b/examples/entityScripts/portal.js @@ -1,6 +1,7 @@ (function(){ var teleport; var portalDestination; + var animationURL; function playSound() { Audio.playSound(teleport, { volume: 0.40, localOnly: true }); @@ -11,6 +12,7 @@ var properties = Entities.getEntityProperties(entityID); portalDestination = properties.userData; + animationURL = properties.modelURL; print("The portal destination is " + portalDestination); } @@ -25,7 +27,7 @@ this.leaveEntity = function(entityID) { Entities.editEntity(entityID, { - animationURL: "http://hifi-public.s3.amazonaws.com/models/content/phonebooth.fbx", + animationURL: animationURL, animationSettings: '{ "frameIndex": 1, "running": false }' }); @@ -34,7 +36,7 @@ this.hoverEnterEntity = function(entityID) { Entities.editEntity(entityID, { - animationURL: "http://hifi-public.s3.amazonaws.com/models/content/phonebooth.fbx", + animationURL: animationURL, animationSettings: '{ "fps": 24, "firstFrame": 1, "lastFrame": 25, "frameIndex": 1, "running": true, "hold": true }' }); }; diff --git a/examples/example/games/billiards.js b/examples/example/games/billiards.js index fbd41e8939..d4bc71ba37 100644 --- a/examples/example/games/billiards.js +++ b/examples/example/games/billiards.js @@ -105,37 +105,27 @@ function makeTable(pos) { } function makeBalls(pos) { - var colors = [{ red: 255, green: 255, blue: 0}, // Yellow - { red: 0, green: 0, blue: 255}, // Blue - { red: 255, green: 0, blue: 0}, // Red - { red: 128, green: 0, blue: 128}, // Purple - { red: 255, green: 165, blue: 0}, // Orange - { red: 0, green: 255, blue: 0}, // Green - { red: 128, green: 0, blue: 0}, // Maroon - { red: 0, green: 0, blue: 0}, // Black - { red: 255, green: 255, blue: 224}, // Light Yellow - { red: 173, green: 216, blue: 230}, // Light Blue - { red: 205, green: 92, blue: 92}, // Indian Red - { red: 218, green: 112, blue: 214}, // Orchid - { red: 218, green: 165, blue: 32}, // GoldenRod - { red: 255, green: 99, blue: 71}, // Tomato - { red: 128, green: 128, blue: 128}]; // Gray - // Object balls + var whichBall = [ 1, 14, 15, 4, 8, 7, 12, 9, 3, 13, 10, 5, 6, 11, 2 ]; + var ballNumber = 0; var ballPosition = { x: pos.x + (LENGTH / 4.0) * SCALE, y: pos.y + HEIGHT / 2.0 + DROP_HEIGHT, z: pos.z }; for (var row = 1; row <= 5; row++) { ballPosition.z = pos.z - ((row - 1.0) / 2.0 * (BALL_SIZE + BALL_GAP) * SCALE); for (var spot = 0; spot < row; spot++) { balls.push(Entities.addEntity( - { type: "Sphere", + { type: "Model", + modelURL: "https://s3.amazonaws.com/hifi-public/models/props/Pool/ball_" + whichBall[ballNumber].toString() + ".fbx", position: ballPosition, dimensions: { x: BALL_SIZE * SCALE, y: BALL_SIZE * SCALE, z: BALL_SIZE * SCALE }, - color: colors[balls.length], + rotation: Quat.fromPitchYawRollDegrees((Math.random() - 0.5) * 20, (Math.random() - 0.5) * 20, (Math.random() - 0.5) * 20), + color: { red: 255, green: 255, blue: 255 }, gravity: { x: 0, y: GRAVITY, z: 0 }, ignoreCollisions: false, damping: 0.50, + shapeType: "sphere", collisionsWillMove: true })); ballPosition.z += (BALL_SIZE + BALL_GAP) * SCALE; + ballNumber++; } ballPosition.x += (BALL_GAP + Math.sqrt(3.0) / 2.0 * BALL_SIZE) * SCALE; } @@ -143,7 +133,8 @@ function makeBalls(pos) { // Cue Ball cuePosition = { x: pos.x - (LENGTH / 4.0) * SCALE, y: pos.y + HEIGHT / 2.0 + DROP_HEIGHT, z: pos.z }; cueBall = Entities.addEntity( - { type: "Sphere", + { type: "Model", + modelURL: "https://s3.amazonaws.com/hifi-public/models/props/Pool/cue_ball.fbx", position: cuePosition, dimensions: { x: BALL_SIZE * SCALE, y: BALL_SIZE * SCALE, z: BALL_SIZE * SCALE }, color: { red: 255, green: 255, blue: 255 }, @@ -152,6 +143,7 @@ function makeBalls(pos) { velocity: {x: 0, y: 0, z: 0 }, ignoreCollisions: false, damping: 0.50, + shapeType: "sphere", collisionsWillMove: true }); } diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 84a8d23a74..ad2b359e79 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -406,7 +406,7 @@ elModelAnimationFrame.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFrameIndex')); elModelAnimationSettings.addEventListener('change', createEmitTextPropertyUpdateFunction('animationSettings')); elModelTextures.addEventListener('change', createEmitTextPropertyUpdateFunction('textures')); - elModelShapeType.addEventListener('change', createEmitNumberPropertyUpdateFunction('shapeType')); + elModelShapeType.addEventListener('change', createEmitTextPropertyUpdateFunction('shapeType')); elTextText.addEventListener('change', createEmitTextPropertyUpdateFunction('text')); elTextLineHeight.addEventListener('change', createEmitNumberPropertyUpdateFunction('lineHeight')); @@ -671,9 +671,9 @@
Shape Type
diff --git a/examples/libraries/entityCameraTool.js b/examples/libraries/entityCameraTool.js index bbd28dd38a..da6a35b273 100644 --- a/examples/libraries/entityCameraTool.js +++ b/examples/libraries/entityCameraTool.js @@ -477,7 +477,7 @@ CameraManager = function() { // Last mode that was first or third person var lastAvatarCameraMode = "first person"; Camera.modeUpdated.connect(function(newMode) { - if (newMode == "first person" || newMode == "third person") { + if (newMode != "independent") { lastAvatarCameraMode = newMode; that.disable(true); } else { diff --git a/examples/notifications.js b/examples/notifications.js index 287bfd0b36..f9d2ba83ed 100644 --- a/examples/notifications.js +++ b/examples/notifications.js @@ -84,7 +84,7 @@ var users = []; var ctrlIsPressed = false; var ready = true; -var randomSounds = new SoundArray({}, true); +var randomSounds = new SoundArray({ localOnly: true }, true); var numberOfSounds = 2; for (var i = 1; i <= numberOfSounds; i++) { randomSounds.addSound(HIFI_PUBLIC_BUCKET + "sounds/UI/notification-general" + i + ".raw"); diff --git a/interface/external/faceshift/readme.txt b/interface/external/faceshift/readme.txt index 5a7333a9f6..4208711632 100644 --- a/interface/external/faceshift/readme.txt +++ b/interface/external/faceshift/readme.txt @@ -13,9 +13,14 @@ You may optionally choose to place this folder in a location outside the reposit If so our CMake find module expects you to set the ENV variable 'HIFI_LIB_DIR' to a directory containing a subfolder ‘faceshift’ that contains the lib and include folders. -1. Build a Faceshift static library from the fsbinarystream.cpp file. If you build a release version call it libfaceshift.a. The debug version should be called libfaceshiftd.a. Place this in the ‘lib’ folder in your Faceshift folder. +1. Build a Faceshift static library from the fsbinarystream.cpp file. + Windows: Win32 console application; no precompiled header or SDL checks; no ATL or MFC headers; Project Properties, Configuration Type = Static Library (.lib). -2. Copy the fsbinarystream.h header file from the Faceshift SDK into the ‘include’ folder in your Faceshift folder. +2. Copy the library files to the ‘lib’ folder in your Faceshift folder. + OSX: If you build a release version call it libfaceshift.a. The debug version should be called libfaceshiftd.a. + Windows: The release and debug versions should be called faceshift.lib and faceshiftd.lib, respectively. Copy them into a ‘Win32’ folder in your ‘lib’ folder. -3. Clear your build directory, run cmake and build, and you should be all set. +3. Copy the fsbinarystream.h header file from the Faceshift SDK into the ‘include’ folder in your Faceshift folder. + +4. Clear your build directory, run cmake and build, and you should be all set. diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1211df3727..a7e73da1bd 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1624,6 +1624,16 @@ FaceTracker* Application::getActiveFaceTracker() { (visage->isActive() ? static_cast(visage.data()) : NULL))); } +void Application::setActiveFaceTracker() { +#ifdef HAVE_FACESHIFT + DependencyManager::get()->setTCPEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift)); +#endif + DependencyManager::get()->setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::DDEFaceRegression)); +#ifdef HAVE_VISAGE + DependencyManager::get()->updateEnabled(); +#endif +} + bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) { QVector entities; _entities.getTree()->findEntities(AACube(glm::vec3(x / (float)TREE_SCALE, @@ -1741,6 +1751,7 @@ void Application::init() { // initialize our face trackers after loading the menu settings DependencyManager::get()->init(); + DependencyManager::get()->init(); DependencyManager::get()->init(); Leapmotion::init(); diff --git a/interface/src/Application.h b/interface/src/Application.h index f7a71e1e7c..669187138c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -366,6 +366,8 @@ public slots: void notifyPacketVersionMismatch(); + void setActiveFaceTracker(); + private slots: void clearDomainOctreeDetails(); void checkFPS(); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 46b6141ba9..c45fc6ed33 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -27,6 +27,7 @@ #include "audio/AudioIOStatsRenderer.h" #include "audio/AudioScope.h" #include "avatar/AvatarManager.h" +#include "devices/DdeFaceTracker.h" #include "devices/Faceshift.h" #include "devices/RealSense.h" #include "devices/SixenseManager.h" @@ -357,18 +358,35 @@ Menu::Menu() { dialogsManager.data(), SLOT(lodTools())); QMenu* avatarDebugMenu = developerMenu->addMenu("Avatar"); + + QMenu* faceTrackingMenu = avatarDebugMenu->addMenu("Face Tracking"); + { + QActionGroup* faceTrackerGroup = new QActionGroup(avatarDebugMenu); + + QAction* noFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::NoFaceTracking, + 0, true, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(noFaceTracker); + #ifdef HAVE_FACESHIFT - addCheckableActionToQMenuAndActionHash(avatarDebugMenu, - MenuOption::Faceshift, - 0, - true, - DependencyManager::get().data(), - SLOT(setTCPEnabled(bool))); + QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Faceshift, + 0, false, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(faceshiftFaceTracker); #endif + + QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::DDEFaceRegression, + 0, false, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(ddeFaceTracker); + #ifdef HAVE_VISAGE - addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false, - DependencyManager::get().data(), SLOT(updateEnabled())); + QAction* visageFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Visage, + 0, false, + qApp, SLOT(setActiveFaceTracker())); + faceTrackerGroup->addAction(visageFaceTracker); #endif + } addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderHeadCollisionShapes); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 19e51ad044..6dbc841a42 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -133,13 +133,12 @@ namespace MenuOption { const QString CollideWithEnvironment = "Collide With World Boundaries"; const QString Collisions = "Collisions"; const QString Console = "Console..."; + const QString ControlWithSpeech = "Control With Speech"; const QString CopyAddress = "Copy Address to Clipboard"; const QString CopyPath = "Copy Path to Clipboard"; - const QString ControlWithSpeech = "Control With Speech"; - const QString DeleteBookmark = "Delete Bookmark..."; - const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; - const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; + const QString DDEFaceRegression = "DDE Face Regression"; const QString DecreaseAvatarSize = "Decrease Avatar Size"; + const QString DeleteBookmark = "Delete Bookmark..."; const QString DisableActivityLogger = "Disable Activity Logger"; const QString DisableAutoAdjustLOD = "Disable Automatically Adjusting LOD"; const QString DisableLightEntities = "Disable Light Entities"; @@ -152,7 +151,9 @@ namespace MenuOption { const QString DisplayModelElementChildProxies = "Display Model Element Children"; const QString DisplayModelElementProxy = "Display Model Element Bounds"; const QString DisplayTimingDetails = "Display Timing Details"; + const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; const QString DontFadeOnOctreeServerChanges = "Don't Fade In/Out on Octree Server Changes"; + const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; const QString EchoLocalAudio = "Echo Local Audio"; const QString EchoServerAudio = "Echo Server Audio"; const QString EditEntitiesHelp = "Edit Entities Help..."; @@ -192,6 +193,7 @@ namespace MenuOption { const QString MuteEnvironment = "Mute Environment"; const QString NetworkSimulator = "Network Simulator..."; const QString NewVoxelCullingMode = "New Voxel Culling Mode"; + const QString NoFaceTracking = "None"; const QString ObeyEnvironmentalGravity = "Obey Environmental Gravity"; const QString OctreeStats = "Voxel and Entity Statistics"; const QString OffAxisProjection = "Off-Axis Projection"; diff --git a/interface/src/UIUtil.cpp b/interface/src/UIUtil.cpp index 3be6a824fa..19d3a51917 100644 --- a/interface/src/UIUtil.cpp +++ b/interface/src/UIUtil.cpp @@ -12,6 +12,9 @@ #include #include +#include "DependencyManager.h" +#include "GLCanvas.h" + #include "UIUtil.h" int UIUtil::getWindowTitleBarHeight(const QWidget* window) { @@ -27,3 +30,49 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { return titleBarHeight; } + +// When setting the font size of a widget in points, the rendered text will be larger +// on Windows and Linux than on Mac OSX. This is because Windows and Linux use a DPI +// of 96, while OSX uses 72. In order to get consistent results across platforms, the +// font sizes need to be scaled based on the system DPI. +// This function will scale the font size of widget and all +// of its children recursively. +// +// When creating widgets, if a font size isn't explicitly set Qt will choose a +// reasonable, but often different font size across platforms. This means +// YOU SHOUD EXPLICITLY SET ALL FONT SIZES and call this function OR not use +// this function at all. If you mix both you will end up with inconsistent results +// across platforms. +void UIUtil::scaleWidgetFontSizes(QWidget* widget) { + auto glCanvas = DependencyManager::get(); + + // This is the base dpi that we are targetting. This is based on Mac OSXs default DPI, + // and is the basis for all font sizes. + const float BASE_DPI = 72.0f; + +#ifdef Q_OS_MAC + const float NATIVE_DPI = 72.0f; +#else + const float NATIVE_DPI = 96.0f; +#endif + + // Scale fonts based on the native dpi. On Windows, where the native DPI is 96, + // the scale will be: 72.0 / 96.0 = 0.75 + float fontScale = BASE_DPI / NATIVE_DPI; + + internalScaleWidgetFontSizes(widget, fontScale); +} + +// Depth-first traversal through widget hierarchy. It is important to do a depth-first +// traversal because modifying the font size of a parent node can affect children. +void UIUtil::internalScaleWidgetFontSizes(QWidget* widget, float scale) { + for (auto child : widget->findChildren()) { + if (child->parent() == widget) { + internalScaleWidgetFontSizes(child, scale); + } + } + + QFont font = widget->font(); + font.setPointSizeF(font.pointSizeF() * scale); + widget->setFont(font); +} diff --git a/interface/src/UIUtil.h b/interface/src/UIUtil.h index f9dc669840..0866101ebe 100644 --- a/interface/src/UIUtil.h +++ b/interface/src/UIUtil.h @@ -18,7 +18,10 @@ class UIUtil { public: static int getWindowTitleBarHeight(const QWidget* window); + static void scaleWidgetFontSizes(QWidget* widget); +private: + static void internalScaleWidgetFontSizes(QWidget* widget, float scale); }; #endif // hifi_UIUtil_h diff --git a/interface/src/audio/AudioScope.h b/interface/src/audio/AudioScope.h index df902fe7cd..cc9367e2d5 100644 --- a/interface/src/audio/AudioScope.h +++ b/interface/src/audio/AudioScope.h @@ -75,4 +75,4 @@ private: }; -#endif // hifi_AudioScope_h \ No newline at end of file +#endif // hifi_AudioScope_h diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index afc1346ad8..52f1b3ee86 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -80,15 +80,10 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { // Only use face trackers when not playing back a recording. if (!myAvatar->isPlaying()) { FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker(); - auto dde = DependencyManager::get(); - auto faceshift = DependencyManager::get(); - - if ((_isFaceshiftConnected = (faceshift == faceTracker))) { + _isFaceTrackerConnected = faceTracker != NULL; + if (_isFaceTrackerConnected) { _blendshapeCoefficients = faceTracker->getBlendshapeCoefficients(); - } else if (dde->isActive()) { - faceTracker = dde.data(); - _blendshapeCoefficients = faceTracker->getBlendshapeCoefficients(); - } + } } // Twist the upper body to follow the rotation of the head, but only do this with my avatar, // since everyone else will see the full joint rotations for other people. @@ -109,7 +104,7 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) { _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f)); } - if (!(_isFaceshiftConnected || billboard)) { + if (!(_isFaceTrackerConnected || billboard)) { // Update eye saccades const float AVERAGE_MICROSACCADE_INTERVAL = 0.50f; const float AVERAGE_SACCADE_INTERVAL = 4.0f; diff --git a/interface/src/devices/DdeFaceTracker.cpp b/interface/src/devices/DdeFaceTracker.cpp index d8766ca0ab..87a180bd1e 100644 --- a/interface/src/devices/DdeFaceTracker.cpp +++ b/interface/src/devices/DdeFaceTracker.cpp @@ -44,58 +44,40 @@ struct Packet{ }; DdeFaceTracker::DdeFaceTracker() : -_lastReceiveTimestamp(0), -_reset(false), -_leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes -_rightBlinkIndex(1), -_leftEyeOpenIndex(8), -_rightEyeOpenIndex(9), -_browDownLeftIndex(14), -_browDownRightIndex(15), -_browUpCenterIndex(16), -_browUpLeftIndex(17), -_browUpRightIndex(18), -_mouthSmileLeftIndex(28), -_mouthSmileRightIndex(29), -_jawOpenIndex(21) + DdeFaceTracker(QHostAddress::Any, DDE_FEATURE_POINT_SERVER_PORT) +{ + +} + +DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 port) : + _lastReceiveTimestamp(0), + _reset(false), + _leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes + _rightBlinkIndex(1), + _leftEyeOpenIndex(8), + _rightEyeOpenIndex(9), + _browDownLeftIndex(14), + _browDownRightIndex(15), + _browUpCenterIndex(16), + _browUpLeftIndex(17), + _browUpRightIndex(18), + _mouthSmileLeftIndex(28), + _mouthSmileRightIndex(29), + _jawOpenIndex(21), + _host(host), + _port(port) { _blendshapeCoefficients.resize(NUM_EXPRESSION); connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); connect(&_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketErrorOccurred(QAbstractSocket::SocketError))); connect(&_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(socketStateChanged(QAbstractSocket::SocketState))); - - bindTo(DDE_FEATURE_POINT_SERVER_PORT); -} - -DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 port) : -_lastReceiveTimestamp(0), -_reset(false), -_leftBlinkIndex(0), // see http://support.faceshift.com/support/articles/35129-export-of-blendshapes -_rightBlinkIndex(1), -_leftEyeOpenIndex(8), -_rightEyeOpenIndex(9), -_browDownLeftIndex(14), -_browDownRightIndex(15), -_browUpCenterIndex(16), -_browUpLeftIndex(17), -_browUpRightIndex(18), -_mouthSmileLeftIndex(28), -_mouthSmileRightIndex(29), -_jawOpenIndex(21) -{ - _blendshapeCoefficients.resize(NUM_EXPRESSION); - - connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams())); - connect(&_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketErrorOccurred(QAbstractSocket::SocketError))); - connect(&_udpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SIGNAL(socketStateChanged(QAbstractSocket::SocketState))); - - bindTo(host, port); } DdeFaceTracker::~DdeFaceTracker() { - if(_udpSocket.isOpen()) + if (_udpSocket.isOpen()) { _udpSocket.close(); + } } void DdeFaceTracker::init() { @@ -110,15 +92,12 @@ void DdeFaceTracker::update() { } -void DdeFaceTracker::bindTo(quint16 port) { - bindTo(QHostAddress::Any, port); -} - -void DdeFaceTracker::bindTo(const QHostAddress& host, quint16 port) { - if(_udpSocket.isOpen()) { - _udpSocket.close(); +void DdeFaceTracker::setEnabled(bool enabled) { + // isOpen() does not work as one might expect on QUdpSocket; don't test isOpen() before closing socket. + _udpSocket.close(); + if (enabled) { + _udpSocket.bind(_host, _port); } - _udpSocket.bind(host, port); } bool DdeFaceTracker::isActive() const { @@ -135,7 +114,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState QString state; switch(socketState) { case QAbstractSocket::BoundState: - state = "Bounded"; + state = "Bound"; break; case QAbstractSocket::ClosingState: state = "Closing"; @@ -156,7 +135,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState state = "Unconnected"; break; } - qDebug() << "[Info] DDE Face Tracker Socket: " << socketState; + qDebug() << "[Info] DDE Face Tracker Socket: " << state; } void DdeFaceTracker::readPendingDatagrams() { diff --git a/interface/src/devices/DdeFaceTracker.h b/interface/src/devices/DdeFaceTracker.h index 71a743cce0..bd5d066732 100644 --- a/interface/src/devices/DdeFaceTracker.h +++ b/interface/src/devices/DdeFaceTracker.h @@ -28,9 +28,6 @@ public: void reset(); void update(); - //sockets - void bindTo(quint16 port); - void bindTo(const QHostAddress& host, quint16 port); bool isActive() const; float getLeftBlink() const { return getBlendshapeCoefficient(_leftBlinkIndex); } @@ -47,7 +44,10 @@ public: float getMouthSize() const { return getBlendshapeCoefficient(_jawOpenIndex); } float getMouthSmileLeft() const { return getBlendshapeCoefficient(_mouthSmileLeftIndex); } float getMouthSmileRight() const { return getBlendshapeCoefficient(_mouthSmileRightIndex); } - + +public slots: + void setEnabled(bool enabled); + private slots: //sockets @@ -59,6 +59,9 @@ private: DdeFaceTracker(); DdeFaceTracker(const QHostAddress& host, quint16 port); ~DdeFaceTracker(); + + QHostAddress _host; + quint16 _port; float getBlendshapeCoefficient(int index) const; void decodePacket(const QByteArray& buffer); diff --git a/interface/src/devices/Visage.cpp b/interface/src/devices/Visage.cpp index bdb33cc092..39bda83e61 100644 --- a/interface/src/devices/Visage.cpp +++ b/interface/src/devices/Visage.cpp @@ -174,7 +174,8 @@ void Visage::reset() { void Visage::updateEnabled() { setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Visage) && !(Menu::getInstance()->isOptionChecked(MenuOption::Faceshift) && - DependencyManager::get()->isConnectedOrConnecting())); + DependencyManager::get()->isConnectedOrConnecting()) && + !Menu::getInstance()->isOptionChecked(MenuOption::DDEFaceRegression)); } void Visage::setEnabled(bool enabled) { diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 99b60fc232..4817727909 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -21,6 +21,7 @@ #include "AccountManager.h" #include "ui_loginDialog.h" #include "LoginDialog.h" +#include "UIUtil.h" const QString FORGOT_PASSWORD_URL = "https://metaverse.highfidelity.io/users/password/new"; @@ -42,6 +43,8 @@ LoginDialog::LoginDialog(QWidget* parent) : connect(_ui->closeButton, &QPushButton::clicked, this, &LoginDialog::close); + UIUtil::scaleWidgetFontSizes(this); + // Initialize toggle connection toggleQAction(); }; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index e27875ce67..1a3ad541c9 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -23,6 +24,7 @@ #include "PreferencesDialog.h" #include "Snapshot.h" #include "UserActivityLogger.h" +#include "UIUtil.h" const int PREFERENCES_HEIGHT_PADDING = 20; @@ -46,6 +48,8 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) : // move dialog to left side move(parentWidget()->geometry().topLeft()); setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING); + + UIUtil::scaleWidgetFontSizes(this); } void PreferencesDialog::accept() { diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index 4346d813bb..9ff600675f 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -64,6 +64,8 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) : connect(ui->loadScriptFromURLButton, &QPushButton::clicked, Application::getInstance(), &Application::loadScriptURLDialog); connect(&_signalMapper, SIGNAL(mapped(QString)), Application::getInstance(), SLOT(stopScript(const QString&))); + + UIUtil::scaleWidgetFontSizes(this); } RunningScriptsWidget::~RunningScriptsWidget() { @@ -103,6 +105,7 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list) { hash.insert(list.at(i), 1); } QWidget* row = new QWidget(ui->scriptListWidget); + row->setFont(ui->scriptListWidget->font()); row->setLayout(new QHBoxLayout(row)); QUrl url = QUrl(list.at(i)); diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index e9b0f43924..13894a2592 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -28,1080 +28,572 @@ 16777215 - - - - 0 - 0 - 500 - 491 - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - + + + 13 + + + + 0 - - true + + 0 - - - - 0 - -825 - 485 - 1611 - - - - + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + 0 - - 30 + + true - - 0 - - - 30 - - - 30 - - - - - - 0 - 40 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Avatar basics - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - 14 - - - - <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - displayNameEdit - - - - - - - - 0 - 0 - - - - - 280 - 0 - - - - - Arial - - - - Qt::LeftToRight - - - - - - Not showing a name - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - 14 - - - - Head - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - Arial - 14 - - - - Body - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - skeletonURLEdit - - - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Snapshots - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - - Arial - 13 - - - - Place my Snapshots here: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Scripts - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 22 - - - - - Arial - 13 - - - - Load scripts from this directory: - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - - - 0 - 0 - - - - - Arial - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - Arial - - - - Browse - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - - 300 - 0 - - - - - Arial - - - - Load Default Scripts - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Privacy - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - 0 - - - snapshotLocationEdit - - - - - - - - 0 - 0 - - - - - 32 - 28 - - - - - 0 - 0 - - - - - Arial - - - - Send data - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Avatar tuning - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - + + + + 0 + -107 + 485 + 1550 + + + 0 - - 7 + + 30 - + 0 + + 30 + - 7 + 30 - + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + Arial + 18 + 75 + true - + color:#29967e; - Real world vertical field of view (angular size of monitor) + Avatar basics - + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + 0 - - fieldOfViewSpin + + 7 - + + 7 + + + + + + Arial + + + + <html><head/><body><p>Avatar display name <span style=" color:#909090;">(optional)</span></p></body></html> + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + displayNameEdit + + + + + + + 4 + + + 140 + + + 4 + + + + + + Arial + + + + Qt::LeftToRight + + + Not showing a name + + + + + + - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - - - - Vertical field of view - - + + 0 - - fieldOfViewSpin + + 7 - + + 7 + + + + + + Arial + + + + Head + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + snapshotLocationEdit + + + + + + + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + - - - - Arial - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 95 - 36 - - - - - Arial - - - - 1 - - - 180 - - - - - - - - - 0 - - - 8 - - - 8 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 25 - - - - - Arial - - - - Lean scale (applies to Faceshift users) - - + + 0 - - leanScaleSpin + + 7 - + + 7 + + + + + + Arial + + + + Body + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + skeletonURLEdit + + + + + + + 0 + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + - - - - Arial - - + - Qt::Horizontal + Qt::Vertical - QSizePolicy::Expanding + QSizePolicy::Fixed - 40 - 10 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - Arial - - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Avatar scale <span style=" color:#909090;">(default is 1.0)</span> - - - 0 - - - avatarScaleSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 + 20 20 - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Pupil dillation + Snapshots - - 0 - - - pupilDilationSlider + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + + + + Arial + + + + Place my Snapshots here: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + + + 0 + + + + + + Arial + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - + + + + Arial + 18 + 75 + true + + + + color:#29967e + + + Scripts + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + 0 + + + 7 + + + 0 + + + + + + Arial + + + + Load scripts from this directory: + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + + + 0 + + + + + + 0 + 0 + + + + + Arial + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + Arial + + + + Browse + + + + 0 + 0 + + + + + + + + + + 0 @@ -1110,1456 +602,1988 @@ - 130 + 150 + 0 + + + + + 300 0 - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - Arial - Faceshift eye detection - - - 0 - - - faceshiftEyeDeflectionSider + Load Default Scripts - - - - Arial - - + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - + + + + Arial + 18 + 75 + true + + + + color:#29967e + + + Privacy + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + snapshotLocationEdit + + + + + - + 0 0 - 130 - 0 + 32 + 28 - - - Arial - - - - Qt::Horizontal - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Faceshift hostname - - - 0 - - - faceshiftHostnameEdit - - - - - - - - Arial - - - - Qt::Horizontal - - + 0 0 - - - - Arial - - Qt::LeftToRight + + Send data + + + + 0 + 0 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + Arial + 18 + 75 + true + - - - - localhost - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Audio - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - 0 - 40 - - - - - Arial - - - - Enable Dynamic Jitter Buffers - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + color:#29967e - Static Jitter Buffer Frames + Avatar tuning - - 0 - - - staticDesiredJitterBufferFramesSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Real world vertical field of view (angular size of monitor) + + + 0 + + + fieldOfViewSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 1 + + + 180 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + + + + Vertical field of view + + + 0 + + + fieldOfViewSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 95 + 36 + + + + + Arial + + + + 1 + + + 180 + + + + + + + + + 0 + + + 8 + + + 8 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 25 + + + + + Arial + + + + Lean scale (applies to Faceshift users) + + + 0 + + + leanScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 10 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + Arial + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Avatar scale <span style=" color:#909090;">(default is 1.0)</span> + + + 0 + + + avatarScaleSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Pupil dillation + + + 0 + + + pupilDilationSlider + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Faceshift eye detection + + + 0 + + + faceshiftEyeDeflectionSider + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + Arial + + + + Qt::Horizontal + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Faceshift hostname + + + 0 + + + faceshiftHostnameEdit + + + + + + + + Arial + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + Arial + + + + Qt::LeftToRight + + + + + + localhost + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Max Frames Over Desired + Audio - - 0 - - - maxFramesOverDesiredSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 7 + + 7 + + + + + + 0 + 40 + + + + + Arial + + + + Enable Dynamic Jitter Buffers + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Static Jitter Buffer Frames + + + 0 + + + staticDesiredJitterBufferFramesSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Max Frames Over Desired + + + 0 + + + maxFramesOverDesiredSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 32 + + + + + Arial + + + + Use Stdev for Dynamic Jitter Calc + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window A Starve Threshold + + + 0 + + + windowStarveThresholdSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window A (raise desired on N starves) Seconds + + + 0 + + + windowSecondsForDesiredCalcOnTooManyStarvesSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Window B (desired ceiling) Seconds + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 0 + + + 10000 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 0 + + + + + Arial + + + + Repetition with Fade + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Buffer Size (Frames) + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 20 + + + 1 + + + + + + + + + 7 + + + 7 + + + + + + 0 + 0 + + + + + Arial + + + + Output Starve Detection (Automatic Buffer Size Increase) + + + + 32 + 32 + + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Starve Detection Threshold + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 500 + + + 1 + + + + + + + + + 0 + + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Output Starve Detection Period (ms) + + + 0 + + + windowSecondsForDesiredReductionSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 70 + 16777215 + + + + + Arial + + + + 1 + + + 999999999 + + + 1 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 100 - 0 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - 0 - 32 - - - - - Arial - - - - Use Stdev for Dynamic Jitter Calc - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window A Starve Threshold + Octree - - 0 - - - windowStarveThresholdSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + Max packets sent each second + + + 0 + + + maxOctreePPSSpin + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 60 + + + 6000 + + + 10 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window A (raise desired on N starves) Seconds + Oculus Rift - - 0 - - - windowSecondsForDesiredCalcOnTooManyStarvesSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 0 + + 7 + + + 0 + + + 7 + + + + + + Arial + + + + User Interface Angular Size + + + 0 + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 30 + + + 160 + + + 1 + + + 72 + + + + + + + - Qt::Horizontal + Qt::Vertical + + + QSizePolicy::Fixed - 40 + 20 20 - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - + Arial + 18 + 75 + true - - 0 - - - 10000 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - + + color:#29967e - Window B (desired ceiling) Seconds + Sixense Controllers - - 0 - - - windowSecondsForDesiredReductionSpin + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - Arial - + + + 7 - - Qt::Horizontal + + 7 - - - 40 - 20 - - - + + + + + 0 + 40 + + + + + Arial + + + + Invert Mouse Buttons + + + + 0 + 0 + + + + + - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - + + 0 - - 10000 + + 7 - - 1 + + 0 - + + 7 + + + + + + Arial + + + + Reticle Movement Speed + + + 0 + + + + + + + + Arial + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 0 + + + + + Arial + + + + 100 + + + 1 + + + 50 + + + + - - - - - - 0 - 0 - - - - - 32 - 40 - - - - - 0 - 0 - - - - - Arial - - - - Repetition with Fade - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Buffer Size (Frames) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 20 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 32 - 40 - - - - - 0 - 0 - - - - - Arial - - - - Output Starve Detection (Automatic Buffer Size Increase) - - - - 32 - 32 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Threshold - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 500 - - - 1 - - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Output Starve Detection Period (ms) - - - 0 - - - windowSecondsForDesiredReductionSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 70 - 16777215 - - - - - Arial - - - - 1 - - - 999999999 - - - 1 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Octree - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Max packets sent each second - - - 0 - - - maxOctreePPSSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 60 - - - 6000 - - - 10 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Oculus Rift - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - User Interface Angular Size - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 30 - - - 160 - - - 1 - - - 72 - - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - - Arial - 18 - 75 - true - - - - color:#29967e - - - Sixense Controllers - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - - - 0 - 35 - - - - - 0 - 40 - - - - - Arial - - - - Invert Mouse Buttons - - - - 0 - 0 - - - - - - - - 0 - - - 7 - - - 0 - - - 7 - - - - - - Arial - - - - Reticle Movement Speed - - - 0 - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 100 - - - 1 - - - 50 - - - - - - - - - - - - 0 - 490 - 501 - 50 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - 0 - 0 - 491 - 41 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - Arial - - - - Cancel - - - false - - - - - - - - Arial - - - - Save all changes - - - true - - - false - - - - - - + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Arial + + + + Cancel + + + false + + + + + + + + Arial + + + + Save all changes + + + true + + + false + + + + + + + + + diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index ec078681e3..852d61a7ba 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -10,6 +10,12 @@ 728 + + + Helvetica,Arial,sans-serif + 13 + + Running Scripts @@ -31,6 +37,12 @@ 141 + + + Helvetica,Arial,sans-serif + 13 + + 0 @@ -113,6 +125,12 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 13 + + reloadStopButtonArea { padding: 0 } @@ -131,6 +149,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 13 + + Reload all @@ -138,6 +162,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 13 + + Stop all @@ -167,6 +197,12 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 13 + + 0 @@ -191,8 +227,14 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 14 + + - font: 14pt; color: #5f5f5f; margin: 2px; + color: #5f5f5f; margin: 2px; There are no scripts running. @@ -255,12 +297,15 @@ font: bold 16pt; 0 + + + Helvetica,Arial,sans-serif + 14 + + Qt::LeftToRight - - font-size: 14pt; - 0 @@ -279,6 +324,12 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 14 + + 0 @@ -300,8 +351,14 @@ font: bold 16pt; + + + Helvetica,Arial,sans-serif + 14 + + - font: 14pt; color: #5f5f5f; margin: 2px; + color: #5f5f5f; margin: 2px; Tip diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index e1410d3304..6e068e0635 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -85,16 +85,9 @@ AudioClient::AudioClient() : _isStereoInput(false), _outputStarveDetectionStartTimeMsec(0), _outputStarveDetectionCount(0), - _outputBufferSizeFrames("audioOutputBufferSize", - DEFAULT_MAX_FRAMES_OVER_DESIRED), -#ifdef Q_OS_ANDROID - _outputStarveDetectionEnabled("audioOutputStarveDetectionEnabled", - false), -#else + _outputBufferSizeFrames("audioOutputBufferSize", DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES), _outputStarveDetectionEnabled("audioOutputStarveDetectionEnabled", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED), -#endif - _outputStarveDetectionPeriodMsec("audioOutputStarveDetectionPeriod", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD), _outputStarveDetectionThreshold("audioOutputStarveDetectionThreshold", @@ -1090,19 +1083,23 @@ void AudioClient::outputNotify() { if (recentUnfulfilled > 0) { if (_outputStarveDetectionEnabled.get()) { quint64 now = usecTimestampNow() / 1000; - quint64 dt = now - _outputStarveDetectionStartTimeMsec; + int dt = (int)(now - _outputStarveDetectionStartTimeMsec); if (dt > _outputStarveDetectionPeriodMsec.get()) { _outputStarveDetectionStartTimeMsec = now; _outputStarveDetectionCount = 0; } else { _outputStarveDetectionCount += recentUnfulfilled; if (_outputStarveDetectionCount > _outputStarveDetectionThreshold.get()) { - int newOutputBufferSizeFrames = _outputBufferSizeFrames.get() + 1; - qDebug() << "Starve detection threshold met, increasing buffer size to " << newOutputBufferSizeFrames; - setOutputBufferSize(newOutputBufferSizeFrames); - _outputStarveDetectionStartTimeMsec = now; _outputStarveDetectionCount = 0; + + int oldOutputBufferSizeFrames = _outputBufferSizeFrames.get(); + int newOutputBufferSizeFrames = oldOutputBufferSizeFrames + 1; + setOutputBufferSize(newOutputBufferSizeFrames); + newOutputBufferSizeFrames = _outputBufferSizeFrames.get(); + if (newOutputBufferSizeFrames > oldOutputBufferSizeFrames) { + qDebug() << "Starve detection threshold met, increasing buffer size to " << newOutputBufferSizeFrames; + } } } } diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index f75843df5f..7ac445a7fc 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -57,7 +57,11 @@ static const int NUM_AUDIO_CHANNELS = 2; static const int DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 3; static const int MIN_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 1; static const int MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES = 20; -static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = true; +#if defined(Q_OS_ANDROID) || defined(Q_OS_WIN) + static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = false; +#else + static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED = true; +#endif static const int DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD = 3; static const quint64 DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD = 10 * 1000; // 10 Seconds diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 4c71c5e9ed..a3d330f84b 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -44,7 +44,7 @@ AvatarData::AvatarData() : _handState(0), _keyState(NO_KEY_DOWN), _isChatCirclingEnabled(false), - _forceFaceshiftConnected(false), + _forceFaceTrackerConnected(false), _hasNewJointRotations(true), _headData(NULL), _handData(NULL), @@ -136,8 +136,8 @@ QByteArray AvatarData::toByteArray() { if (!_headData) { _headData = new HeadData(this); } - if (_forceFaceshiftConnected) { - _headData->_isFaceshiftConnected = true; + if (_forceFaceTrackerConnected) { + _headData->_isFaceTrackerConnected = true; } QByteArray avatarDataByteArray; @@ -191,7 +191,7 @@ QByteArray AvatarData::toByteArray() { setAtBit(bitItems, HAND_STATE_FINGER_POINTING_BIT); } // faceshift state - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { setAtBit(bitItems, IS_FACESHIFT_CONNECTED); } if (_isChatCirclingEnabled) { @@ -208,7 +208,7 @@ QByteArray AvatarData::toByteArray() { } // If it is connected, pack up the data - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { memcpy(destinationBuffer, &_headData->_leftEyeBlink, sizeof(float)); destinationBuffer += sizeof(float); @@ -417,7 +417,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { _handState = getSemiNibbleAt(bitItems, HAND_STATE_START_BIT) + (oneAtBit(bitItems, HAND_STATE_FINGER_POINTING_BIT) ? IS_FINGER_POINTING_FLAG : 0); - _headData->_isFaceshiftConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED); + _headData->_isFaceTrackerConnected = oneAtBit(bitItems, IS_FACESHIFT_CONNECTED); _isChatCirclingEnabled = oneAtBit(bitItems, IS_CHAT_CIRCLING_ENABLED); bool hasReferential = oneAtBit(bitItems, HAS_REFERENTIAL); @@ -436,7 +436,7 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) { } - if (_headData->_isFaceshiftConnected) { + if (_headData->_isFaceTrackerConnected) { float leftEyeBlink, rightEyeBlink, averageLoudness, browAudioLift; minPossibleSize += sizeof(leftEyeBlink) + sizeof(rightEyeBlink) + sizeof(averageLoudness) + sizeof(browAudioLift); minPossibleSize++; // one byte for blendDataSize diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 8848a261df..a8a330485c 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -241,7 +241,7 @@ public: Q_INVOKABLE void setBlendshape(QString name, float val) { _headData->setBlendshape(name, val); } - void setForceFaceshiftConnected(bool connected) { _forceFaceshiftConnected = connected; } + void setForceFaceTrackerConnected(bool connected) { _forceFaceTrackerConnected = connected; } // key state void setKeyState(KeyState s) { _keyState = s; } @@ -357,7 +357,7 @@ protected: KeyState _keyState; bool _isChatCirclingEnabled; - bool _forceFaceshiftConnected; + bool _forceFaceTrackerConnected; bool _hasNewJointRotations; // set in AvatarData, cleared in Avatar HeadData* _headData; diff --git a/libraries/avatars/src/HeadData.cpp b/libraries/avatars/src/HeadData.cpp index 8dec8368c9..7789385547 100644 --- a/libraries/avatars/src/HeadData.cpp +++ b/libraries/avatars/src/HeadData.cpp @@ -31,7 +31,7 @@ HeadData::HeadData(AvatarData* owningAvatar) : _torsoTwist(0.0f), _lookAtPosition(0.0f, 0.0f, 0.0f), _audioLoudness(0.0f), - _isFaceshiftConnected(false), + _isFaceTrackerConnected(false), _leftEyeBlink(0.0f), _rightEyeBlink(0.0f), _averageLoudness(0.0f), diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index cef5d5fbca..b180541914 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -92,7 +92,7 @@ protected: glm::vec3 _lookAtPosition; float _audioLoudness; - bool _isFaceshiftConnected; + bool _isFaceTrackerConnected; float _leftEyeBlink; float _rightEyeBlink; float _averageLoudness; diff --git a/libraries/avatars/src/Player.cpp b/libraries/avatars/src/Player.cpp index 2fabc39bac..2b92acb189 100644 --- a/libraries/avatars/src/Player.cpp +++ b/libraries/avatars/src/Player.cpp @@ -110,7 +110,7 @@ void Player::startPlaying() { } // Fake faceshift connection - _avatar->setForceFaceshiftConnected(true); + _avatar->setForceFaceTrackerConnected(true); qDebug() << "Recorder::startPlaying()"; setupAudioThread(); @@ -136,8 +136,8 @@ void Player::stopPlaying() { cleanupAudioThread(); _avatar->clearJointsData(); - // Turn off fake faceshift connection - _avatar->setForceFaceshiftConnected(false); + // Turn off fake face tracker connection + _avatar->setForceFaceTrackerConnected(false); if (_useAttachments) { _avatar->setAttachmentData(_currentContext.attachments); @@ -255,8 +255,8 @@ void Player::play() { HeadData* head = const_cast(_avatar->getHeadData()); if (head) { - // Make sure fake faceshift connection doesn't get turned off - _avatar->setForceFaceshiftConnected(true); + // Make sure fake face tracker connection doesn't get turned off + _avatar->setForceFaceTrackerConnected(true); QVector blendCoef(currentFrame.getBlendshapeCoefficients().size()); for (int i = 0; i < currentFrame.getBlendshapeCoefficients().size(); ++i) { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 353aab0a64..f3f84876ba 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -170,6 +171,31 @@ void EntityItemProperties::setLastEdited(quint64 usecTime) { _lastEdited = usecTime > _created ? usecTime : _created; } +const char* shapeTypeNames[] = {"none", "box", "sphere"}; + +QHash stringToShapeTypeLookup; + +void buildStringToShapeTypeLookup() { + stringToShapeTypeLookup["none"] = SHAPE_TYPE_NONE; + stringToShapeTypeLookup["box"] = SHAPE_TYPE_BOX; + stringToShapeTypeLookup["sphere"] = SHAPE_TYPE_SPHERE; +} + +QString EntityItemProperties::getShapeTypeAsString() const { + return QString(shapeTypeNames[_shapeType]); +} + +void EntityItemProperties::setShapeTypeFromString(const QString& shapeName) { + if (stringToShapeTypeLookup.empty()) { + buildStringToShapeTypeLookup(); + } + auto shapeTypeItr = stringToShapeTypeLookup.find(shapeName.toLower()); + if (shapeTypeItr != stringToShapeTypeLookup.end()) { + _shapeType = shapeTypeItr.value(); + _shapeTypeChanged = true; + } +} + EntityPropertyFlags EntityItemProperties::getChangedProperties() const { EntityPropertyFlags changedProperties; @@ -270,7 +296,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE(lineHeight); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(textColor, getTextColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(backgroundColor, getBackgroundColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE(shapeType); + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(shapeType, getShapeTypeAsString()); // Sitting properties support QScriptValue sittingPoints = engine->newObject(); @@ -303,8 +329,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons } void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { - - QScriptValue typeScriptValue = object.property("type"); if (typeScriptValue.isValid()) { setType(typeScriptValue.toVariant().toString()); @@ -350,7 +374,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(lineHeight, setLineHeight); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(textColor, setTextColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(backgroundColor, setBackgroundColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(shapeType, setShapeType, ShapeType); + COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(shapeType, ShapeType); _lastEdited = usecTimestampNow(); } diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 51779d3f56..2391bcde84 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -181,7 +181,7 @@ public: DEFINE_PROPERTY(PROP_LINE_HEIGHT, LineHeight, lineHeight, float); DEFINE_PROPERTY_REF(PROP_TEXT_COLOR, TextColor, textColor, xColor); DEFINE_PROPERTY_REF(PROP_BACKGROUND_COLOR, BackgroundColor, backgroundColor, xColor); - DEFINE_PROPERTY_REF(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); + DEFINE_PROPERTY_REF_ENUM(PROP_SHAPE_TYPE, ShapeType, shapeType, ShapeType); public: float getMaxDimension() const { return glm::max(_dimensions.x, _dimensions.y, _dimensions.z); } diff --git a/libraries/entities/src/EntityItemPropertiesMacros.h b/libraries/entities/src/EntityItemPropertiesMacros.h index 592f808e1a..5e04614656 100644 --- a/libraries/entities/src/EntityItemPropertiesMacros.h +++ b/libraries/entities/src/EntityItemPropertiesMacros.h @@ -180,15 +180,6 @@ #define COPY_PROPERTY_TO_QSCRIPTVALUE(P) \ properties.setProperty(#P, _##P); -#define COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(P, S, E) \ - QScriptValue P = object.property(#P); \ - if (P.isValid()) { \ - E newValue = (E)(P.toVariant().toInt()); \ - if (_defaultSettings || newValue != _##P) { \ - S(newValue); \ - } \ - } - #define COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(P, S) \ QScriptValue P = object.property(#P); \ if (P.isValid()) { \ @@ -280,6 +271,15 @@ } \ } \ } + +#define COPY_PROPERTY_FROM_QSCRITPTVALUE_ENUM(P, S) \ + QScriptValue P = object.property(#P); \ + if (P.isValid()) { \ + QString newValue = P.toVariant().toString(); \ + if (_defaultSettings || newValue != get##S##AsString()) { \ + set##S##FromString(newValue); \ + } \ + } #define CONSTRUCT_PROPERTY(n, V) \ _##n(V), \ @@ -321,6 +321,17 @@ T _##n; \ bool _##n##Changed; +#define DEFINE_PROPERTY_REF_ENUM(P, N, n, T) \ + public: \ + const T& get##N() const { return _##n; } \ + void set##N(const T& value) { _##n = value; _##n##Changed = true; } \ + bool n##Changed() const { return _##n##Changed; } \ + QString get##N##AsString() const; \ + void set##N##FromString(const QString& name); \ + private: \ + T _##n; \ + bool _##n##Changed; + #define DEBUG_PROPERTY_IF_CHANGED(D, P, N, n, x) \ if (P.n##Changed()) { \ D << " " << #n << ":" << P.get##N() << x << "\n"; \