Also made it a singleton.

This commit is contained in:
Relintai 2022-08-23 15:23:34 +02:00
parent e6adf5aad5
commit f4b7a3b378
2 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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