diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2022-01-16 19:40:14 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2022-01-16 21:18:20 +0300 |
commit | baba079f935857b8d7e4bf800726dc39d2957b35 (patch) | |
tree | e982ad20b65cad284f462347c35c960b74828f1a /editor | |
parent | 8958e1b35297baa8ef4f9e03bb4ad105500e3a0c (diff) |
Fix assetlib crash
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.h | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index e6ca8e2401..31ef13a2eb 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -398,10 +398,9 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse void EditorAssetLibraryItemDownload::_notification(int p_what) { switch (p_what) { - // FIXME: The editor crashes if 'NOTICATION_THEME_CHANGED' is used. case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TabContainer"))); + panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TabContainer"))); dismiss->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); } break; case NOTIFICATION_PROCESS: { @@ -494,8 +493,11 @@ void EditorAssetLibraryItemDownload::_bind_methods() { } EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { + panel = memnew(PanelContainer); + add_child(panel); + HBoxContainer *hb = memnew(HBoxContainer); - add_child(hb); + panel->add_child(hb); icon = memnew(TextureRect); hb->add_child(icon); @@ -543,16 +545,16 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { set_custom_minimum_size(Size2(310, 0) * EDSCALE); download = memnew(HTTPRequest); - add_child(download); + panel->add_child(download); download->connect("request_completed", callable_mp(this, &EditorAssetLibraryItemDownload::_http_download_completed)); setup_http_request(download); download_error = memnew(AcceptDialog); - add_child(download_error); + panel->add_child(download_error); download_error->set_title(TTR("Download Error")); asset_installer = memnew(EditorAssetInstaller); - add_child(asset_installer); + panel->add_child(asset_installer); asset_installer->connect("confirmed", callable_mp(this, &EditorAssetLibraryItemDownload::_close)); prev_status = -1; diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index d797608c24..8d6c0eb76e 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -126,9 +126,10 @@ public: EditorAssetLibraryItemDescription(); }; -class EditorAssetLibraryItemDownload : public PanelContainer { - GDCLASS(EditorAssetLibraryItemDownload, PanelContainer); +class EditorAssetLibraryItemDownload : public Control { + GDCLASS(EditorAssetLibraryItemDownload, Control); + PanelContainer *panel; TextureRect *icon; Label *title; ProgressBar *progress; |