diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mono/csharp_script.cpp | 4 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_builds.cpp | 4 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_builds.h | 2 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_editor.cpp | 61 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_editor.h | 23 | ||||
-rw-r--r-- | modules/mono/editor/mono_bottom_panel.cpp | 15 | ||||
-rw-r--r-- | modules/mono/editor/mono_bottom_panel.h | 2 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 2 |
8 files changed, 96 insertions, 17 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 2e1cdf8d01..3d91a6de6c 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -477,6 +477,7 @@ void CSharpLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft (void)p_script; // UNUSED #ifdef TOOLS_ENABLED + MonoReloadNode::get_singleton()->restart_reload_timer(); reload_assemblies_if_needed(p_soft_reload); #endif } @@ -624,6 +625,9 @@ void CSharpLanguage::reload_assemblies_if_needed(bool p_soft_reload) { //if instance states were saved, set them! } + + if (Engine::get_singleton()->is_editor_hint()) + EditorNode::get_singleton()->get_property_editor()->update_tree(); } #endif diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index c3b9c140e4..8ec19e1500 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -273,7 +273,7 @@ bool GodotSharpBuilds::make_api_sln(GodotSharpBuilds::APIType p_api_type) { return true; } -bool godotsharp_build_callback() { +bool GodotSharpBuilds::build_project_blocking() { if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path())) return true; // No solution to build @@ -352,7 +352,7 @@ GodotSharpBuilds::GodotSharpBuilds() { singleton = this; - EditorNode::get_singleton()->add_build_callback(&godotsharp_build_callback); + EditorNode::get_singleton()->add_build_callback(&GodotSharpBuilds::build_project_blocking); // Build tool settings EditorSettings *ed_settings = EditorSettings::get_singleton(); diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h index 3486f9f3e9..7d2f38a774 100644 --- a/modules/mono/editor/godotsharp_builds.h +++ b/modules/mono/editor/godotsharp_builds.h @@ -92,6 +92,8 @@ public: static bool make_api_sln(APIType p_api_type); + static bool build_project_blocking(); + GodotSharpBuilds(); ~GodotSharpBuilds(); }; diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp index ebfbdafeaf..39c57ee0be 100644 --- a/modules/mono/editor/godotsharp_editor.cpp +++ b/modules/mono/editor/godotsharp_editor.cpp @@ -46,21 +46,6 @@ #include "../utils/mono_reg_utils.h" #endif -class MonoReloadNode : public Node { - GDCLASS(MonoReloadNode, Node) - -protected: - void _notification(int p_what) { - switch (p_what) { - case MainLoop::NOTIFICATION_WM_FOCUS_IN: { - CSharpLanguage::get_singleton()->reload_assemblies_if_needed(true); - } break; - default: { - } break; - }; - } -}; - GodotSharpEditor *GodotSharpEditor::singleton = NULL; bool GodotSharpEditor::_create_project_solution() { @@ -258,3 +243,49 @@ GodotSharpEditor::~GodotSharpEditor() { monodevel_instance = NULL; } } + +MonoReloadNode *MonoReloadNode::singleton = NULL; + +void MonoReloadNode::_reload_timer_timeout() { + + CSharpLanguage::get_singleton()->reload_assemblies_if_needed(false); +} + +void MonoReloadNode::restart_reload_timer() { + + reload_timer->stop(); + reload_timer->start(); +} + +void MonoReloadNode::_bind_methods() { + + ClassDB::bind_method(D_METHOD("_reload_timer_timeout"), &MonoReloadNode::_reload_timer_timeout); +} + +void MonoReloadNode::_notification(int p_what) { + switch (p_what) { + case MainLoop::NOTIFICATION_WM_FOCUS_IN: { + restart_reload_timer(); + CSharpLanguage::get_singleton()->reload_assemblies_if_needed(true); + } break; + default: { + } break; + }; +} + +MonoReloadNode::MonoReloadNode() { + + singleton = this; + + reload_timer = memnew(Timer); + add_child(reload_timer); + reload_timer->set_one_shot(false); + reload_timer->set_wait_time(EDITOR_DEF("mono/assembly_watch_interval_sec", 0.5)); + reload_timer->connect("timeout", this, "_reload_timer_timeout"); + reload_timer->start(); +} + +MonoReloadNode::~MonoReloadNode() { + + singleton = NULL; +} diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h index 1ecb8c7a94..7b4b50b172 100644 --- a/modules/mono/editor/godotsharp_editor.h +++ b/modules/mono/editor/godotsharp_editor.h @@ -84,4 +84,27 @@ public: ~GodotSharpEditor(); }; +class MonoReloadNode : public Node { + GDCLASS(MonoReloadNode, Node) + + Timer *reload_timer; + + void _reload_timer_timeout(); + + static MonoReloadNode *singleton; + +protected: + static void _bind_methods(); + + void _notification(int p_what); + +public: + _FORCE_INLINE_ static MonoReloadNode *get_singleton() { return singleton; } + + void restart_reload_timer(); + + MonoReloadNode(); + ~MonoReloadNode(); +}; + #endif // GODOTSHARP_EDITOR_H diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index 8d6a618ee8..31dc09856a 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -139,6 +139,14 @@ void MonoBottomPanel::_errors_toggled(bool p_pressed) { build_tab->_update_issues_list(); } +void MonoBottomPanel::_build_project_pressed() { + + GodotSharpBuilds::get_singleton()->build_project_blocking(); + + MonoReloadNode::get_singleton()->restart_reload_timer(); + CSharpLanguage::get_singleton()->reload_assemblies_if_needed(true); +} + void MonoBottomPanel::_notification(int p_what) { switch (p_what) { @@ -153,6 +161,7 @@ void MonoBottomPanel::_notification(int p_what) { void MonoBottomPanel::_bind_methods() { + ClassDB::bind_method(D_METHOD("_build_project_pressed"), &MonoBottomPanel::_build_project_pressed); ClassDB::bind_method(D_METHOD("_warnings_toggled", "pressed"), &MonoBottomPanel::_warnings_toggled); ClassDB::bind_method(D_METHOD("_errors_toggled", "pressed"), &MonoBottomPanel::_errors_toggled); ClassDB::bind_method(D_METHOD("_build_tab_item_selected", "idx"), &MonoBottomPanel::_build_tab_item_selected); @@ -187,6 +196,12 @@ MonoBottomPanel::MonoBottomPanel(EditorNode *p_editor) { toolbar_hbc->set_h_size_flags(SIZE_EXPAND_FILL); panel_builds_tab->add_child(toolbar_hbc); + ToolButton *build_project_btn = memnew(ToolButton); + build_project_btn->set_text("Build Project"); + build_project_btn->set_focus_mode(FOCUS_NONE); + build_project_btn->connect("pressed", this, "_build_project_pressed"); + toolbar_hbc->add_child(build_project_btn); + toolbar_hbc->add_spacer(); warnings_btn = memnew(ToolButton); diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h index 83da5b9809..5cc4aa3240 100644 --- a/modules/mono/editor/mono_bottom_panel.h +++ b/modules/mono/editor/mono_bottom_panel.h @@ -61,6 +61,8 @@ class MonoBottomPanel : public VBoxContainer { void _warnings_toggled(bool p_pressed); void _errors_toggled(bool p_pressed); + void _build_project_pressed(); + static MonoBottomPanel *singleton; protected: diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 6d7cde95df..904a8ae2c7 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -625,6 +625,8 @@ GDMono::~GDMono() { if (gdmono_log) memdelete(gdmono_log); + + singleton = NULL; } _GodotSharp *_GodotSharp::singleton = NULL; |