Merge pull request #62415 from Calinou/movie-maker-change-window-title
Change window title in Movie Maker mode to display useful information
This commit is contained in:
commit
674ccdb244
2 changed files with 17 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue