Asset Browser: Fix catalog being renamed when dropping into parent

When dropping catalogs it is ensured that the name of the moved catalog
is unique within the new parent catalog. When dropping a catalog into
the parent, the catalog would not actually move to a different location,
but it would still be renamed. The unique name logic simply isn't smart
enough to ignore the catalog that is about to be moved.
Address this by disallowing dragging a catalog into its own parent. It's
already there.
This commit is contained in:
Julian Eisel 2021-11-24 17:59:14 +01:00
parent 01ab36ebc1
commit cae3b581b0
1 changed files with 4 additions and 0 deletions

View File

@ -377,6 +377,10 @@ bool AssetCatalogDropController::can_drop(const wmDrag &drag, const char **r_dis
*r_disabled_hint = "Catalog cannot be dropped into itself";
return false;
}
if (catalog_item_.catalog_path() == drag_catalog->path.parent()) {
*r_disabled_hint = "Catalog is already placed inside this catalog";
return false;
}
return true;
}
if (drag.type == WM_DRAG_ASSET_LIST) {