diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-05-13 22:34:34 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-06-15 08:30:48 +0200 |
commit | 8352122e70ec2a582af9a713791eabbbcb935c10 (patch) | |
tree | 87676ef5586fa432b20d677bd26e7f321dd0be8d /editor/import_dock.cpp | |
parent | 33957aee69683cf1f542a8622e5a9efd23070f1c (diff) | |
download | redot-engine-8352122e70ec2a582af9a713791eabbbcb935c10.tar.gz |
Document editor import options in the class reference
Tooltips are displayed when hovering import options, both in the Import
dock and in the import defaults editor (which is in the Project Settings).
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'editor/import_dock.cpp')
-rw-r--r-- | editor/import_dock.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 7b8b9cd7a4..8e3a247ace 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -157,6 +157,13 @@ void ImportDock::_add_keep_import_option(const String &p_importer_name) { } void ImportDock::_update_options(const String &p_path, const Ref<ConfigFile> &p_config) { + // Set the importer class to fetch the correct class in the XML class reference. + // This allows tooltips to display when hovering properties. + if (params->importer != nullptr) { + // Null check to avoid crashing if the "Keep File (No Import)" mode is selected. + import_opts->set_object_class(params->importer->get_class_name()); + } + List<ResourceImporter::ImportOption> options; if (params->importer.is_valid()) { @@ -644,6 +651,9 @@ ImportDock::ImportDock() { import_opts->set_v_size_flags(SIZE_EXPAND_FILL); import_opts->connect("property_edited", callable_mp(this, &ImportDock::_property_edited)); import_opts->connect("property_toggled", callable_mp(this, &ImportDock::_property_toggled)); + // Make it possible to display tooltips stored in the XML class reference. + // The object name is set when the importer changes in `_update_options()`. + import_opts->set_use_doc_hints(true); hb = memnew(HBoxContainer); content->add_child(hb); |