Skip to content

Commit 28d3f85

Browse files
committedFeb 26, 2020
Don't show a copy of the property's name in the inspector's tooltip if there's no description
1 parent 1e57b55 commit 28d3f85

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed
 

‎editor/connections_dialog.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ Control *ConnectionsDockTree::make_custom_tooltip(const String &p_text) const {
502502
String text = TTR("Signal:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]";
503503
text += p_text.get_slice("::", 1).strip_edges() + "\n";
504504
text += p_text.get_slice("::", 2).strip_edges();
505-
help_bit->set_text(text);
506505
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
507506
return help_bit;
508507
}

‎editor/editor_inspector.cpp

+28-8
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,20 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
778778
help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
779779
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
780780

781-
String text = TTR("Property:") + " [u][b]" + p_text.get_slice("::", 0) + "[/b][/u]\n";
782-
text += p_text.get_slice("::", 1).strip_edges();
783-
help_bit->set_text(text);
784-
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
781+
PackedStringArray slices = p_text.split("::", false);
782+
if (!slices.empty()) {
783+
String property_name = slices[0].strip_edges();
784+
String text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
785+
786+
if (slices.size() > 1) {
787+
String property_doc = slices[1].strip_edges();
788+
if (property_name != property_doc) {
789+
text += "\n" + property_doc;
790+
}
791+
}
792+
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
793+
}
794+
785795
return help_bit;
786796
}
787797

@@ -1005,10 +1015,20 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
10051015
help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
10061016
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
10071017

1008-
String text = "[u][b]" + p_text.get_slice("::", 0) + "[/b][/u]\n";
1009-
text += p_text.get_slice("::", 1).strip_edges();
1010-
help_bit->set_text(text);
1011-
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
1018+
PackedStringArray slices = p_text.split("::", false);
1019+
if (!slices.empty()) {
1020+
String property_name = slices[0].strip_edges();
1021+
String text = "[u][b]" + property_name + "[/b][/u]";
1022+
1023+
if (slices.size() > 1) {
1024+
String property_doc = slices[1].strip_edges();
1025+
if (property_name != property_doc) {
1026+
text += "\n" + property_doc;
1027+
}
1028+
}
1029+
help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
1030+
}
1031+
10121032
return help_bit;
10131033
}
10141034

0 commit comments

Comments
 (0)
Please sign in to comment.