summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-06-26 01:38:20 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-07-27 18:50:28 +0200
commitaaeb60eafc44cda6151a1c6f06ac709335f06f00 (patch)
treeefb119dd03a6b5cfd245f423ff36ee5f82bdcdec /core
parent03987738aae247d9a62c239a3cdf2546612ca84a (diff)
Add a Movie Quit On Finish property to AnimationPlayer
This quits the project when an animation is done playing in the given AnimationPlayer, but only in Movie Maker mode. When this happens, a message is printed with the absolute path of the AnimationPlayer node that caused the engine to quit. This can be used to create videos that stop at a specified time without having to write any script. A report is now also printed to the console when the video is done recording (as long as the engine was exited properly). This report is unfortunately not always visible in the editor's Output panel, as it's printed too late. A method was also added to get the path to the output file from the scripting API.
Diffstat (limited to 'core')
-rw-r--r--core/config/engine.cpp8
-rw-r--r--core/config/engine.h4
-rw-r--r--core/core_bind.cpp6
-rw-r--r--core/core_bind.h3
4 files changed, 21 insertions, 0 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 782d369ae6..44ad4961d9 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -246,6 +246,14 @@ void Engine::get_singletons(List<Singleton> *p_singletons) {
}
}
+String Engine::get_write_movie_path() const {
+ return write_movie_path;
+}
+
+void Engine::set_write_movie_path(const String &p_path) {
+ write_movie_path = p_path;
+}
+
void Engine::set_shader_cache_path(const String &p_path) {
shader_cache_path = p_path;
}
diff --git a/core/config/engine.h b/core/config/engine.h
index 82e3ee5487..68562643e7 100644
--- a/core/config/engine.h
+++ b/core/config/engine.h
@@ -76,6 +76,7 @@ private:
static Engine *singleton;
+ String write_movie_path;
String shader_cache_path;
public:
@@ -138,6 +139,9 @@ public:
Dictionary get_license_info() const;
String get_license_text() const;
+ void set_write_movie_path(const String &p_path);
+ String get_write_movie_path() const;
+
void set_shader_cache_path(const String &p_path);
String get_shader_cache_path() const;
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 8e776d6f05..e5d5464643 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -2290,6 +2290,10 @@ bool Engine::is_editor_hint() const {
return ::Engine::get_singleton()->is_editor_hint();
}
+String Engine::get_write_movie_path() const {
+ return ::Engine::get_singleton()->get_write_movie_path();
+}
+
void Engine::set_print_error_messages(bool p_enabled) {
::Engine::get_singleton()->set_print_error_messages(p_enabled);
}
@@ -2339,6 +2343,8 @@ void Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_editor_hint"), &Engine::is_editor_hint);
+ ClassDB::bind_method(D_METHOD("get_write_movie_path"), &Engine::get_write_movie_path);
+
ClassDB::bind_method(D_METHOD("set_print_error_messages", "enabled"), &Engine::set_print_error_messages);
ClassDB::bind_method(D_METHOD("is_printing_error_messages"), &Engine::is_printing_error_messages);
diff --git a/core/core_bind.h b/core/core_bind.h
index e222a220f0..f98de81354 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -676,6 +676,9 @@ public:
void set_editor_hint(bool p_enabled);
bool is_editor_hint() const;
+ // `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect.
+ String get_write_movie_path() const;
+
void set_print_error_messages(bool p_enabled);
bool is_printing_error_messages() const;