mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:19:02 +02:00
GIFs: Quality improvements; duration tweaks; processing notif (#9139)
This commit is contained in:
parent
24e54f25bf
commit
30dade242c
6 changed files with 41 additions and 12 deletions
|
@ -62,6 +62,7 @@ signals:
|
||||||
void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo);
|
void domainConnectionRefused(const QString& reasonMessage, int reasonCode, const QString& extraInfo);
|
||||||
void snapshotTaken(const QString& pathStillSnapshot, const QString& pathAnimatedSnapshot, bool notify);
|
void snapshotTaken(const QString& pathStillSnapshot, const QString& pathAnimatedSnapshot, bool notify);
|
||||||
void snapshotShared(const QString& error);
|
void snapshotShared(const QString& error);
|
||||||
|
void processingGif();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getPreviousBrowseLocation() const;
|
QString getPreviousBrowseLocation() const;
|
||||||
|
|
|
@ -105,8 +105,8 @@ void setupPreferences() {
|
||||||
auto getter = []()->float { return SnapshotAnimated::snapshotAnimatedDuration.get(); };
|
auto getter = []()->float { return SnapshotAnimated::snapshotAnimatedDuration.get(); };
|
||||||
auto setter = [](float value) { SnapshotAnimated::snapshotAnimatedDuration.set(value); };
|
auto setter = [](float value) { SnapshotAnimated::snapshotAnimatedDuration.set(value); };
|
||||||
auto preference = new SpinnerPreference(SNAPSHOTS, "Animated Snapshot Duration", getter, setter);
|
auto preference = new SpinnerPreference(SNAPSHOTS, "Animated Snapshot Duration", getter, setter);
|
||||||
preference->setMin(3);
|
preference->setMin(1);
|
||||||
preference->setMax(10);
|
preference->setMax(5);
|
||||||
preference->setStep(1);
|
preference->setStep(1);
|
||||||
preferences->addPreference(preference);
|
preferences->addPreference(preference);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,9 @@ void SnapshotAnimated::captureFrames() {
|
||||||
SnapshotAnimated::snapshotAnimatedTimestamp = 0;
|
SnapshotAnimated::snapshotAnimatedTimestamp = 0;
|
||||||
SnapshotAnimated::snapshotAnimatedFirstFrameTimestamp = 0;
|
SnapshotAnimated::snapshotAnimatedFirstFrameTimestamp = 0;
|
||||||
|
|
||||||
|
// Notify the user that we're processing the snapshot
|
||||||
|
emit SnapshotAnimated::snapshotAnimatedDM->processingGif();
|
||||||
|
|
||||||
// Kick off the thread that'll pack the frames into the GIF
|
// Kick off the thread that'll pack the frames into the GIF
|
||||||
QtConcurrent::run(processFrames);
|
QtConcurrent::run(processFrames);
|
||||||
// Stop the snapshot QTimer. This action by itself DOES NOT GUARANTEE
|
// Stop the snapshot QTimer. This action by itself DOES NOT GUARANTEE
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include "scripting/WindowScriptingInterface.h"
|
#include "scripting/WindowScriptingInterface.h"
|
||||||
|
|
||||||
// If the snapshot width or the framerate are too high for the
|
// If the snapshot width or the framerate are too high for the
|
||||||
// application to handle, the framerate of the output GIF will drop.
|
// computer to handle, the framerate of the output GIF will drop.
|
||||||
#define SNAPSNOT_ANIMATED_WIDTH (480)
|
#define SNAPSNOT_ANIMATED_WIDTH (720)
|
||||||
// This value should divide evenly into 100. Snapshot framerate is NOT guaranteed.
|
// This value should divide evenly into 100. Snapshot framerate is NOT guaranteed.
|
||||||
#define SNAPSNOT_ANIMATED_TARGET_FRAMERATE (25)
|
#define SNAPSNOT_ANIMATED_TARGET_FRAMERATE (25)
|
||||||
#define SNAPSNOT_ANIMATED_DURATION_SECS (3)
|
#define SNAPSNOT_ANIMATED_DURATION_SECS (3)
|
||||||
|
|
|
@ -532,6 +532,10 @@ function onSnapshotTaken(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processingGif() {
|
||||||
|
createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT);
|
||||||
|
}
|
||||||
|
|
||||||
// handles mouse clicks on buttons
|
// handles mouse clicks on buttons
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
var pickRay,
|
var pickRay,
|
||||||
|
@ -631,6 +635,7 @@ Script.scriptEnding.connect(scriptEnding);
|
||||||
Menu.menuItemEvent.connect(menuItemEvent);
|
Menu.menuItemEvent.connect(menuItemEvent);
|
||||||
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
Window.domainConnectionRefused.connect(onDomainConnectionRefused);
|
||||||
Window.snapshotTaken.connect(onSnapshotTaken);
|
Window.snapshotTaken.connect(onSnapshotTaken);
|
||||||
|
Window.processingGif.connect(processingGif);
|
||||||
Window.notifyEditError = onEditError;
|
Window.notifyEditError = onEditError;
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
|
@ -156,19 +156,22 @@ function isDomainOpen(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
||||||
// show hud
|
// If we're not taking an animated snapshot, we have to show the HUD.
|
||||||
toolBar.writeProperty("visible", true);
|
// If we ARE taking an animated snapshot, we've already re-enabled the HUD by this point.
|
||||||
Reticle.visible = reticleVisible;
|
if (pathAnimatedSnapshot === "") {
|
||||||
|
// show hud
|
||||||
|
toolBar.writeProperty("visible", true);
|
||||||
|
Reticle.visible = reticleVisible;
|
||||||
|
// show overlays if they were on
|
||||||
|
if (resetOverlays) {
|
||||||
|
Menu.setIsOptionChecked("Overlays", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
// update button states
|
// update button states
|
||||||
button.writeProperty("buttonState", 1);
|
button.writeProperty("buttonState", 1);
|
||||||
button.writeProperty("defaultState", 1);
|
button.writeProperty("defaultState", 1);
|
||||||
button.writeProperty("hoverState", 3);
|
button.writeProperty("hoverState", 3);
|
||||||
Window.snapshotTaken.disconnect(resetButtons);
|
Window.snapshotTaken.disconnect(resetButtons);
|
||||||
// show overlays if they were on
|
|
||||||
if (resetOverlays) {
|
|
||||||
Menu.setIsOptionChecked("Overlays", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// A Snapshot Review dialog might be left open indefinitely after taking the picture,
|
// A Snapshot Review dialog might be left open indefinitely after taking the picture,
|
||||||
// during which time the user may have moved. So stash that info in the dialog so that
|
// during which time the user may have moved. So stash that info in the dialog so that
|
||||||
|
@ -187,13 +190,30 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processingGif() {
|
||||||
|
// show hud
|
||||||
|
toolBar.writeProperty("visible", true);
|
||||||
|
Reticle.visible = reticleVisible;
|
||||||
|
|
||||||
|
// update button states
|
||||||
|
button.writeProperty("buttonState", 1);
|
||||||
|
button.writeProperty("defaultState", 1);
|
||||||
|
button.writeProperty("hoverState", 3);
|
||||||
|
// show overlays if they were on
|
||||||
|
if (resetOverlays) {
|
||||||
|
Menu.setIsOptionChecked("Overlays", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
Window.snapshotShared.connect(snapshotShared);
|
Window.snapshotShared.connect(snapshotShared);
|
||||||
|
Window.processingGif.connect(processingGif);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
toolBar.removeButton("snapshot");
|
toolBar.removeButton("snapshot");
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
Window.snapshotShared.disconnect(snapshotShared);
|
Window.snapshotShared.disconnect(snapshotShared);
|
||||||
|
Window.processingGif.disconnect(processingGif);
|
||||||
});
|
});
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue