summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-06-26 02:06:58 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-07-26 18:59:33 +0200
commitd1716c2e7abb6575a239449c992bcca71a768f9e (patch)
tree66dc3477c1dfc573ac384263ae24829067bab981
parent222e489dfdafedff2f003142e268611ff12c0643 (diff)
Change window title in Movie Maker mode to display useful information
The frame number and movie time is now displayed in the window title. This way, you can see how quickly the video recording is advancing in real-time (and perhaps tweak your settings if it's going too slow).
-rw-r--r--servers/movie_writer/movie_writer.cpp15
-rw-r--r--servers/movie_writer/movie_writer.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp
index 9f96b8cfda..93f9f8ea08 100644
--- a/servers/movie_writer/movie_writer.cpp
+++ b/servers/movie_writer/movie_writer.cpp
@@ -30,6 +30,8 @@
#include "movie_writer.h"
#include "core/config/project_settings.h"
+#include "core/io/dir_access.h"
+#include "servers/display_server.h"
MovieWriter *MovieWriter::writers[MovieWriter::MAX_WRITERS];
uint32_t MovieWriter::writer_count = 0;
@@ -101,6 +103,7 @@ void MovieWriter::get_supported_extensions(List<String> *r_extensions) const {
}
void MovieWriter::begin(const Size2i &p_movie_size, uint32_t p_fps, const String &p_base_path) {
+ project_name = GLOBAL_GET("application/config/name");
mix_rate = get_audio_mix_rate();
AudioDriverDummy::get_dummy_singleton()->set_mix_rate(mix_rate);
AudioDriverDummy::get_dummy_singleton()->set_speaker_mode(AudioDriver::SpeakerMode(get_audio_speaker_mode()));
@@ -162,6 +165,18 @@ void MovieWriter::set_extensions_hint() {
}
void MovieWriter::add_frame(const Ref<Image> &p_image) {
+ const int movie_time_seconds = Engine::get_singleton()->get_frames_drawn() / fps;
+ const String movie_time = vformat("%s:%s:%s",
+ String::num(movie_time_seconds / 3600).pad_zeros(2),
+ String::num((movie_time_seconds % 3600) / 60).pad_zeros(2),
+ String::num(movie_time_seconds % 60).pad_zeros(2));
+
+#ifdef DEBUG_ENABLED
+ DisplayServer::get_singleton()->window_set_title(vformat("MovieWriter: Frame %d (time: %s) - %s (DEBUG)", Engine::get_singleton()->get_frames_drawn(), movie_time, project_name));
+#else
+ DisplayServer::get_singleton()->window_set_title(vformat("MovieWriter: Frame %d (time: %s) - %s", Engine::get_singleton()->get_frames_drawn(), movie_time, project_name));
+#endif
+
AudioDriverDummy::get_dummy_singleton()->mix_audio(mix_rate / fps, audio_mix_buffer.ptr());
write_frame(p_image, audio_mix_buffer.ptr());
}
diff --git a/servers/movie_writer/movie_writer.h b/servers/movie_writer/movie_writer.h
index 1ec6e93052..7877a60715 100644
--- a/servers/movie_writer/movie_writer.h
+++ b/servers/movie_writer/movie_writer.h
@@ -42,6 +42,8 @@ class MovieWriter : public Object {
uint64_t mix_rate = 0;
uint32_t audio_channels = 0;
+ String project_name;
+
LocalVector<int32_t> audio_mix_buffer;
enum {