@@ -2816,53 +2816,53 @@ void EditorInspector::update_tree() {
28162816
28172817 // `hint_script` should contain a native class name or a script path.
28182818 // Otherwise the category was probably added via `@export_category` or `_get_property_list()`.
2819+ // Do not add an icon, do not change the current class (`doc_name`) for custom categories.
28192820 if (p.hint_string .is_empty ()) {
28202821 category->label = p.name ;
28212822 category->set_tooltip_text (p.name );
2822- continue ; // Do not add an icon, do not change the current class (`doc_name`).
2823- }
2823+ } else {
2824+ String type = p.name ;
2825+ String label = p.name ;
2826+ doc_name = p.name ;
28242827
2825- String type = p.name ;
2826- String label = p.name ;
2827- doc_name = p.name ;
2828-
2829- // Use category's owner script to update some of its information.
2830- if (!EditorNode::get_editor_data ().is_type_recognized (type) && p.hint_string .length () && ResourceLoader::exists (p.hint_string )) {
2831- Ref<Script> scr = ResourceLoader::load (p.hint_string , " Script" );
2832- if (scr.is_valid ()) {
2833- StringName script_name = EditorNode::get_editor_data ().script_class_get_name (scr->get_path ());
2834-
2835- // Update the docs reference and the label based on the script.
2836- Vector<DocData::ClassDoc> docs = scr->get_documentation ();
2837- if (!docs.is_empty ()) {
2838- // The documentation of a GDScript's main class is at the end of the array.
2839- // Hacky because this isn't necessarily always guaranteed.
2840- doc_name = docs[docs.size () - 1 ].name ;
2841- }
2842- if (script_name != StringName ()) {
2843- label = script_name;
2844- }
2828+ // Use category's owner script to update some of its information.
2829+ if (!EditorNode::get_editor_data ().is_type_recognized (type) && ResourceLoader::exists (p.hint_string )) {
2830+ Ref<Script> scr = ResourceLoader::load (p.hint_string , " Script" );
2831+ if (scr.is_valid ()) {
2832+ StringName script_name = EditorNode::get_editor_data ().script_class_get_name (scr->get_path ());
28452833
2846- // Find the icon corresponding to the script.
2847- if (script_name != StringName ()) {
2848- category->icon = EditorNode::get_singleton ()->get_class_icon (script_name);
2849- } else {
2850- category->icon = EditorNode::get_singleton ()->get_object_icon (scr.ptr (), " Object" );
2834+ // Update the docs reference and the label based on the script.
2835+ Vector<DocData::ClassDoc> docs = scr->get_documentation ();
2836+ if (!docs.is_empty ()) {
2837+ // The documentation of a GDScript's main class is at the end of the array.
2838+ // Hacky because this isn't necessarily always guaranteed.
2839+ doc_name = docs[docs.size () - 1 ].name ;
2840+ }
2841+ if (script_name != StringName ()) {
2842+ label = script_name;
2843+ }
2844+
2845+ // Find the icon corresponding to the script.
2846+ if (script_name != StringName ()) {
2847+ category->icon = EditorNode::get_singleton ()->get_class_icon (script_name);
2848+ } else {
2849+ category->icon = EditorNode::get_singleton ()->get_object_icon (scr.ptr (), " Object" );
2850+ }
28512851 }
28522852 }
2853- }
28542853
2855- if (category->icon .is_null () && !type.is_empty ()) {
2856- category->icon = EditorNode::get_singleton ()->get_class_icon (type);
2857- }
2854+ if (category->icon .is_null () && !type.is_empty ()) {
2855+ category->icon = EditorNode::get_singleton ()->get_class_icon (type);
2856+ }
28582857
2859- // Set the category label.
2860- category->label = label;
2861- category->doc_class_name = doc_name;
2858+ // Set the category label.
2859+ category->label = label;
2860+ category->doc_class_name = doc_name;
28622861
2863- if (use_doc_hints) {
2864- // `|` separator used in `EditorHelpTooltip` for formatting.
2865- category->set_tooltip_text (" class|" + doc_name + " ||" );
2862+ if (use_doc_hints) {
2863+ // `|` separator used in `EditorHelpTooltip` for formatting.
2864+ category->set_tooltip_text (" class|" + doc_name + " ||" );
2865+ }
28662866 }
28672867
28682868 // Add editors at the start of a category.
0 commit comments