diff --git a/modules/web/editor/web_node_editor.cpp b/modules/web/editor/web_node_editor.cpp index 8d374a5b3..f8b67a8d0 100644 --- a/modules/web/editor/web_node_editor.cpp +++ b/modules/web/editor/web_node_editor.cpp @@ -227,6 +227,8 @@ void WebNodeEditor::_notification(int p_what) { } WebNodeEditor::WebNodeEditor() { + _singleton = this; + _prettify_html = true; _web_server = memnew(WebNodeEditorWebServer); @@ -296,6 +298,7 @@ WebNodeEditor::WebNodeEditor() { } WebNodeEditor::~WebNodeEditor() { + _singleton = NULL; } void WebNodeEditor::_bind_methods() { @@ -313,3 +316,5 @@ void WebNodeEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_on_html_previewer_tool_button_toggled", "on"), &WebNodeEditor::_on_html_previewer_tool_button_toggled); ClassDB::bind_method(D_METHOD("_on_html_previewer_visibility_changed"), &WebNodeEditor::_on_html_previewer_visibility_changed); } + +WebNodeEditor* WebNodeEditor::_singleton = NULL; \ No newline at end of file diff --git a/modules/web/editor/web_node_editor.h b/modules/web/editor/web_node_editor.h index 823cc66dc..eed209c45 100644 --- a/modules/web/editor/web_node_editor.h +++ b/modules/web/editor/web_node_editor.h @@ -52,6 +52,8 @@ public: void refresh_html_preview(); void clear(); + static WebNodeEditor *get_singleton() { return _singleton; } + WebNodeEditor(); ~WebNodeEditor(); @@ -74,6 +76,9 @@ protected: VBoxContainer *_html_previewer; RichTextLabel *_result_info_label; TextEdit *_results_label; + +private: + static WebNodeEditor *_singleton; }; #endif