@@ -2869,15 +2869,6 @@ void EditorInspector::update_tree() {
28692869 // Otherwise the category was probably added via `@export_category` or `_get_property_list()`.
28702870 const bool is_custom_category = p.hint_string .is_empty ();
28712871
2872- if ((is_custom_category && !show_custom_categories) || (!is_custom_category && !show_standard_categories)) {
2873- continue ;
2874- }
2875-
2876- // Hide the "MultiNodeEdit" category for MultiNodeEdit.
2877- if (Object::cast_to<MultiNodeEdit>(object) && p.name == " MultiNodeEdit" ) {
2878- continue ;
2879- }
2880-
28812872 // Iterate over remaining properties. If no properties in category, skip the category.
28822873 List<PropertyInfo>::Element *N = E_property->next ();
28832874 bool valid = true ;
@@ -2898,22 +2889,20 @@ void EditorInspector::update_tree() {
28982889 continue ; // Empty, ignore it.
28992890 }
29002891
2901- // Create an EditorInspectorCategory and add it to the inspector.
2902- EditorInspectorCategory *category = memnew (EditorInspectorCategory);
2903- main_vbox->add_child (category);
2904- category_vbox = nullptr ; // reset
2892+ String category_label;
2893+ String category_tooltip;
2894+ Ref<Texture> category_icon;
29052895
29062896 // Do not add an icon, do not change the current class (`doc_name`) for custom categories.
29072897 if (is_custom_category) {
2908- category-> label = p.name ;
2909- category-> set_tooltip_text ( p.name ) ;
2898+ category_label = p.name ;
2899+ category_tooltip = p.name ;
29102900 } else {
2911- String type = p.name ;
2912- String label = p.name ;
29132901 doc_name = p.name ;
2902+ category_label = p.name ;
29142903
29152904 // Use category's owner script to update some of its information.
2916- if (!EditorNode::get_editor_data ().is_type_recognized (type ) && ResourceLoader::exists (p.hint_string )) {
2905+ if (!EditorNode::get_editor_data ().is_type_recognized (p. name ) && ResourceLoader::exists (p.hint_string )) {
29172906 Ref<Script> scr = ResourceLoader::load (p.hint_string , " Script" );
29182907 if (scr.is_valid ()) {
29192908 StringName script_name = EditorNode::get_editor_data ().script_class_get_name (scr->get_path ());
@@ -2926,32 +2915,50 @@ void EditorInspector::update_tree() {
29262915 doc_name = docs[docs.size () - 1 ].name ;
29272916 }
29282917 if (script_name != StringName ()) {
2929- label = script_name;
2918+ category_label = script_name;
29302919 }
29312920
29322921 // Find the icon corresponding to the script.
29332922 if (script_name != StringName ()) {
2934- category-> icon = EditorNode::get_singleton ()->get_class_icon (script_name);
2923+ category_icon = EditorNode::get_singleton ()->get_class_icon (script_name);
29352924 } else {
2936- category-> icon = EditorNode::get_singleton ()->get_object_icon (scr.ptr (), " Object" );
2925+ category_icon = EditorNode::get_singleton ()->get_object_icon (scr.ptr (), " Object" );
29372926 }
29382927 }
29392928 }
29402929
2941- if (category-> icon .is_null () && !type .is_empty ()) {
2942- category-> icon = EditorNode::get_singleton ()->get_class_icon (type );
2930+ if (category_icon .is_null () && !p. name .is_empty ()) {
2931+ category_icon = EditorNode::get_singleton ()->get_class_icon (p. name );
29432932 }
29442933
2945- // Set the category label.
2946- category->label = label;
2947- category->doc_class_name = doc_name;
2948-
29492934 if (use_doc_hints) {
29502935 // `|` separators used in `EditorHelpBit`.
2951- category-> set_tooltip_text ( " class|" + doc_name + " |" ) ;
2936+ category_tooltip = " class|" + doc_name + " |" ;
29522937 }
29532938 }
29542939
2940+ if ((is_custom_category && !show_custom_categories) || (!is_custom_category && !show_standard_categories)) {
2941+ continue ;
2942+ }
2943+
2944+ // Hide the "MultiNodeEdit" category for MultiNodeEdit.
2945+ if (Object::cast_to<MultiNodeEdit>(object) && p.name == " MultiNodeEdit" ) {
2946+ continue ;
2947+ }
2948+
2949+ // Create an EditorInspectorCategory and add it to the inspector.
2950+ EditorInspectorCategory *category = memnew (EditorInspectorCategory);
2951+ main_vbox->add_child (category);
2952+ category_vbox = nullptr ; // Reset.
2953+
2954+ // Set the category info.
2955+ category->label = category_label;
2956+ category->set_tooltip_text (category_tooltip);
2957+ category->icon = category_icon;
2958+ if (!is_custom_category) {
2959+ category->doc_class_name = doc_name;
2960+ }
2961+
29552962 // Add editors at the start of a category.
29562963 for (Ref<EditorInspectorPlugin> &ped : valid_plugins) {
29572964 ped->parse_category (object, p.name );
0 commit comments