3434#include " core/debugger/debugger_marshalls.h"
3535#include " editor/debugger/editor_debugger_node.h"
3636#include " editor/editor_command_palette.h"
37+ #include " editor/editor_feature_profile.h"
3738#include " editor/editor_interface.h"
3839#include " editor/editor_main_screen.h"
3940#include " editor/editor_node.h"
4950#include " scene/gui/separator.h"
5051
5152void GameViewDebugger::_session_started (Ref<EditorDebuggerSession> p_session) {
53+ if (!is_feature_enabled) {
54+ return ;
55+ }
56+
5257 Array setup_data;
5358 Dictionary settings;
5459 settings[" editors/panning/2d_editor_panning_scheme" ] = EDITOR_GET (" editors/panning/2d_editor_panning_scheme" );
@@ -73,9 +78,17 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
7378}
7479
7580void GameViewDebugger::_session_stopped () {
81+ if (!is_feature_enabled) {
82+ return ;
83+ }
84+
7685 emit_signal (SNAME (" session_stopped" ));
7786}
7887
88+ void GameViewDebugger::set_is_feature_enabled (bool p_enabled) {
89+ is_feature_enabled = p_enabled;
90+ }
91+
7992void GameViewDebugger::set_suspend (bool p_enabled) {
8093 Array message;
8194 message.append (p_enabled);
@@ -198,6 +211,9 @@ void GameView::_instance_starting_static(int p_idx, List<String> &r_arguments) {
198211}
199212
200213void GameView::_instance_starting (int p_idx, List<String> &r_arguments) {
214+ if (!is_feature_enabled) {
215+ return ;
216+ }
201217 if (p_idx == 0 && embed_on_play && make_floating_on_play && !window_wrapper->get_window_enabled () && EditorNode::get_singleton ()->is_multi_window_enabled ()) {
202218 window_wrapper->restore_window_from_saved_position (floating_window_rect, floating_window_screen, floating_window_screen_rect);
203219 }
@@ -206,6 +222,10 @@ void GameView::_instance_starting(int p_idx, List<String> &r_arguments) {
206222}
207223
208224void GameView::_play_pressed () {
225+ if (!is_feature_enabled) {
226+ return ;
227+ }
228+
209229 OS::ProcessID current_process_id = EditorRunBar::get_singleton ()->get_current_process ();
210230 if (current_process_id == 0 ) {
211231 return ;
@@ -231,6 +251,10 @@ void GameView::_play_pressed() {
231251}
232252
233253void GameView::_stop_pressed () {
254+ if (!is_feature_enabled) {
255+ return ;
256+ }
257+
234258 EditorNode::get_singleton ()->set_unfocused_low_processor_usage_mode_enabled (true );
235259 embedded_process->reset ();
236260 _update_ui ();
@@ -476,6 +500,10 @@ void GameView::_notification(int p_what) {
476500 }
477501}
478502
503+ void GameView::set_is_feature_enabled (bool p_enabled) {
504+ is_feature_enabled = p_enabled;
505+ }
506+
479507void GameView::set_state (const Dictionary &p_state) {
480508 if (p_state.has (" hide_selection" )) {
481509 hide_selection->set_pressed (p_state[" hide_selection" ]);
@@ -801,6 +829,22 @@ void GameViewPlugin::_notification(int p_what) {
801829 }
802830}
803831
832+ void GameViewPlugin::_feature_profile_changed () {
833+ bool is_feature_enabled = true ;
834+ Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton ()->get_current_profile ();
835+ if (profile.is_valid ()) {
836+ is_feature_enabled = !profile->is_feature_disabled (EditorFeatureProfile::FEATURE_GAME);
837+ }
838+
839+ if (debugger.is_valid ()) {
840+ debugger->set_is_feature_enabled (is_feature_enabled);
841+ }
842+
843+ if (game_view) {
844+ game_view->set_is_feature_enabled (is_feature_enabled);
845+ }
846+ }
847+
804848void GameViewPlugin::_window_visibility_changed (bool p_visible) {
805849 _focus_another_editor ();
806850}
@@ -834,6 +878,8 @@ GameViewPlugin::GameViewPlugin() {
834878 window_wrapper->set_v_size_flags (Control::SIZE_EXPAND_FILL);
835879 window_wrapper->hide ();
836880 window_wrapper->connect (" window_visibility_changed" , callable_mp (this , &GameViewPlugin::_window_visibility_changed));
881+
882+ EditorFeatureProfileManager::get_singleton ()->connect (" current_feature_profile_changed" , callable_mp (this , &GameViewPlugin::_feature_profile_changed));
837883}
838884
839885GameViewPlugin::~GameViewPlugin () {
0 commit comments