[Bf-blender-cvs] [cae3b581b05] blender-v3.0-release: Asset Browser: Fix catalog being renamed when dropping into parent

Julian Eisel noreply at git.blender.org
Wed Nov 24 18:05:37 CET 2021


Commit: cae3b581b05e6c1001b82773229246d48899e3d6
Author: Julian Eisel
Date:   Wed Nov 24 17:59:14 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBcae3b581b05e6c1001b82773229246d48899e3d6

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.

===================================================================

M	source/blender/editors/space_file/asset_catalog_tree_view.cc

===================================================================

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) {



More information about the Bf-blender-cvs mailing list