| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/export/editor_export.h" |
| 34 |
#include "editor/run/editor_run.h" |
| 35 |
#include "scene/gui/margin_container.h" |
| 36 |
|
| 37 |
class Button; |
| 38 |
class EditorRunNative; |
| 39 |
class MenuButton; |
| 40 |
class PanelContainer; |
| 41 |
class HBoxContainer; |
| 42 |
class AcceptDialog; |
| 43 |
|
| 44 |
class EditorRunBar : public MarginContainer { |
| 45 |
GDCLASS(EditorRunBar, MarginContainer); |
| 46 |
|
| 47 |
static EditorRunBar *singleton; |
| 48 |
|
| 49 |
enum RunMode { |
| 50 |
STOPPED = 0, |
| 51 |
RUN_MAIN, |
| 52 |
RUN_CURRENT, |
| 53 |
RUN_CUSTOM, |
| 54 |
}; |
| 55 |
|
| 56 |
enum RunXRModeMenuItem { |
| 57 |
INVALID = -1, |
| 58 |
OFF = 0, |
| 59 |
ON = 1, |
| 60 |
}; |
| 61 |
|
| 62 |
PanelContainer *main_panel = nullptr; |
| 63 |
HBoxContainer *main_hbox = nullptr; |
| 64 |
HBoxContainer *outer_hbox = nullptr; |
| 65 |
|
| 66 |
Button *profiler_autostart_indicator = nullptr; |
| 67 |
|
| 68 |
PanelContainer *recovery_mode_panel = nullptr; |
| 69 |
Button *recovery_mode_button = nullptr; |
| 70 |
Button *recovery_mode_reload_button = nullptr; |
| 71 |
AcceptDialog *recovery_mode_popup = nullptr; |
| 72 |
|
| 73 |
Button *play_button = nullptr; |
| 74 |
Button *pause_button = nullptr; |
| 75 |
Button *stop_button = nullptr; |
| 76 |
Button *play_scene_button = nullptr; |
| 77 |
Button *play_custom_scene_button = nullptr; |
| 78 |
|
| 79 |
EditorRun editor_run; |
| 80 |
EditorRunNative *run_native = nullptr; |
| 81 |
|
| 82 |
enum MovieMakerMenuItem { |
| 83 |
MOVIE_MAKER_TOGGLE, |
| 84 |
MOVIE_MAKER_OPEN_SETTINGS, |
| 85 |
}; |
| 86 |
PanelContainer *write_movie_panel = nullptr; |
| 87 |
MenuButton *write_movie_button = nullptr; |
| 88 |
bool movie_maker_enabled = false; |
| 89 |
|
| 90 |
RunMode current_mode = RunMode::STOPPED; |
| 91 |
String run_custom_filename; |
| 92 |
String run_current_filename; |
| 93 |
|
| 94 |
void _reset_play_buttons(); |
| 95 |
void _update_play_buttons(); |
| 96 |
|
| 97 |
void _movie_maker_item_pressed(int p_id); |
| 98 |
void _write_movie_toggled(bool p_enabled); |
| 99 |
void _quick_run_selected(const String &p_file_path, int p_menu_item = RunXRModeMenuItem::INVALID); |
| 100 |
|
| 101 |
void _play_current_pressed(int p_menu_item = RunXRModeMenuItem::INVALID); |
| 102 |
void _play_custom_pressed(int p_menu_item = RunXRModeMenuItem::INVALID); |
| 103 |
|
| 104 |
void _run_scene(const String &p_scene_path = "", const Vector<String> &p_run_args = Vector<String>()); |
| 105 |
void _run_native(const Ref<EditorExportPreset> &p_preset); |
| 106 |
|
| 107 |
void _profiler_autostart_indicator_pressed(); |
| 108 |
|
| 109 |
private: |
| 110 |
static Vector<String> _get_xr_mode_play_args(RunXRModeMenuItem p_menu_item); |
| 111 |
|
| 112 |
protected: |
| 113 |
void _notification(int p_what); |
| 114 |
static void _bind_methods(); |
| 115 |
|
| 116 |
public: |
| 117 |
static EditorRunBar *get_singleton() { return singleton; } |
| 118 |
|
| 119 |
void recovery_mode_show_dialog(); |
| 120 |
void recovery_mode_reload_project(); |
| 121 |
|
| 122 |
void play_main_scene(bool p_from_native = false, const Vector<String> &p_play_args = Vector<String>()); |
| 123 |
void play_current_scene(bool p_reload = false, const Vector<String> &p_play_args = Vector<String>()); |
| 124 |
void play_custom_scene(const String &p_custom, const Vector<String> &p_play_args = Vector<String>()); |
| 125 |
|
| 126 |
void stop_playing(); |
| 127 |
bool is_playing() const; |
| 128 |
String get_playing_scene() const; |
| 129 |
|
| 130 |
Error start_native_device(int p_device_id) const; |
| 131 |
|
| 132 |
OS::ProcessID has_child_process(OS::ProcessID p_pid) const; |
| 133 |
void stop_child_process(OS::ProcessID p_pid); |
| 134 |
OS::ProcessID get_current_process() const; |
| 135 |
|
| 136 |
void set_movie_maker_enabled(bool p_enabled); |
| 137 |
bool is_movie_maker_enabled() const; |
| 138 |
|
| 139 |
void update_profiler_autostart_indicator(); |
| 140 |
|
| 141 |
Button *get_pause_button() { return pause_button; } |
| 142 |
|
| 143 |
HBoxContainer *get_buttons_container(); |
| 144 |
|
| 145 |
EditorRunBar(); |
| 146 |
}; |