You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Don't allow instancing virtual resources in the resource picker dialog
This commit is contained in:
@@ -570,13 +570,17 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<Strin
|
|||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
String base = allowed_types[i].strip_edges();
|
String base = allowed_types[i].strip_edges();
|
||||||
p_vector->insert(base);
|
if (!ClassDB::is_virtual(base)) {
|
||||||
|
p_vector->insert(base);
|
||||||
|
}
|
||||||
|
|
||||||
// If we hit a familiar base type, take all the data from cache.
|
// If we hit a familiar base type, take all the data from cache.
|
||||||
if (allowed_types_cache.has(base)) {
|
if (allowed_types_cache.has(base)) {
|
||||||
List<StringName> allowed_subtypes = allowed_types_cache[base];
|
List<StringName> allowed_subtypes = allowed_types_cache[base];
|
||||||
for (const StringName &subtype_name : allowed_subtypes) {
|
for (const StringName &subtype_name : allowed_subtypes) {
|
||||||
p_vector->insert(subtype_name);
|
if (!ClassDB::is_virtual(subtype_name)) {
|
||||||
|
p_vector->insert(subtype_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<StringName> allowed_subtypes;
|
List<StringName> allowed_subtypes;
|
||||||
@@ -586,13 +590,17 @@ void EditorResourcePicker::_get_allowed_types(bool p_with_convert, HashSet<Strin
|
|||||||
ClassDB::get_inheriters_from_class(base, &inheriters);
|
ClassDB::get_inheriters_from_class(base, &inheriters);
|
||||||
}
|
}
|
||||||
for (const StringName &subtype_name : inheriters) {
|
for (const StringName &subtype_name : inheriters) {
|
||||||
p_vector->insert(subtype_name);
|
if (!ClassDB::is_virtual(subtype_name)) {
|
||||||
|
p_vector->insert(subtype_name);
|
||||||
|
}
|
||||||
allowed_subtypes.push_back(subtype_name);
|
allowed_subtypes.push_back(subtype_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const StringName &subtype_name : global_classes) {
|
for (const StringName &subtype_name : global_classes) {
|
||||||
if (EditorNode::get_editor_data().script_class_is_parent(subtype_name, base)) {
|
if (EditorNode::get_editor_data().script_class_is_parent(subtype_name, base)) {
|
||||||
p_vector->insert(subtype_name);
|
if (!ClassDB::is_virtual(subtype_name)) {
|
||||||
|
p_vector->insert(subtype_name);
|
||||||
|
}
|
||||||
allowed_subtypes.push_back(subtype_name);
|
allowed_subtypes.push_back(subtype_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user