feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -35,7 +35,6 @@
|
|||
#include "core/string/translation_server.h"
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
#include "editor/debugger/script_editor_debugger.h"
|
||||
#include "editor/editor_command_palette.h"
|
||||
#include "editor/editor_feature_profile.h"
|
||||
#include "editor/editor_interface.h"
|
||||
#include "editor/editor_main_screen.h"
|
||||
|
|
@ -58,14 +57,30 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
|
|||
return;
|
||||
}
|
||||
|
||||
Array setup_data;
|
||||
Dictionary settings;
|
||||
settings["debugger/max_node_selection"] = EDITOR_GET("debugger/max_node_selection");
|
||||
settings["editors/panning/2d_editor_panning_scheme"] = EDITOR_GET("editors/panning/2d_editor_panning_scheme");
|
||||
settings["editors/panning/simple_panning"] = EDITOR_GET("editors/panning/simple_panning");
|
||||
settings["editors/panning/warped_mouse_panning"] = EDITOR_GET("editors/panning/warped_mouse_panning");
|
||||
settings["editors/panning/2d_editor_pan_speed"] = EDITOR_GET("editors/panning/2d_editor_pan_speed");
|
||||
settings["editors/polygon_editor/point_grab_radius"] = EDITOR_GET("editors/polygon_editor/point_grab_radius");
|
||||
settings["canvas_item_editor/pan_view"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_view"));
|
||||
settings["box_selection_fill_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_fill_color"), EditorStringName(Editor));
|
||||
settings["box_selection_stroke_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor));
|
||||
settings["editors/3d/default_fov"] = EDITOR_GET("editors/3d/default_fov");
|
||||
settings["editors/3d/default_z_near"] = EDITOR_GET("editors/3d/default_z_near");
|
||||
settings["editors/3d/default_z_far"] = EDITOR_GET("editors/3d/default_z_far");
|
||||
settings["editors/3d/navigation/invert_x_axis"] = EDITOR_GET("editors/3d/navigation/invert_x_axis");
|
||||
settings["editors/3d/navigation/invert_y_axis"] = EDITOR_GET("editors/3d/navigation/invert_y_axis");
|
||||
settings["editors/3d/navigation/warped_mouse_panning"] = EDITOR_GET("editors/3d/navigation/warped_mouse_panning");
|
||||
settings["editors/3d/freelook/freelook_base_speed"] = EDITOR_GET("editors/3d/freelook/freelook_base_speed");
|
||||
settings["editors/3d/freelook/freelook_sensitivity"] = EDITOR_GET("editors/3d/freelook/freelook_sensitivity");
|
||||
settings["editors/3d/navigation_feel/orbit_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/orbit_sensitivity");
|
||||
settings["editors/3d/navigation_feel/translation_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/translation_sensitivity");
|
||||
settings["editors/3d/selection_box_color"] = EDITOR_GET("editors/3d/selection_box_color");
|
||||
settings["editors/3d/freelook/freelook_base_speed"] = EDITOR_GET("editors/3d/freelook/freelook_base_speed");
|
||||
|
||||
Array setup_data;
|
||||
setup_data.append(settings);
|
||||
p_session->send_message("scene:runtime_node_select_setup", setup_data);
|
||||
|
||||
|
|
@ -78,6 +93,9 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
|
|||
Array mode;
|
||||
mode.append(select_mode);
|
||||
p_session->send_message("scene:runtime_node_select_set_mode", mode);
|
||||
Array mute_audio_data;
|
||||
mute_audio_data.append(mute_audio);
|
||||
p_session->send_message("scene:debug_mute_audio", mute_audio_data);
|
||||
|
||||
emit_signal(SNAME("session_started"));
|
||||
}
|
||||
|
|
@ -90,10 +108,6 @@ void GameViewDebugger::_session_stopped() {
|
|||
emit_signal(SNAME("session_stopped"));
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_is_feature_enabled(bool p_enabled) {
|
||||
is_feature_enabled = p_enabled;
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_suspend(bool p_enabled) {
|
||||
Array message;
|
||||
message.append(p_enabled);
|
||||
|
|
@ -152,6 +166,11 @@ void GameViewDebugger::set_select_mode(int p_mode) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_debug_mute_audio(bool p_enabled) {
|
||||
mute_audio = p_enabled;
|
||||
EditorDebuggerNode::get_singleton()->set_debug_mute_audio(p_enabled);
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_camera_override(bool p_enabled) {
|
||||
EditorDebuggerNode::get_singleton()->set_camera_override(p_enabled ? camera_override_mode : EditorDebuggerNode::OVERRIDE_NONE);
|
||||
}
|
||||
|
|
@ -190,11 +209,20 @@ void GameViewDebugger::setup_session(int p_session_id) {
|
|||
session->connect("stopped", callable_mp(this, &GameViewDebugger::_session_stopped));
|
||||
}
|
||||
|
||||
void GameViewDebugger::_feature_profile_changed() {
|
||||
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||
is_feature_enabled = profile.is_null() || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
|
||||
}
|
||||
|
||||
void GameViewDebugger::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("session_started"));
|
||||
ADD_SIGNAL(MethodInfo("session_stopped"));
|
||||
}
|
||||
|
||||
GameViewDebugger::GameViewDebugger() {
|
||||
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameViewDebugger::_feature_profile_changed));
|
||||
}
|
||||
|
||||
///////
|
||||
|
||||
void GameView::_sessions_changed() {
|
||||
|
|
@ -225,6 +253,7 @@ void GameView::_instance_starting(int p_idx, List<String> &r_arguments) {
|
|||
if (!is_feature_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_idx == 0 && embed_on_play && make_floating_on_play && window_wrapper->is_window_available() && !window_wrapper->get_window_enabled() && _get_embed_available() == EMBED_AVAILABLE) {
|
||||
// Set the Floating Window default title. Always considered in DEBUG mode, same as in Window::set_title.
|
||||
String appname = GLOBAL_GET("application/config/name");
|
||||
|
|
@ -337,6 +366,9 @@ void GameView::_stop_pressed() {
|
|||
void GameView::_embedding_completed() {
|
||||
_attach_script_debugger();
|
||||
_update_ui();
|
||||
if (make_floating_on_play) {
|
||||
get_window()->set_flag(Window::FLAG_ALWAYS_ON_TOP, bool(GLOBAL_GET("display/window/size/always_on_top")));
|
||||
}
|
||||
}
|
||||
|
||||
void GameView::_embedding_failed() {
|
||||
|
|
@ -406,11 +438,17 @@ void GameView::_node_type_pressed(int p_option) {
|
|||
|
||||
void GameView::_select_mode_pressed(int p_option) {
|
||||
RuntimeNodeSelect::SelectMode mode = (RuntimeNodeSelect::SelectMode)p_option;
|
||||
if (!select_mode_button[mode]->is_visible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < RuntimeNodeSelect::SELECT_MODE_MAX; i++) {
|
||||
select_mode_button[i]->set_pressed_no_signal(i == mode);
|
||||
}
|
||||
|
||||
debugger->set_select_mode(mode);
|
||||
|
||||
EditorSettings::get_singleton()->set_project_metadata("game_view", "select_mode", mode);
|
||||
}
|
||||
|
||||
void GameView::_embed_options_menu_menu_id_pressed(int p_id) {
|
||||
|
|
@ -506,13 +544,13 @@ void GameView::_update_ui() {
|
|||
state_label->set_text(vformat(TTR("Game embedding not available for the Display Server: '%s'.\nDisplay Server can be modified in the Project Settings (Display > Display Server > Driver)."), GLOBAL_GET("display/display_server/driver")));
|
||||
break;
|
||||
case EMBED_NOT_AVAILABLE_MINIMIZED:
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts minimized.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts minimized.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
break;
|
||||
case EMBED_NOT_AVAILABLE_MAXIMIZED:
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts maximized.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts maximized.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
break;
|
||||
case EMBED_NOT_AVAILABLE_FULLSCREEN:
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts in fullscreen.\nConsider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
state_label->set_text(TTR("Game embedding not available when the game starts in fullscreen.") + "\n" + TTR("Consider overriding the window mode project setting with the editor feature tag to Windowed to use game embedding while leaving the exported project intact."));
|
||||
break;
|
||||
case EMBED_NOT_AVAILABLE_SINGLE_WINDOW_MODE:
|
||||
state_label->set_text(TTR("Game embedding not available in single window mode."));
|
||||
|
|
@ -570,6 +608,15 @@ void GameView::_hide_selection_toggled(bool p_pressed) {
|
|||
hide_selection->set_button_icon(get_editor_theme_icon(p_pressed ? SNAME("GuiVisibilityHidden") : SNAME("GuiVisibilityVisible")));
|
||||
|
||||
debugger->set_selection_visible(!p_pressed);
|
||||
|
||||
EditorSettings::get_singleton()->set_project_metadata("game_view", "hide_selection", p_pressed);
|
||||
}
|
||||
|
||||
void GameView::_debug_mute_audio_button_pressed() {
|
||||
debug_mute_audio = !debug_mute_audio;
|
||||
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
|
||||
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
|
||||
debugger->set_debug_mute_audio(debug_mute_audio);
|
||||
}
|
||||
|
||||
void GameView::_camera_override_button_toggled(bool p_pressed) {
|
||||
|
|
@ -598,12 +645,16 @@ void GameView::_camera_override_menu_id_pressed(int p_id) {
|
|||
menu->set_item_checked(menu->get_item_index(p_id), true);
|
||||
|
||||
_update_debugger_buttons();
|
||||
|
||||
EditorSettings::get_singleton()->set_project_metadata("game_view", "camera_override_mode", p_id);
|
||||
} break;
|
||||
case CAMERA_MODE_EDITORS: {
|
||||
debugger->set_camera_manipulate_mode(EditorDebuggerNode::OVERRIDE_EDITORS);
|
||||
menu->set_item_checked(menu->get_item_index(p_id), true);
|
||||
|
||||
_update_debugger_buttons();
|
||||
|
||||
EditorSettings::get_singleton()->set_project_metadata("game_view", "camera_override_mode", p_id);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -616,9 +667,7 @@ void GameView::_notification(int p_what) {
|
|||
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_NONE]->set_button_icon(get_editor_theme_icon(SNAME("InputEventJoypadMotion")));
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->set_button_icon(get_editor_theme_icon(SNAME("2DNodes")));
|
||||
#ifndef _3D_DISABLED
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_button_icon(get_editor_theme_icon(SNAME("Node3D")));
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
select_mode_button[RuntimeNodeSelect::SELECT_MODE_SINGLE]->set_button_icon(get_editor_theme_icon(SNAME("ToolSelect")));
|
||||
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->set_button_icon(get_editor_theme_icon(SNAME("ListSelect")));
|
||||
|
|
@ -629,6 +678,8 @@ void GameView::_notification(int p_what) {
|
|||
stretch_button->set_button_icon(get_editor_theme_icon(SNAME("Stretch")));
|
||||
embed_options_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
|
||||
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
|
||||
|
||||
camera_override_button->set_button_icon(get_editor_theme_icon(SNAME("Camera")));
|
||||
camera_override_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
} break;
|
||||
|
|
@ -685,45 +736,6 @@ void GameView::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameView::set_is_feature_enabled(bool p_enabled) {
|
||||
is_feature_enabled = p_enabled;
|
||||
}
|
||||
|
||||
void GameView::set_state(const Dictionary &p_state) {
|
||||
if (p_state.has("hide_selection")) {
|
||||
hide_selection->set_pressed(p_state["hide_selection"]);
|
||||
_hide_selection_toggled(hide_selection->is_pressed());
|
||||
}
|
||||
if (p_state.has("select_mode")) {
|
||||
_select_mode_pressed(p_state["select_mode"]);
|
||||
}
|
||||
if (p_state.has("camera_override_mode")) {
|
||||
_camera_override_menu_id_pressed(p_state["camera_override_mode"]);
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary GameView::get_state() const {
|
||||
Dictionary d;
|
||||
d["hide_selection"] = hide_selection->is_pressed();
|
||||
|
||||
for (int i = 0; i < RuntimeNodeSelect::SELECT_MODE_MAX; i++) {
|
||||
if (select_mode_button[i]->is_pressed()) {
|
||||
d["select_mode"] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PopupMenu *menu = camera_override_menu->get_popup();
|
||||
for (int i = CAMERA_MODE_INGAME; i < CAMERA_MODE_EDITORS + 1; i++) {
|
||||
if (menu->is_item_checked(menu->get_item_index(i))) {
|
||||
d["camera_override_mode"] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void GameView::set_window_layout(Ref<ConfigFile> p_layout) {
|
||||
floating_window_rect = p_layout->get_value("GameView", "floating_window_rect", Rect2i());
|
||||
floating_window_screen = p_layout->get_value("GameView", "floating_window_screen", -1);
|
||||
|
|
@ -881,6 +893,19 @@ void GameView::_debugger_breaked(bool p_breaked, bool p_can_debug) {
|
|||
_update_embed_window_size();
|
||||
}
|
||||
|
||||
void GameView::_feature_profile_changed() {
|
||||
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||
bool is_profile_null = profile.is_null();
|
||||
|
||||
is_feature_enabled = is_profile_null || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
|
||||
|
||||
bool is_3d_enabled = is_profile_null || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D);
|
||||
if (!is_3d_enabled && node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->is_pressed()) {
|
||||
_node_type_pressed(RuntimeNodeSelect::NODE_TYPE_NONE);
|
||||
}
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_visible(is_3d_enabled);
|
||||
}
|
||||
|
||||
GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
||||
singleton = this;
|
||||
|
||||
|
|
@ -904,12 +929,14 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
suspend_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
suspend_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_suspend_button_toggled));
|
||||
suspend_button->set_tooltip_text(TTR("Suspend"));
|
||||
suspend_button->set_accessibility_name(TTRC("Suspend"));
|
||||
|
||||
next_frame_button = memnew(Button);
|
||||
main_menu_hbox->add_child(next_frame_button);
|
||||
next_frame_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
next_frame_button->connect(SceneStringName(pressed), callable_mp(*debugger, &GameViewDebugger::next_frame));
|
||||
next_frame_button->set_tooltip_text(TTR("Next Frame"));
|
||||
next_frame_button->set_accessibility_name(TTRC("Next Frame"));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
@ -930,7 +957,6 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_node_type_pressed).bind(RuntimeNodeSelect::NODE_TYPE_2D));
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_2D]->set_tooltip_text(TTR("Disable game input and allow to select Node2Ds, Controls, and manipulate the 2D camera."));
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D] = memnew(Button);
|
||||
main_menu_hbox->add_child(node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]);
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_text(TTR("3D"));
|
||||
|
|
@ -938,7 +964,6 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_node_type_pressed).bind(RuntimeNodeSelect::NODE_TYPE_3D));
|
||||
node_type_button[RuntimeNodeSelect::NODE_TYPE_3D]->set_tooltip_text(TTR("Disable game input and allow to select Node3Ds and manipulate the 3D camera."));
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
@ -948,6 +973,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
hide_selection->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
hide_selection->connect(SceneStringName(toggled), callable_mp(this, &GameView::_hide_selection_toggled));
|
||||
hide_selection->set_tooltip_text(TTR("Toggle Selection Visibility"));
|
||||
hide_selection->set_accessibility_name(TTRC("Selection Visibility"));
|
||||
hide_selection->set_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "hide_selection", false));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
@ -968,14 +995,25 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->connect(SceneStringName(pressed), callable_mp(this, &GameView::_select_mode_pressed).bind(RuntimeNodeSelect::SELECT_MODE_LIST));
|
||||
select_mode_button[RuntimeNodeSelect::SELECT_MODE_LIST]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked."));
|
||||
|
||||
_select_mode_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "select_mode", 0));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
debug_mute_audio_button = memnew(Button);
|
||||
main_menu_hbox->add_child(debug_mute_audio_button);
|
||||
debug_mute_audio_button->set_theme_type_variation("FlatButton");
|
||||
debug_mute_audio_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_debug_mute_audio_button_pressed));
|
||||
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
camera_override_button = memnew(Button);
|
||||
main_menu_hbox->add_child(camera_override_button);
|
||||
camera_override_button->set_toggle_mode(true);
|
||||
camera_override_button->set_theme_type_variation(SceneStringName(FlatButton));
|
||||
camera_override_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_camera_override_button_toggled));
|
||||
camera_override_button->set_tooltip_text(TTR("Override the in-game camera."));
|
||||
camera_override_button->set_accessibility_name(TTRC("Override In-game Camera"));
|
||||
camera_override_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_camera_override_button_toggled));
|
||||
|
||||
camera_override_menu = memnew(MenuButton);
|
||||
main_menu_hbox->add_child(camera_override_menu);
|
||||
|
|
@ -983,6 +1021,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
camera_override_menu->set_theme_type_variation("FlatMenuButton");
|
||||
camera_override_menu->set_h_size_flags(SIZE_SHRINK_END);
|
||||
camera_override_menu->set_tooltip_text(TTR("Camera Override Options"));
|
||||
camera_override_menu->set_accessibility_name(TTRC("Camera Override Options"));
|
||||
_camera_override_menu_id_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "camera_override_mode", 0));
|
||||
|
||||
PopupMenu *menu = camera_override_menu->get_popup();
|
||||
menu->connect(SceneStringName(id_pressed), callable_mp(this, &GameView::_camera_override_menu_id_pressed));
|
||||
|
|
@ -1001,6 +1041,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
fixed_size_button->set_toggle_mode(true);
|
||||
fixed_size_button->set_theme_type_variation("FlatButton");
|
||||
fixed_size_button->set_tooltip_text(TTR("Embedded game size is based on project settings.\nThe 'Keep Aspect' mode is used when the Game Workspace is smaller than the desired size."));
|
||||
fixed_size_button->set_accessibility_name(TTRC("Fixed Size"));
|
||||
fixed_size_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_FIXED));
|
||||
|
||||
keep_aspect_button = memnew(Button);
|
||||
|
|
@ -1008,6 +1049,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
keep_aspect_button->set_toggle_mode(true);
|
||||
keep_aspect_button->set_theme_type_variation("FlatButton");
|
||||
keep_aspect_button->set_tooltip_text(TTR("Keep the aspect ratio of the embedded game."));
|
||||
keep_aspect_button->set_accessibility_name(TTRC("Keep Aspect Ratio"));
|
||||
keep_aspect_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_KEEP_ASPECT));
|
||||
|
||||
stretch_button = memnew(Button);
|
||||
|
|
@ -1015,6 +1057,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
stretch_button->set_toggle_mode(true);
|
||||
stretch_button->set_theme_type_variation("FlatButton");
|
||||
stretch_button->set_tooltip_text(TTR("Embedded game size stretches to fit the Game Workspace."));
|
||||
stretch_button->set_accessibility_name(TTRC("Stretch"));
|
||||
stretch_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_STRETCH));
|
||||
|
||||
embed_options_menu = memnew(MenuButton);
|
||||
|
|
@ -1023,6 +1066,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
embed_options_menu->set_theme_type_variation("FlatMenuButton");
|
||||
embed_options_menu->set_h_size_flags(SIZE_SHRINK_END);
|
||||
embed_options_menu->set_tooltip_text(TTR("Embedding Options"));
|
||||
embed_options_menu->set_accessibility_name(TTRC("Embedding Options"));
|
||||
|
||||
menu = embed_options_menu->get_popup();
|
||||
menu->connect(SceneStringName(id_pressed), callable_mp(this, &GameView::_embed_options_menu_menu_id_pressed));
|
||||
|
|
@ -1077,6 +1121,8 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
|||
p_wrapper->connect("window_size_changed", callable_mp(this, &GameView::_update_floating_window_settings));
|
||||
|
||||
EditorDebuggerNode::get_singleton()->connect("breaked", callable_mp(this, &GameView::_debugger_breaked));
|
||||
|
||||
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameView::_feature_profile_changed));
|
||||
}
|
||||
|
||||
///////
|
||||
|
|
@ -1087,7 +1133,7 @@ void GameViewPlugin::selected_notify() {
|
|||
notify_main_screen_changed(get_plugin_name());
|
||||
#else
|
||||
window_wrapper->grab_window_focus();
|
||||
#endif
|
||||
#endif // ANDROID_ENABLED
|
||||
_focus_another_editor();
|
||||
}
|
||||
}
|
||||
|
|
@ -1108,19 +1154,7 @@ void GameViewPlugin::set_window_layout(Ref<ConfigFile> p_layout) {
|
|||
void GameViewPlugin::get_window_layout(Ref<ConfigFile> p_layout) {
|
||||
game_view->get_window_layout(p_layout);
|
||||
}
|
||||
|
||||
void GameViewPlugin::set_state(const Dictionary &p_state) {
|
||||
game_view->set_state(p_state);
|
||||
}
|
||||
|
||||
Dictionary GameViewPlugin::get_state() const {
|
||||
return game_view->get_state();
|
||||
}
|
||||
|
||||
void GameViewPlugin::_window_visibility_changed(bool p_visible) {
|
||||
_focus_another_editor();
|
||||
}
|
||||
#endif
|
||||
#endif // ANDROID_ENABLED
|
||||
|
||||
void GameViewPlugin::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
|
|
@ -1135,24 +1169,6 @@ void GameViewPlugin::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameViewPlugin::_feature_profile_changed() {
|
||||
bool is_feature_enabled = true;
|
||||
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||
if (profile.is_valid()) {
|
||||
is_feature_enabled = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME);
|
||||
}
|
||||
|
||||
if (debugger.is_valid()) {
|
||||
debugger->set_is_feature_enabled(is_feature_enabled);
|
||||
}
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
if (game_view) {
|
||||
game_view->set_is_feature_enabled(is_feature_enabled);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GameViewPlugin::_save_last_editor(const String &p_editor) {
|
||||
if (p_editor != get_plugin_name()) {
|
||||
last_editor = p_editor;
|
||||
|
|
@ -1174,7 +1190,7 @@ bool GameViewPlugin::_is_window_wrapper_enabled() const {
|
|||
return true;
|
||||
#else
|
||||
return window_wrapper->get_window_enabled();
|
||||
#endif
|
||||
#endif // ANDROID_ENABLED
|
||||
}
|
||||
|
||||
GameViewPlugin::GameViewPlugin() {
|
||||
|
|
@ -1193,11 +1209,6 @@ GameViewPlugin::GameViewPlugin() {
|
|||
EditorNode::get_singleton()->get_editor_main_screen()->get_control()->add_child(window_wrapper);
|
||||
window_wrapper->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
window_wrapper->hide();
|
||||
window_wrapper->connect("window_visibility_changed", callable_mp(this, &GameViewPlugin::_window_visibility_changed));
|
||||
#endif
|
||||
|
||||
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &GameViewPlugin::_feature_profile_changed));
|
||||
}
|
||||
|
||||
GameViewPlugin::~GameViewPlugin() {
|
||||
window_wrapper->connect("window_visibility_changed", callable_mp(this, &GameViewPlugin::_focus_another_editor).unbind(1));
|
||||
#endif // ANDROID_ENABLED
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue