diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-17 12:25:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 12:25:54 +0100 |
commit | 56e79052b7e1416f0146455b55c71f5677e50481 (patch) | |
tree | 9362557e6d1bc76d87d6d2304643e34e41df362a | |
parent | 3a2c0bf95227a2a63d5e37ced1f1a95ea60c8864 (diff) | |
parent | baba079f935857b8d7e4bf800726dc39d2957b35 (diff) |
Merge pull request #56842 from Chaosus/fix_assetlib_crash
-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; |