Merge pull request #70148 from KoBeWi/remove_all_restrictions

Remove conditons for unfolding inspector sections
This commit is contained in:
Rémi Verschelde 2023-01-13 18:00:45 +01:00
commit 787179dac8
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 5 additions and 20 deletions

View file

@ -1361,38 +1361,22 @@ void EditorInspectorSection::_notification(int p_what) {
} break;
case NOTIFICATION_DRAG_BEGIN: {
Dictionary dd = get_viewport()->gui_get_drag_data();
// Only allow dropping if the section contains properties which can take the dragged data.
bool children_can_drop = false;
for (int child_idx = 0; child_idx < vbox->get_child_count(); child_idx++) {
Control *editor_property = Object::cast_to<Control>(vbox->get_child(child_idx));
// Test can_drop_data and can_drop_data_fw, since can_drop_data only works if set up with forwarding or if script attached.
if (editor_property && (editor_property->can_drop_data(Point2(), dd) || editor_property->call("_can_drop_data_fw", Point2(), dd, this))) {
children_can_drop = true;
break;
}
}
dropping = children_can_drop;
queue_redraw();
dropping_for_unfold = true;
} break;
case NOTIFICATION_DRAG_END: {
dropping = false;
queue_redraw();
dropping_for_unfold = false;
} break;
case NOTIFICATION_MOUSE_ENTER: {
if (dropping) {
if (dropping || dropping_for_unfold) {
dropping_unfold_timer->start();
}
queue_redraw();
} break;
case NOTIFICATION_MOUSE_EXIT: {
if (dropping) {
if (dropping || dropping_for_unfold) {
dropping_unfold_timer->stop();
}
queue_redraw();

View file

@ -276,6 +276,7 @@ class EditorInspectorSection : public Container {
Timer *dropping_unfold_timer = nullptr;
bool dropping = false;
bool dropping_for_unfold = false;
HashSet<StringName> revertable_properties;