2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
2023-04-12 21:02:28 +02:00
|
|
|
/* editor_run_bar.h */
|
2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
#ifndef EDITOR_RUN_BAR_H
|
|
|
|
#define EDITOR_RUN_BAR_H
|
2014-02-21 03:01:44 +01:00
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
#include "editor/editor_run.h"
|
|
|
|
#include "editor/export/editor_export.h"
|
|
|
|
#include "scene/gui/margin_container.h"
|
2022-02-14 14:00:03 +01:00
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
class Button;
|
|
|
|
class EditorRunNative;
|
|
|
|
class EditorQuickOpen;
|
|
|
|
class PanelContainer;
|
2023-06-25 02:30:07 +02:00
|
|
|
class HBoxContainer;
|
2022-02-14 14:00:03 +01:00
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
class EditorRunBar : public MarginContainer {
|
|
|
|
GDCLASS(EditorRunBar, MarginContainer);
|
2014-02-21 03:01:44 +01:00
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
static EditorRunBar *singleton;
|
|
|
|
|
|
|
|
enum RunMode {
|
|
|
|
STOPPED = 0,
|
|
|
|
RUN_MAIN,
|
|
|
|
RUN_CURRENT,
|
|
|
|
RUN_CUSTOM,
|
|
|
|
};
|
|
|
|
|
|
|
|
PanelContainer *main_panel = nullptr;
|
2023-06-25 02:30:07 +02:00
|
|
|
HBoxContainer *main_hbox = nullptr;
|
2023-04-12 21:02:28 +02:00
|
|
|
|
|
|
|
Button *play_button = nullptr;
|
|
|
|
Button *pause_button = nullptr;
|
|
|
|
Button *stop_button = nullptr;
|
|
|
|
Button *play_scene_button = nullptr;
|
|
|
|
Button *play_custom_scene_button = nullptr;
|
|
|
|
|
|
|
|
EditorRun editor_run;
|
|
|
|
EditorRunNative *run_native = nullptr;
|
|
|
|
|
|
|
|
PanelContainer *write_movie_panel = nullptr;
|
|
|
|
Button *write_movie_button = nullptr;
|
|
|
|
|
|
|
|
EditorQuickOpen *quick_run = nullptr;
|
|
|
|
|
|
|
|
RunMode current_mode = RunMode::STOPPED;
|
|
|
|
String run_custom_filename;
|
|
|
|
String run_current_filename;
|
|
|
|
|
|
|
|
void _reset_play_buttons();
|
|
|
|
void _update_play_buttons();
|
|
|
|
|
|
|
|
void _write_movie_toggled(bool p_enabled);
|
|
|
|
void _quick_run_selected();
|
|
|
|
|
|
|
|
void _play_current_pressed();
|
|
|
|
void _play_custom_pressed();
|
|
|
|
|
|
|
|
void _run_scene(const String &p_scene_path = "");
|
|
|
|
void _run_native(const Ref<EditorExportPreset> &p_preset);
|
2014-02-21 03:01:44 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
protected:
|
2023-04-12 21:02:28 +02:00
|
|
|
void _notification(int p_what);
|
2014-02-21 03:01:44 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2023-04-12 21:02:28 +02:00
|
|
|
static EditorRunBar *get_singleton() { return singleton; }
|
|
|
|
|
|
|
|
void play_main_scene(bool p_from_native = false);
|
|
|
|
void play_current_scene(bool p_reload = false);
|
|
|
|
void play_custom_scene(const String &p_custom);
|
|
|
|
|
|
|
|
void stop_playing();
|
|
|
|
bool is_playing() const;
|
|
|
|
String get_playing_scene() const;
|
|
|
|
|
|
|
|
Error start_native_device(int p_device_id);
|
|
|
|
|
|
|
|
OS::ProcessID has_child_process(OS::ProcessID p_pid) const;
|
|
|
|
void stop_child_process(OS::ProcessID p_pid);
|
|
|
|
|
|
|
|
void set_movie_maker_enabled(bool p_enabled);
|
|
|
|
bool is_movie_maker_enabled() const;
|
|
|
|
|
|
|
|
Button *get_pause_button() { return pause_button; }
|
2014-02-21 03:01:44 +01:00
|
|
|
|
2023-06-25 02:30:07 +02:00
|
|
|
HBoxContainer *get_buttons_container();
|
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
EditorRunBar();
|
2014-02-21 03:01:44 +01:00
|
|
|
};
|
|
|
|
|
2023-04-12 21:02:28 +02:00
|
|
|
#endif // EDITOR_RUN_BAR_H
|