Repository: godotengine/godot
File: editor/inspector/editor_inspector.cpp (C++)

Code before:
			icon = EditorNode::get_singleton()->get_class_icon(script_name);
		}
	}
	if (icon.is_null() && !info.name.is_empty()) {
		icon = EditorNode::get_singleton()->get_class_icon(info.name);
	}
}

void EditorInspectorCategory::_theme_changed() {
	// This needs to be done via the signal, as it's fired before the minimum since is updated.
	EditorInspector::initialize_category_theme(theme_cache, this);
	menu_icon_dirty = true;
	_update_icon();
}

void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
	const Ref<InputEventMouseButton> &mb = p_event;
	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
		_popup_context_menu(get_screen_position() + mb->get_position());
	}
}

EditorInspectorCategory::EditorInspectorCategory() {
	set_focus_mode(FOCUS_ACCESSIBILITY);

	connect(SceneStringName(theme_changed), callable_mp(this, &EditorInspectorCategory::_theme_changed));
}

////////////////////////////////////////////////
////////////////////////////////////////////////

void EditorInspectorSection::_test_unfold() {
	if (!vbox_added) {
		add_child(vbox);
		move_child(vbox, 0);
		vbox_added = true;
	}
}

Ref<Texture2D> EditorInspectorSection::_get_arrow() {
	Ref<Texture2D> arrow;
	if (foldable) {
		if (object->editor_is_section_unfolded(section)) {
			arrow = theme_cache.arrow;
		} else {
			if (is_layout_rtl()) {
				arrow = theme_cache.arrow_collapsed_mirrored;
			} else {
				arrow = theme_cache.arrow_collapsed;
			}
		}

Review comment (suggestion):
This actually results in an error. Connections of self signals should be done in `NOTIFICATION_POSTINITIALIZE`.

Code after:
		StringName script_name = EditorNode::get_editor_data().script_class_get_name(scr->get_path());
		if (script_name == StringName()) {
			icon = EditorNode::get_singleton()->get_object_icon(scr.ptr());
		} else {
			icon = EditorNode::get_singleton()->get_class_icon(script_name);
		}
	}
	if (icon.is_null() && !info.name.is_empty()) {
		icon = EditorNode::get_singleton()->get_class_icon(info.name);
	}
}

void EditorInspectorCategory::_theme_changed() {
	// This needs to be done via the signal, as it's fired before the minimum since is updated.
	EditorInspector::initialize_category_theme(theme_cache, this);
	menu_icon_dirty = true;
	_update_icon();
}

void EditorInspectorCategory::gui_input(const Ref<InputEvent> &p_event) {
	const Ref<InputEventMouseButton> &mb = p_event;
	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) {
		_popup_context_menu(get_screen_position() + mb->get_position());
	}
}

EditorInspectorCategory::EditorInspectorCategory() {
	set_focus_mode(FOCUS_ACCESSIBILITY);
}

////////////////////////////////////////////////
////////////////////////////////////////////////

void EditorInspectorSection::_test_unfold() {
	if (!vbox_added) {
		add_child(vbox);
		move_child(vbox, 0);
		vbox_added = true;
	}
}

Ref<Texture2D> EditorInspectorSection::_get_arrow() {
	Ref<Texture2D> arrow;
	if (foldable) {
		if (object->editor_is_section_unfolded(section)) {
			arrow = theme_cache.arrow;
		} else {
			if (is_layout_rtl()) {
				arrow = theme_cache.arrow_collapsed_mirrored;
			} else {
				arrow = theme_cache.arrow_collapsed;