From d1716c2e7abb6575a239449c992bcca71a768f9e Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 26 Jun 2022 02:06:58 +0200 Subject: 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). --- servers/movie_writer/movie_writer.cpp | 15 +++++++++++++++ servers/movie_writer/movie_writer.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'servers/movie_writer') 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 *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 &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 audio_mix_buffer; enum { -- cgit v1.2.3