1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Check for empty string for allowed type and allowed subtypes

This commit is contained in:
AeioMuch
2025-03-14 21:50:51 +01:00
parent 87f897ae0a
commit d0cff82841

View File

@@ -588,7 +588,7 @@ bool EditorPropertyArray::_is_drop_valid(const Dictionary &p_drag_data) const {
StringName ftype = dir->get_file_type(idx_in_dir); StringName ftype = dir->get_file_type(idx_in_dir);
String script_class = dir->get_file_resource_script_class(idx_in_dir); String script_class = dir->get_file_resource_script_class(idx_in_dir);
for (String at : allowed_type.split(",")) { for (String at : allowed_type.split(",", false)) {
at = at.strip_edges(); at = at.strip_edges();
// Fail if one of the files is not of allowed type. // Fail if one of the files is not of allowed type.
if (!ClassDB::is_parent_class(ftype, at) && !EditorNode::get_editor_data().script_class_is_parent(script_class, at)) { if (!ClassDB::is_parent_class(ftype, at) && !EditorNode::get_editor_data().script_class_is_parent(script_class, at)) {
@@ -613,7 +613,7 @@ bool EditorPropertyArray::_is_drop_valid(const Dictionary &p_drag_data) const {
script_class = EditorNode::get_singleton()->get_object_custom_type_name(res->get_script()); script_class = EditorNode::get_singleton()->get_object_custom_type_name(res->get_script());
} }
for (String at : allowed_type.split(",")) { for (String at : allowed_type.split(",", false)) {
at = at.strip_edges(); at = at.strip_edges();
if (ClassDB::is_parent_class(res_type, at) || EditorNode::get_editor_data().script_class_is_parent(script_class, at)) { if (ClassDB::is_parent_class(res_type, at) || EditorNode::get_editor_data().script_class_is_parent(script_class, at)) {
return true; return true;
@@ -631,7 +631,7 @@ bool EditorPropertyArray::_is_drop_valid(const Dictionary &p_drag_data) const {
if (subtype_hint_string == "NodePath") { if (subtype_hint_string == "NodePath") {
return true; return true;
} else { } else {
for (String ast : subtype_hint_string.split(",")) { for (String ast : subtype_hint_string.split(",", false)) {
ast = ast.strip_edges(); ast = ast.strip_edges();
allowed_subtype_array.append(ast); allowed_subtype_array.append(ast);
} }