editor_run_bar.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /**************************************************************************/
  2. /* editor_run_bar.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "editor_run_bar.h"
  31. #include "core/config/project_settings.h"
  32. #include "editor/debugger/editor_debugger_node.h"
  33. #include "editor/debugger/script_editor_debugger.h"
  34. #include "editor/editor_command_palette.h"
  35. #include "editor/editor_node.h"
  36. #include "editor/editor_run_native.h"
  37. #include "editor/editor_settings.h"
  38. #include "editor/editor_string_names.h"
  39. #include "editor/gui/editor_bottom_panel.h"
  40. #include "editor/gui/editor_quick_open_dialog.h"
  41. #include "scene/gui/box_container.h"
  42. #include "scene/gui/button.h"
  43. #include "scene/gui/panel_container.h"
  44. EditorRunBar *EditorRunBar::singleton = nullptr;
  45. void EditorRunBar::_notification(int p_what) {
  46. switch (p_what) {
  47. case NOTIFICATION_POSTINITIALIZE: {
  48. _reset_play_buttons();
  49. } break;
  50. case NOTIFICATION_THEME_CHANGED: {
  51. _update_play_buttons();
  52. profiler_autostart_indicator->set_button_icon(get_editor_theme_icon(SNAME("ProfilerAutostartWarning")));
  53. pause_button->set_button_icon(get_editor_theme_icon(SNAME("Pause")));
  54. stop_button->set_button_icon(get_editor_theme_icon(SNAME("Stop")));
  55. if (is_movie_maker_enabled()) {
  56. main_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("LaunchPadMovieMode"), EditorStringName(EditorStyles)));
  57. write_movie_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("MovieWriterButtonPressed"), EditorStringName(EditorStyles)));
  58. } else {
  59. main_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("LaunchPadNormal"), EditorStringName(EditorStyles)));
  60. write_movie_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("MovieWriterButtonNormal"), EditorStringName(EditorStyles)));
  61. }
  62. write_movie_button->set_button_icon(get_editor_theme_icon(SNAME("MainMovieWrite")));
  63. // This button behaves differently, so color it as such.
  64. write_movie_button->begin_bulk_theme_override();
  65. write_movie_button->add_theme_color_override("icon_normal_color", get_theme_color(SNAME("movie_writer_icon_normal"), EditorStringName(EditorStyles)));
  66. write_movie_button->add_theme_color_override("icon_pressed_color", get_theme_color(SNAME("movie_writer_icon_pressed"), EditorStringName(EditorStyles)));
  67. write_movie_button->add_theme_color_override("icon_hover_color", get_theme_color(SNAME("movie_writer_icon_hover"), EditorStringName(EditorStyles)));
  68. write_movie_button->add_theme_color_override("icon_hover_pressed_color", get_theme_color(SNAME("movie_writer_icon_hover_pressed"), EditorStringName(EditorStyles)));
  69. write_movie_button->end_bulk_theme_override();
  70. } break;
  71. }
  72. }
  73. void EditorRunBar::_reset_play_buttons() {
  74. play_button->set_pressed(false);
  75. play_button->set_button_icon(get_editor_theme_icon(SNAME("MainPlay")));
  76. play_button->set_tooltip_text(TTR("Play the project."));
  77. play_scene_button->set_pressed(false);
  78. play_scene_button->set_button_icon(get_editor_theme_icon(SNAME("PlayScene")));
  79. play_scene_button->set_tooltip_text(TTR("Play the edited scene."));
  80. play_custom_scene_button->set_pressed(false);
  81. play_custom_scene_button->set_button_icon(get_editor_theme_icon(SNAME("PlayCustom")));
  82. play_custom_scene_button->set_tooltip_text(TTR("Play a custom scene."));
  83. }
  84. void EditorRunBar::_update_play_buttons() {
  85. _reset_play_buttons();
  86. if (!is_playing()) {
  87. return;
  88. }
  89. Button *active_button = nullptr;
  90. if (current_mode == RUN_CURRENT) {
  91. active_button = play_scene_button;
  92. } else if (current_mode == RUN_CUSTOM) {
  93. active_button = play_custom_scene_button;
  94. } else {
  95. active_button = play_button;
  96. }
  97. if (active_button) {
  98. active_button->set_pressed(true);
  99. active_button->set_button_icon(get_editor_theme_icon(SNAME("Reload")));
  100. active_button->set_tooltip_text(TTR("Reload the played scene."));
  101. }
  102. }
  103. void EditorRunBar::_write_movie_toggled(bool p_enabled) {
  104. if (p_enabled) {
  105. add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("LaunchPadMovieMode"), EditorStringName(EditorStyles)));
  106. write_movie_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("MovieWriterButtonPressed"), EditorStringName(EditorStyles)));
  107. } else {
  108. add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("LaunchPadNormal"), EditorStringName(EditorStyles)));
  109. write_movie_panel->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("MovieWriterButtonNormal"), EditorStringName(EditorStyles)));
  110. }
  111. }
  112. void EditorRunBar::_quick_run_selected(const String &p_file_path) {
  113. play_custom_scene(p_file_path);
  114. }
  115. void EditorRunBar::_play_custom_pressed() {
  116. if (editor_run.get_status() == EditorRun::STATUS_STOP || current_mode != RunMode::RUN_CUSTOM) {
  117. stop_playing();
  118. EditorNode::get_singleton()->get_quick_open_dialog()->popup_dialog({ "PackedScene" }, callable_mp(this, &EditorRunBar::_quick_run_selected));
  119. play_custom_scene_button->set_pressed(false);
  120. } else {
  121. // Reload if already running a custom scene.
  122. String last_custom_scene = run_custom_filename; // This is necessary to have a copy of the string.
  123. play_custom_scene(last_custom_scene);
  124. }
  125. }
  126. void EditorRunBar::_play_current_pressed() {
  127. if (editor_run.get_status() == EditorRun::STATUS_STOP || current_mode != RunMode::RUN_CURRENT) {
  128. play_current_scene();
  129. } else {
  130. // Reload if already running the current scene.
  131. play_current_scene(true);
  132. }
  133. }
  134. void EditorRunBar::_run_scene(const String &p_scene_path) {
  135. ERR_FAIL_COND_MSG(current_mode == RUN_CUSTOM && p_scene_path.is_empty(), "Attempting to run a custom scene with an empty path.");
  136. if (editor_run.get_status() == EditorRun::STATUS_PLAY) {
  137. return;
  138. }
  139. _reset_play_buttons();
  140. String write_movie_file;
  141. if (is_movie_maker_enabled()) {
  142. if (current_mode == RUN_CURRENT) {
  143. Node *scene_root = nullptr;
  144. if (p_scene_path.is_empty()) {
  145. scene_root = get_tree()->get_edited_scene_root();
  146. } else {
  147. int scene_index = EditorNode::get_editor_data().get_edited_scene_from_path(p_scene_path);
  148. if (scene_index >= 0) {
  149. scene_root = EditorNode::get_editor_data().get_edited_scene_root(scene_index);
  150. }
  151. }
  152. if (scene_root && scene_root->has_meta("movie_file")) {
  153. // If the scene file has a movie_file metadata set, use this as file.
  154. // Quick workaround if you want to have multiple scenes that write to
  155. // multiple movies.
  156. write_movie_file = scene_root->get_meta("movie_file");
  157. }
  158. }
  159. if (write_movie_file.is_empty()) {
  160. write_movie_file = GLOBAL_GET("editor/movie_writer/movie_file");
  161. }
  162. if (write_movie_file.is_empty()) {
  163. // TODO: Provide options to directly resolve the issue with a custom dialog.
  164. EditorNode::get_singleton()->show_accept(TTR("Movie Maker mode is enabled, but no movie file path has been specified.\nA default movie file path can be specified in the project settings under the Editor > Movie Writer category.\nAlternatively, for running single scenes, a `movie_file` string metadata can be added to the root node,\nspecifying the path to a movie file that will be used when recording that scene."), TTR("OK"));
  165. return;
  166. }
  167. }
  168. String run_filename;
  169. switch (current_mode) {
  170. case RUN_CUSTOM: {
  171. run_filename = p_scene_path;
  172. run_custom_filename = run_filename;
  173. } break;
  174. case RUN_CURRENT: {
  175. if (!p_scene_path.is_empty()) {
  176. run_filename = p_scene_path;
  177. run_current_filename = run_filename;
  178. break;
  179. }
  180. Node *scene_root = get_tree()->get_edited_scene_root();
  181. if (!scene_root) {
  182. EditorNode::get_singleton()->show_accept(TTR("There is no defined scene to run."), TTR("OK"));
  183. return;
  184. }
  185. if (scene_root->get_scene_file_path().is_empty()) {
  186. EditorNode::get_singleton()->save_before_run();
  187. return;
  188. }
  189. run_filename = scene_root->get_scene_file_path();
  190. run_current_filename = run_filename;
  191. } break;
  192. default: {
  193. if (!EditorNode::get_singleton()->ensure_main_scene(false)) {
  194. return;
  195. }
  196. run_filename = GLOBAL_GET("application/run/main_scene");
  197. } break;
  198. }
  199. EditorNode::get_singleton()->try_autosave();
  200. if (!EditorNode::get_singleton()->call_build()) {
  201. return;
  202. }
  203. EditorDebuggerNode::get_singleton()->start();
  204. Error error = editor_run.run(run_filename, write_movie_file);
  205. if (error != OK) {
  206. EditorDebuggerNode::get_singleton()->stop();
  207. EditorNode::get_singleton()->show_accept(TTR("Could not start subprocess(es)!"), TTR("OK"));
  208. return;
  209. }
  210. _update_play_buttons();
  211. stop_button->set_disabled(false);
  212. emit_signal(SNAME("play_pressed"));
  213. }
  214. void EditorRunBar::_run_native(const Ref<EditorExportPreset> &p_preset) {
  215. EditorNode::get_singleton()->try_autosave();
  216. if (run_native->is_deploy_debug_remote_enabled()) {
  217. stop_playing();
  218. if (!EditorNode::get_singleton()->call_build()) {
  219. return; // Build failed.
  220. }
  221. EditorDebuggerNode::get_singleton()->start(p_preset->get_platform()->get_debug_protocol());
  222. emit_signal(SNAME("play_pressed"));
  223. editor_run.run_native_notify();
  224. }
  225. }
  226. void EditorRunBar::_profiler_autostart_indicator_pressed() {
  227. // Switch to the first profiler tab in the bottom panel.
  228. EditorNode::get_singleton()->get_bottom_panel()->make_item_visible(EditorDebuggerNode::get_singleton(), true);
  229. if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_profiler", false)) {
  230. EditorDebuggerNode::get_singleton()->get_current_debugger()->switch_to_debugger(3);
  231. } else if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_visual_profiler", false)) {
  232. EditorDebuggerNode::get_singleton()->get_current_debugger()->switch_to_debugger(4);
  233. } else {
  234. // Switch to the network profiler tab.
  235. EditorDebuggerNode::get_singleton()->get_current_debugger()->switch_to_debugger(8);
  236. }
  237. }
  238. void EditorRunBar::play_main_scene(bool p_from_native) {
  239. if (p_from_native) {
  240. run_native->resume_run_native();
  241. } else {
  242. stop_playing();
  243. current_mode = RunMode::RUN_MAIN;
  244. _run_scene();
  245. }
  246. }
  247. void EditorRunBar::play_current_scene(bool p_reload) {
  248. String last_current_scene = run_current_filename; // This is necessary to have a copy of the string.
  249. EditorNode::get_singleton()->save_default_environment();
  250. stop_playing();
  251. current_mode = RunMode::RUN_CURRENT;
  252. if (p_reload) {
  253. _run_scene(last_current_scene);
  254. } else {
  255. _run_scene();
  256. }
  257. }
  258. void EditorRunBar::play_custom_scene(const String &p_custom) {
  259. stop_playing();
  260. current_mode = RunMode::RUN_CUSTOM;
  261. _run_scene(p_custom);
  262. }
  263. void EditorRunBar::stop_playing() {
  264. if (editor_run.get_status() == EditorRun::STATUS_STOP) {
  265. return;
  266. }
  267. current_mode = RunMode::STOPPED;
  268. editor_run.stop();
  269. EditorDebuggerNode::get_singleton()->stop();
  270. run_custom_filename.clear();
  271. run_current_filename.clear();
  272. stop_button->set_pressed(false);
  273. stop_button->set_disabled(true);
  274. _reset_play_buttons();
  275. emit_signal(SNAME("stop_pressed"));
  276. }
  277. bool EditorRunBar::is_playing() const {
  278. EditorRun::Status status = editor_run.get_status();
  279. return (status == EditorRun::STATUS_PLAY || status == EditorRun::STATUS_PAUSED);
  280. }
  281. String EditorRunBar::get_playing_scene() const {
  282. String run_filename = editor_run.get_running_scene();
  283. if (run_filename.is_empty() && is_playing()) {
  284. run_filename = GLOBAL_GET("application/run/main_scene"); // Must be the main scene then.
  285. }
  286. return run_filename;
  287. }
  288. Error EditorRunBar::start_native_device(int p_device_id) {
  289. return run_native->start_run_native(p_device_id);
  290. }
  291. OS::ProcessID EditorRunBar::has_child_process(OS::ProcessID p_pid) const {
  292. return editor_run.has_child_process(p_pid);
  293. }
  294. void EditorRunBar::stop_child_process(OS::ProcessID p_pid) {
  295. if (!has_child_process(p_pid)) {
  296. return;
  297. }
  298. editor_run.stop_child_process(p_pid);
  299. if (!editor_run.get_child_process_count()) { // All children stopped. Closing.
  300. stop_playing();
  301. }
  302. }
  303. OS::ProcessID EditorRunBar::get_current_process() const {
  304. return editor_run.get_current_process();
  305. }
  306. void EditorRunBar::set_movie_maker_enabled(bool p_enabled) {
  307. write_movie_button->set_pressed(p_enabled);
  308. }
  309. bool EditorRunBar::is_movie_maker_enabled() const {
  310. return write_movie_button->is_pressed();
  311. }
  312. void EditorRunBar::update_profiler_autostart_indicator() {
  313. bool profiler_active = EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_profiler", false);
  314. bool visual_profiler_active = EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_visual_profiler", false);
  315. bool network_profiler_active = EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_network_profiler", false);
  316. bool any_profiler_active = profiler_active | visual_profiler_active | network_profiler_active;
  317. profiler_autostart_indicator->set_visible(any_profiler_active);
  318. if (any_profiler_active) {
  319. String tooltip = TTR("Autostart is enabled for the following profilers, which can have a performance impact:");
  320. if (profiler_active) {
  321. tooltip += "\n- " + TTR("Profiler");
  322. }
  323. if (visual_profiler_active) {
  324. tooltip += "\n- " + TTR("Visual Profiler");
  325. }
  326. if (network_profiler_active) {
  327. tooltip += "\n- " + TTR("Network Profiler");
  328. }
  329. tooltip += "\n\n" + TTR("Click to open the first profiler for which autostart is enabled.");
  330. profiler_autostart_indicator->set_tooltip_text(tooltip);
  331. }
  332. }
  333. HBoxContainer *EditorRunBar::get_buttons_container() {
  334. return main_hbox;
  335. }
  336. void EditorRunBar::_bind_methods() {
  337. ADD_SIGNAL(MethodInfo("play_pressed"));
  338. ADD_SIGNAL(MethodInfo("stop_pressed"));
  339. }
  340. EditorRunBar::EditorRunBar() {
  341. singleton = this;
  342. outer_hbox = memnew(HBoxContainer);
  343. add_child(outer_hbox);
  344. // Use a button for the indicator since it comes with a background panel and pixel perfect centering of an icon.
  345. profiler_autostart_indicator = memnew(Button);
  346. profiler_autostart_indicator->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER);
  347. profiler_autostart_indicator->set_focus_mode(FOCUS_NONE);
  348. profiler_autostart_indicator->set_theme_type_variation("ProfilerAutostartIndicator");
  349. profiler_autostart_indicator->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::_profiler_autostart_indicator_pressed));
  350. outer_hbox->add_child(profiler_autostart_indicator);
  351. update_profiler_autostart_indicator();
  352. main_panel = memnew(PanelContainer);
  353. outer_hbox->add_child(main_panel);
  354. main_hbox = memnew(HBoxContainer);
  355. main_panel->add_child(main_hbox);
  356. play_button = memnew(Button);
  357. main_hbox->add_child(play_button);
  358. play_button->set_theme_type_variation("RunBarButton");
  359. play_button->set_toggle_mode(true);
  360. play_button->set_focus_mode(Control::FOCUS_NONE);
  361. play_button->set_tooltip_text(TTRC("Run the project's default scene."));
  362. play_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::play_main_scene).bind(false));
  363. ED_SHORTCUT_AND_COMMAND("editor/run_project", TTRC("Run Project"), Key::F5);
  364. ED_SHORTCUT_OVERRIDE("editor/run_project", "macos", KeyModifierMask::META | Key::B);
  365. play_button->set_shortcut(ED_GET_SHORTCUT("editor/run_project"));
  366. pause_button = memnew(Button);
  367. main_hbox->add_child(pause_button);
  368. pause_button->set_theme_type_variation("RunBarButton");
  369. pause_button->set_toggle_mode(true);
  370. pause_button->set_focus_mode(Control::FOCUS_NONE);
  371. pause_button->set_tooltip_text(TTRC("Pause the running project's execution for debugging."));
  372. pause_button->set_disabled(true);
  373. ED_SHORTCUT("editor/pause_running_project", TTRC("Pause Running Project"), Key::F7);
  374. ED_SHORTCUT_OVERRIDE("editor/pause_running_project", "macos", KeyModifierMask::META | KeyModifierMask::CTRL | Key::Y);
  375. pause_button->set_shortcut(ED_GET_SHORTCUT("editor/pause_running_project"));
  376. stop_button = memnew(Button);
  377. main_hbox->add_child(stop_button);
  378. stop_button->set_theme_type_variation("RunBarButton");
  379. stop_button->set_focus_mode(Control::FOCUS_NONE);
  380. stop_button->set_tooltip_text(TTRC("Stop the currently running project."));
  381. stop_button->set_disabled(true);
  382. stop_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::stop_playing));
  383. ED_SHORTCUT("editor/stop_running_project", TTRC("Stop Running Project"), Key::F8);
  384. ED_SHORTCUT_OVERRIDE("editor/stop_running_project", "macos", KeyModifierMask::META | Key::PERIOD);
  385. stop_button->set_shortcut(ED_GET_SHORTCUT("editor/stop_running_project"));
  386. run_native = memnew(EditorRunNative);
  387. main_hbox->add_child(run_native);
  388. run_native->connect("native_run", callable_mp(this, &EditorRunBar::_run_native));
  389. play_scene_button = memnew(Button);
  390. main_hbox->add_child(play_scene_button);
  391. play_scene_button->set_theme_type_variation("RunBarButton");
  392. play_scene_button->set_toggle_mode(true);
  393. play_scene_button->set_focus_mode(Control::FOCUS_NONE);
  394. play_scene_button->set_tooltip_text(TTRC("Run the currently edited scene."));
  395. play_scene_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::_play_current_pressed));
  396. ED_SHORTCUT_AND_COMMAND("editor/run_current_scene", TTRC("Run Current Scene"), Key::F6);
  397. ED_SHORTCUT_OVERRIDE("editor/run_current_scene", "macos", KeyModifierMask::META | Key::R);
  398. play_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/run_current_scene"));
  399. play_custom_scene_button = memnew(Button);
  400. main_hbox->add_child(play_custom_scene_button);
  401. play_custom_scene_button->set_theme_type_variation("RunBarButton");
  402. play_custom_scene_button->set_toggle_mode(true);
  403. play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE);
  404. play_custom_scene_button->set_tooltip_text(TTRC("Run a specific scene."));
  405. play_custom_scene_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::_play_custom_pressed));
  406. ED_SHORTCUT_AND_COMMAND("editor/run_specific_scene", TTRC("Run Specific Scene"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F5);
  407. ED_SHORTCUT_OVERRIDE("editor/run_specific_scene", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::R);
  408. play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/run_specific_scene"));
  409. write_movie_panel = memnew(PanelContainer);
  410. main_hbox->add_child(write_movie_panel);
  411. write_movie_button = memnew(Button);
  412. write_movie_panel->add_child(write_movie_button);
  413. write_movie_button->set_theme_type_variation("RunBarButton");
  414. write_movie_button->set_toggle_mode(true);
  415. write_movie_button->set_pressed(false);
  416. write_movie_button->set_focus_mode(Control::FOCUS_NONE);
  417. write_movie_button->set_tooltip_text(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file."));
  418. write_movie_button->connect(SceneStringName(toggled), callable_mp(this, &EditorRunBar::_write_movie_toggled));
  419. }