Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/run/editor_run_bar.h
9896 views
1
/**************************************************************************/
2
/* editor_run_bar.h */
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
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
PanelContainer *main_panel = nullptr;
57
HBoxContainer *main_hbox = nullptr;
58
HBoxContainer *outer_hbox = nullptr;
59
60
Button *profiler_autostart_indicator = nullptr;
61
62
PanelContainer *recovery_mode_panel = nullptr;
63
Button *recovery_mode_button = nullptr;
64
Button *recovery_mode_reload_button = nullptr;
65
AcceptDialog *recovery_mode_popup = nullptr;
66
67
Button *play_button = nullptr;
68
Button *pause_button = nullptr;
69
Button *stop_button = nullptr;
70
Button *play_scene_button = nullptr;
71
Button *play_custom_scene_button = nullptr;
72
73
EditorRun editor_run;
74
EditorRunNative *run_native = nullptr;
75
76
enum MovieMakerMenuItem {
77
MOVIE_MAKER_TOGGLE,
78
MOVIE_MAKER_OPEN_SETTINGS,
79
};
80
PanelContainer *write_movie_panel = nullptr;
81
MenuButton *write_movie_button = nullptr;
82
bool movie_maker_enabled = false;
83
84
RunMode current_mode = RunMode::STOPPED;
85
String run_custom_filename;
86
String run_current_filename;
87
88
void _reset_play_buttons();
89
void _update_play_buttons();
90
91
void _movie_maker_item_pressed(int p_id);
92
void _write_movie_toggled(bool p_enabled);
93
void _quick_run_selected(const String &p_file_path, int p_id = -1);
94
95
void _play_current_pressed(int p_id = -1);
96
void _play_custom_pressed(int p_id = -1);
97
98
void _run_scene(const String &p_scene_path = "", const Vector<String> &p_run_args = Vector<String>());
99
void _run_native(const Ref<EditorExportPreset> &p_preset);
100
101
void _profiler_autostart_indicator_pressed();
102
103
private:
104
static Vector<String> _get_xr_mode_play_args(int p_xr_mode_id);
105
106
protected:
107
void _notification(int p_what);
108
static void _bind_methods();
109
110
public:
111
static EditorRunBar *get_singleton() { return singleton; }
112
113
void recovery_mode_show_dialog();
114
void recovery_mode_reload_project();
115
116
void play_main_scene(bool p_from_native = false);
117
void play_current_scene(bool p_reload = false, const Vector<String> &p_play_args = Vector<String>());
118
void play_custom_scene(const String &p_custom, const Vector<String> &p_play_args = Vector<String>());
119
120
void stop_playing();
121
bool is_playing() const;
122
String get_playing_scene() const;
123
124
Error start_native_device(int p_device_id);
125
126
OS::ProcessID has_child_process(OS::ProcessID p_pid) const;
127
void stop_child_process(OS::ProcessID p_pid);
128
OS::ProcessID get_current_process() const;
129
130
void set_movie_maker_enabled(bool p_enabled);
131
bool is_movie_maker_enabled() const;
132
133
void update_profiler_autostart_indicator();
134
135
Button *get_pause_button() { return pause_button; }
136
137
HBoxContainer *get_buttons_container();
138
139
EditorRunBar();
140
};
141
142