Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/asset_catalog_tree_view.cc
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | static bool drop_into_catalog(const AssetCatalogTreeView &tree_view, | ||||
| StringRefNull simple_name = ""); | StringRefNull simple_name = ""); | ||||
| void on_activate() override; | void on_activate() override; | ||||
| void build_row(uiLayout &row) override; | void build_row(uiLayout &row) override; | ||||
| void build_context_menu(bContext &C, uiLayout &column) const override; | void build_context_menu(bContext &C, uiLayout &column) const override; | ||||
| bool can_drop(const wmDrag &drag) const override; | bool can_drop(const wmDrag &drag) const override; | ||||
| std::string drop_tooltip(const bContext &C, | std::string drop_tooltip(const bContext &C, const wmDrag &drag, const int xy[2]) const override; | ||||
| const wmDrag &drag, | |||||
| const wmEvent &event) const override; | |||||
| bool on_drop(const wmDrag &drag) override; | bool on_drop(const wmDrag &drag) override; | ||||
| bool can_rename() const override; | bool can_rename() const override; | ||||
| bool rename(StringRefNull new_name) override; | bool rename(StringRefNull new_name) override; | ||||
| }; | }; | ||||
| /** Only reason this isn't just `BasicTreeViewItem` is to add a '+' icon for adding a root level | /** Only reason this isn't just `BasicTreeViewItem` is to add a '+' icon for adding a root level | ||||
| * catalog. */ | * catalog. */ | ||||
| class AssetCatalogTreeViewAllItem : public ui::BasicTreeViewItem { | class AssetCatalogTreeViewAllItem : public ui::BasicTreeViewItem { | ||||
| using BasicTreeViewItem::BasicTreeViewItem; | using BasicTreeViewItem::BasicTreeViewItem; | ||||
| void build_row(uiLayout &row) override; | void build_row(uiLayout &row) override; | ||||
| }; | }; | ||||
| class AssetCatalogTreeViewUnassignedItem : public ui::BasicTreeViewItem { | class AssetCatalogTreeViewUnassignedItem : public ui::BasicTreeViewItem { | ||||
| using BasicTreeViewItem::BasicTreeViewItem; | using BasicTreeViewItem::BasicTreeViewItem; | ||||
| bool can_drop(const wmDrag &drag) const override; | bool can_drop(const wmDrag &drag) const override; | ||||
| std::string drop_tooltip(const bContext &C, | std::string drop_tooltip(const bContext &C, const wmDrag &drag, const int xy[2]) const override; | ||||
| const wmDrag &drag, | |||||
| const wmEvent &event) const override; | |||||
| bool on_drop(const wmDrag &drag) override; | bool on_drop(const wmDrag &drag) override; | ||||
| }; | }; | ||||
| /* ---------------------------------------------------------------------- */ | /* ---------------------------------------------------------------------- */ | ||||
| AssetCatalogTreeView::AssetCatalogTreeView(::AssetLibrary *library, | AssetCatalogTreeView::AssetCatalogTreeView(::AssetLibrary *library, | ||||
| FileAssetSelectParams *params, | FileAssetSelectParams *params, | ||||
| SpaceFile &space_file) | SpaceFile &space_file) | ||||
| ▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | bool AssetCatalogTreeViewItem::can_drop(const wmDrag &drag) const | ||||
| if (drag.type != WM_DRAG_ASSET_LIST) { | if (drag.type != WM_DRAG_ASSET_LIST) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return has_droppable_item(drag); | return has_droppable_item(drag); | ||||
| } | } | ||||
| std::string AssetCatalogTreeViewItem::drop_tooltip(const bContext & /*C*/, | std::string AssetCatalogTreeViewItem::drop_tooltip(const bContext & /*C*/, | ||||
| const wmDrag &drag, | const wmDrag &drag, | ||||
| const wmEvent & /*event*/) const | const int * /*xy*/) const | ||||
| { | { | ||||
| const ListBase *asset_drags = WM_drag_asset_list_get(&drag); | const ListBase *asset_drags = WM_drag_asset_list_get(&drag); | ||||
| const bool is_multiple_assets = !BLI_listbase_is_single(asset_drags); | const bool is_multiple_assets = !BLI_listbase_is_single(asset_drags); | ||||
| /* Don't try to be smart by dynamically adding the 's' for the plural. Just makes translation | /* Don't try to be smart by dynamically adding the 's' for the plural. Just makes translation | ||||
| * harder, so use full literals. */ | * harder, so use full literals. */ | ||||
| std::string basic_tip = is_multiple_assets ? TIP_("Move assets to catalog") : | std::string basic_tip = is_multiple_assets ? TIP_("Move assets to catalog") : | ||||
| TIP_("Move asset to catalog"); | TIP_("Move asset to catalog"); | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | bool AssetCatalogTreeViewUnassignedItem::can_drop(const wmDrag &drag) const | ||||
| if (drag.type != WM_DRAG_ASSET_LIST) { | if (drag.type != WM_DRAG_ASSET_LIST) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return AssetCatalogTreeViewItem::has_droppable_item(drag); | return AssetCatalogTreeViewItem::has_droppable_item(drag); | ||||
| } | } | ||||
| std::string AssetCatalogTreeViewUnassignedItem::drop_tooltip(const bContext & /*C*/, | std::string AssetCatalogTreeViewUnassignedItem::drop_tooltip(const bContext & /*C*/, | ||||
| const wmDrag &drag, | const wmDrag &drag, | ||||
| const wmEvent & /*event*/) const | const int * /*xy*/) const | ||||
| { | { | ||||
| const ListBase *asset_drags = WM_drag_asset_list_get(&drag); | const ListBase *asset_drags = WM_drag_asset_list_get(&drag); | ||||
| const bool is_multiple_assets = !BLI_listbase_is_single(asset_drags); | const bool is_multiple_assets = !BLI_listbase_is_single(asset_drags); | ||||
| return is_multiple_assets ? TIP_("Move assets out of any catalog") : | return is_multiple_assets ? TIP_("Move assets out of any catalog") : | ||||
| TIP_("Move asset out of any catalog"); | TIP_("Move asset out of any catalog"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines | |||||