Remove Inspector tooltip hack that never actually worked

This commit is contained in:
Yuri Sizov 2022-08-26 16:43:24 +03:00
parent ff612b6916
commit 207bdc2b9f
4 changed files with 1 additions and 39 deletions

View File

@ -44,12 +44,6 @@
Gets the edited property. If your editor is for a single property (added via [method EditorInspectorPlugin._parse_property]), then this will return the property.
</description>
</method>
<method name="get_tooltip_text" qualifiers="const">
<return type="String" />
<description>
Must be implemented to provide a custom tooltip to the property editor.
</description>
</method>
<method name="set_bottom_editor">
<return type="void" />
<param index="0" name="editor" type="Control" />

View File

@ -896,14 +896,9 @@ static Control *make_help_bit(const String &p_text, bool p_property) {
}
Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
tooltip_text = p_text;
return make_help_bit(p_text, true);
}
String EditorProperty::get_tooltip_text() const {
return tooltip_text;
}
void EditorProperty::menu_option(int p_option) {
switch (p_option) {
case MENU_COPY_PROPERTY: {
@ -951,7 +946,6 @@ void EditorProperty::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_edited_property"), &EditorProperty::get_edited_property);
ClassDB::bind_method(D_METHOD("get_edited_object"), &EditorProperty::get_edited_object);
ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text);
ClassDB::bind_method(D_METHOD("update_property"), &EditorProperty::update_property);
ClassDB::bind_method(D_METHOD("add_focusable", "control"), &EditorProperty::add_focusable);
@ -1129,7 +1123,6 @@ void EditorInspectorCategory::_notification(int p_what) {
}
Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) const {
tooltip_text = p_text;
return make_help_bit(p_text, false);
}
@ -1148,14 +1141,6 @@ Size2 EditorInspectorCategory::get_minimum_size() const {
return ms;
}
void EditorInspectorCategory::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorInspectorCategory::get_tooltip_text);
}
String EditorInspectorCategory::get_tooltip_text() const {
return tooltip_text;
}
EditorInspectorCategory::EditorInspectorCategory() {
}

View File

@ -117,8 +117,6 @@ private:
Control *bottom_editor = nullptr;
PopupMenu *menu = nullptr;
mutable String tooltip_text;
HashMap<StringName, Variant> cache;
GDVIRTUAL0(_update_property)
@ -199,8 +197,6 @@ public:
void set_object_and_property(Object *p_object, const StringName &p_property);
virtual Control *make_custom_tooltip(const String &p_text) const override;
String get_tooltip_text() const;
void set_draw_top_bg(bool p_draw) { draw_top_bg = p_draw; }
bool can_revert_to_default() const { return can_revert; }
@ -254,18 +250,13 @@ class EditorInspectorCategory : public Control {
Ref<Texture2D> icon;
String label;
mutable String tooltip_text;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
virtual Size2 get_minimum_size() const override;
virtual Control *make_custom_tooltip(const String &p_text) const override;
String get_tooltip_text() const;
EditorInspectorCategory();
};

View File

@ -1708,17 +1708,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (tooltip == gui.tooltip_label->get_text()) {
is_tooltip_shown = true;
}
} else {
Variant t = gui.tooltip_popup->call("get_tooltip_text");
if (t.get_type() == Variant::STRING) {
if (tooltip == String(t)) {
is_tooltip_shown = true;
}
} else {
is_tooltip_shown = true; // Nothing to compare against, likely using custom control, so if it changes there is nothing we can do.
}
}
} else {
_gui_cancel_tooltip();
}