diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 94077157498..415193c6d54 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3923,6 +3923,12 @@ void EditorInspector::_notification(int p_what) { } } break; + case NOTIFICATION_THEME_CHANGED: { + if (add_meta_error_panel) { + add_meta_error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree"))); + } + } break; + case NOTIFICATION_PREDELETE: { edit(nullptr); //just in case } break; @@ -4103,13 +4109,16 @@ void EditorInspector::_show_add_meta_dialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_meta_dialog->add_child(vbc); + HBoxContainer *hbc = memnew(HBoxContainer); vbc->add_child(hbc); hbc->add_child(memnew(Label(TTR("Name:")))); + add_meta_name = memnew(LineEdit); add_meta_name->set_custom_minimum_size(Size2(200 * EDSCALE, 1)); hbc->add_child(add_meta_name); hbc->add_child(memnew(Label(TTR("Type:")))); + add_meta_type = memnew(OptionButton); for (int i = 0; i < Variant::VARIANT_MAX; i++) { if (i == Variant::NIL || i == Variant::RID || i == Variant::CALLABLE || i == Variant::SIGNAL) { @@ -4120,12 +4129,24 @@ void EditorInspector::_show_add_meta_dialog() { add_meta_type->add_icon_item(get_theme_icon(type, "EditorIcons"), type, i); } hbc->add_child(add_meta_type); + + Control *spacing = memnew(Control); + vbc->add_child(spacing); + spacing->set_custom_minimum_size(Size2(0, 10 * EDSCALE)); + add_meta_dialog->set_ok_button_text(TTR("Add")); add_child(add_meta_dialog); add_meta_dialog->register_text_enter(add_meta_name); add_meta_dialog->connect("confirmed", callable_mp(this, &EditorInspector::_add_meta_confirm)); + + add_meta_error_panel = memnew(PanelContainer); + vbc->add_child(add_meta_error_panel); + if (is_inside_tree()) { + add_meta_error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree"))); + } + add_meta_error = memnew(Label); - vbc->add_child(add_meta_error); + add_meta_error_panel->add_child(add_meta_error); add_meta_name->connect("text_changed", callable_mp(this, &EditorInspector::_check_meta_name)); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index d6a7f1df19e..191f28fe46f 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -540,6 +540,7 @@ class EditorInspector : public ScrollContainer { ConfirmationDialog *add_meta_dialog = nullptr; LineEdit *add_meta_name = nullptr; OptionButton *add_meta_type = nullptr; + PanelContainer *add_meta_error_panel = nullptr; Label *add_meta_error = nullptr; void _add_meta_confirm();