Skip to content

Commit

Permalink
Add indicator for StringName properties
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed May 26, 2023
1 parent d984ad6 commit 54be252
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ void EditorPropertyText::update_property() {

void EditorPropertyText::set_string_name(bool p_enabled) {
string_name = p_enabled;
if (p_enabled) {
Label *prefix = memnew(Label("&"));
prefix->set_tooltip_text("StringName");
prefix->set_mouse_filter(MOUSE_FILTER_STOP);
text->get_parent()->add_child(prefix);
text->get_parent()->move_child(prefix, 0);
}
}

void EditorPropertyText::set_secret(bool p_enabled) {
Expand All @@ -122,9 +129,13 @@ void EditorPropertyText::_bind_methods() {
}

EditorPropertyText::EditorPropertyText() {
HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb);

text = memnew(LineEdit);
add_child(text);
hb->add_child(text);
add_focusable(text);
text->set_h_size_flags(SIZE_EXPAND_FILL);
text->connect("text_changed", callable_mp(this, &EditorPropertyText::_text_changed));
text->connect("text_submitted", callable_mp(this, &EditorPropertyText::_text_submitted));
}
Expand Down

0 comments on commit 54be252

Please sign in to comment.