diff options
author | Julian Eisel <julian@blender.org> | 2021-11-24 19:59:14 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-24 19:59:14 +0300 |
commit | cae3b581b05e6c1001b82773229246d48899e3d6 (patch) | |
tree | 605ec24f9a6de1fcb814e53676fa64ad4698998b | |
parent | 01ab36ebc1c43764b8bfb4c41f4c837a3b8757cb (diff) |
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.
-rw-r--r-- | source/blender/editors/space_file/asset_catalog_tree_view.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc index 51928fa7c23..5c880c15a53 100644 --- a/source/blender/editors/space_file/asset_catalog_tree_view.cc +++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc @@ -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) { |