Fix build profile generator creating bogus profiles

This commit is contained in:
Michael Alexsander 2026-01-26 20:02:43 -03:00
parent a4bbad2ba8
commit a7c77ac1f7
No known key found for this signature in database
GPG key ID: A9C91EE110F4EABA
3 changed files with 46 additions and 24 deletions

View file

@ -1520,33 +1520,39 @@ void ResourceFormatLoaderBinary::get_classes_used(const String &p_path, HashSet<
loader.res_path = loader.local_path;
loader.get_classes_used(f, r_classes);
// Fetch the nodes inside scene files.
if (loader.type == "PackedScene") {
ERR_FAIL_COND(loader.load() != OK);
if (loader.type != "PackedScene") {
return;
}
Ref<SceneState> state = Ref<PackedScene>(loader.get_resource())->get_state();
for (int i = 0; i < state->get_node_count(); i++) {
const StringName node_name = state->get_node_type(i);
if (ClassDB::class_exists(node_name)) {
r_classes->insert(node_name);
// Fetch the nodes inside scene files.
// Reopening is necessary, or errors will occur.
f->reopen(p_path, FileAccess::READ);
loader.open(f);
ERR_FAIL_COND(loader.load() != OK);
Ref<SceneState> state = Ref<PackedScene>(loader.get_resource())->get_state();
for (int i = 0; i < state->get_node_count(); i++) {
const StringName node_name = state->get_node_type(i);
if (ClassDB::class_exists(node_name)) {
r_classes->insert(node_name);
}
// Fetch the values of properties in the node.
for (int j = 0; j < state->get_node_property_count(i); j++) {
const Variant var = state->get_node_property_value(i, j);
if (var.get_type() != Variant::OBJECT) {
continue;
}
// Fetch the values of properties in the node.
for (int j = 0; j < state->get_node_property_count(i); j++) {
const Variant var = state->get_node_property_value(i, j);
if (var.get_type() != Variant::OBJECT) {
continue;
}
const Object *obj = var.get_validated_object();
if (obj == nullptr) {
continue;
}
const Object *obj = var.get_validated_object();
if (obj == nullptr) {
continue;
}
const StringName obj_name = obj->get_class_name();
if (ClassDB::class_exists(obj_name)) {
r_classes->insert(obj_name);
}
const StringName obj_name = obj->get_class_name();
if (ClassDB::class_exists(obj_name)) {
r_classes->insert(obj_name);
}
}
}

View file

@ -890,7 +890,20 @@ void EditorBuildProfileManager::_detect_from_project() {
// Add classes that are either necessary for the engine to work properly, or there isn't a way to infer their use.
const LocalVector<String> hardcoded_classes = { "InputEvent", "MainLoop", "StyleBox" };
// HACK: Some classes are included due to creating clashes with unrelated when disabled.
// Until that is fixed, they need to always be enabled.
const LocalVector<String> hardcoded_classes = {
"Font",
"InputEvent",
"MainLoop",
"Mutex",
"ShaderInclude",
"ShaderIncludeDB",
"StyleBox",
"Time",
"Window",
};
for (const String &hc_class : hardcoded_classes) {
used_classes.insert(hc_class);

View file

@ -7855,6 +7855,9 @@ void RichTextLabel::_bind_methods() {
BIND_THEME_ITEM(Theme::DATA_TYPE_COLOR, RichTextLabel, table_border);
ADD_CLASS_DEPENDENCY("PopupMenu");
#ifdef MODULE_REGEX_ENABLED
ADD_CLASS_DEPENDENCY("RegEx");
#endif
}
TextServer::VisibleCharactersBehavior RichTextLabel::get_visible_characters_behavior() const {