diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-13 18:01:55 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-13 18:01:55 +0100 |
commit | 4c2dea108e7abcc79a0bff4a988bbffcf64a3153 (patch) | |
tree | 7b9eaa92b6e23c7a9a81e09309fc9e11d694fd70 /editor | |
parent | 787179dac82b970c0861290991826e8ea860b178 (diff) | |
parent | 60692b4e45649612bea131671b01d7739cb2c50b (diff) |
Merge pull request #70540 from vaartis/multiline-arrays-dictionaries
Implement export_multiline support for Array[String] and Dictionary
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties.cpp | 1 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 12 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.h | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 8ef394a59f..6c917a0c4f 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -4584,6 +4584,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ return editor; } else { EditorPropertyDictionary *editor = memnew(EditorPropertyDictionary); + editor->setup(p_hint); return editor; } } break; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index ed667aa7c8..069e80fc05 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -818,6 +818,10 @@ void EditorPropertyDictionary::_change_type_menu(int p_index) { update_property(); } +void EditorPropertyDictionary::setup(PropertyHint p_hint) { + property_hint = p_hint; +} + void EditorPropertyDictionary::update_property() { Variant updated_val = get_edited_object()->get(get_edited_property()); @@ -929,7 +933,13 @@ void EditorPropertyDictionary::update_property() { prop = editor; } break; case Variant::STRING: { - prop = memnew(EditorPropertyText); + if (i != amount && property_hint == PROPERTY_HINT_MULTILINE_TEXT) { + // If this is NOT the new key field and there's a multiline hint, + // show the field as multiline + prop = memnew(EditorPropertyMultilineText); + } else { + prop = memnew(EditorPropertyText); + } } break; diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index 96fc2dce24..73a16e3687 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -154,6 +154,7 @@ class EditorPropertyDictionary : public EditorProperty { EditorSpinSlider *size_sliderv = nullptr; Button *button_add_item = nullptr; EditorPaginator *paginator = nullptr; + PropertyHint property_hint; void _page_changed(int p_page); void _edit_pressed(); @@ -169,6 +170,7 @@ protected: void _notification(int p_what); public: + void setup(PropertyHint p_hint); virtual void update_property() override; EditorPropertyDictionary(); }; |