Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-11-24 20:02:56 +0300
committerJulian Eisel <julian@blender.org>2021-11-24 20:05:08 +0300
commit71c39a9e2ef300a1ca451f1080cf59dda94ef4a4 (patch)
treec21c9204bab13ee40241b1de1e5687ce2cc9fe89 /source/blender/editors/space_file
parentcae3b581b05e6c1001b82773229246d48899e3d6 (diff)
Asset Browser: Activate a catalog when dragging
Without this it's easy to loose track of which catalog you are dragging. Things feel generally quite jumpy/disconnected, activating the catalog makes things feel far less like that. I consider this an important usability fix, therefore I'm adding it to the release branch.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/asset_catalog_tree_view.cc18
1 files changed, 14 insertions, 4 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 5c880c15a53..d2d95a10c2a 100644
--- a/source/blender/editors/space_file/asset_catalog_tree_view.cc
+++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc
@@ -110,10 +110,12 @@ class AssetCatalogDragController : public ui::AbstractTreeViewItemDragController
AssetCatalogTreeItem &catalog_item_;
public:
- explicit AssetCatalogDragController(AssetCatalogTreeItem &catalog_item);
+ explicit AssetCatalogDragController(AssetCatalogTreeView &tree_view,
+ AssetCatalogTreeItem &catalog_item);
int get_drag_type() const override;
void *create_drag_data() const override;
+ void on_drag_start() override;
};
class AssetCatalogDropController : public ui::AbstractTreeViewItemDropController {
@@ -355,7 +357,8 @@ std::unique_ptr<ui::AbstractTreeViewItemDropController> AssetCatalogTreeViewItem
std::unique_ptr<ui::AbstractTreeViewItemDragController> AssetCatalogTreeViewItem::
create_drag_controller() const
{
- return std::make_unique<AssetCatalogDragController>(catalog_item_);
+ return std::make_unique<AssetCatalogDragController>(
+ static_cast<AssetCatalogTreeView &>(get_tree_view()), catalog_item_);
}
/* ---------------------------------------------------------------------- */
@@ -513,8 +516,9 @@ bool AssetCatalogDropController::has_droppable_asset(const wmDrag &drag,
/* ---------------------------------------------------------------------- */
-AssetCatalogDragController::AssetCatalogDragController(AssetCatalogTreeItem &catalog_item)
- : catalog_item_(catalog_item)
+AssetCatalogDragController::AssetCatalogDragController(AssetCatalogTreeView &tree_view,
+ AssetCatalogTreeItem &catalog_item)
+ : ui::AbstractTreeViewItemDragController(tree_view), catalog_item_(catalog_item)
{
}
@@ -531,6 +535,12 @@ void *AssetCatalogDragController::create_drag_data() const
return drag_catalog;
}
+void AssetCatalogDragController::on_drag_start()
+{
+ AssetCatalogTreeView &tree_view_ = tree_view<AssetCatalogTreeView>();
+ tree_view_.activate_catalog_by_id(catalog_item_.get_catalog_id());
+}
+
/* ---------------------------------------------------------------------- */
void AssetCatalogTreeViewAllItem::build_row(uiLayout &row)