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

Assign value to property by dropping to scene tree

This commit is contained in:
kobewi
2021-07-16 16:27:59 +02:00
parent 60add98a4c
commit 5faf51a5aa
4 changed files with 80 additions and 6 deletions

View File

@@ -1037,15 +1037,24 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
return true;
}
bool scene_drop = true;
for (int i = 0; i < files.size(); i++) {
String file = files[i];
String ftype = EditorFileSystem::get_singleton()->get_file_type(file);
if (ftype != "PackedScene") {
return false;
scene_drop = false;
break;
}
}
tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN | Tree::DROP_MODE_ON_ITEM); //so it works..
if (scene_drop) {
tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN | Tree::DROP_MODE_ON_ITEM);
} else {
if (files.size() > 1) {
return false;
}
tree->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM);
}
return true;
}