Blender V5.3
blender::ed::asset_browser::AssetCatalogDropTarget Class Reference

Inherits blender::ui::TreeViewItemDropTarget.

Public Member Functions

 AssetCatalogDropTarget (AssetCatalogTreeViewItem &item, const AssetCatalogTreeItem &catalog_item)
bool can_drop (const wmDrag &drag, const char **r_disabled_hint) const override
std::string drop_tooltip (const ui::DragInfo &drag_info) const override
bool on_drop (bContext *C, const ui::DragInfo &drag_info) const override
asset_system::AssetLibrary & get_asset_library () const
Public Member Functions inherited from blender::ui::TreeViewItemDropTarget
 TreeViewItemDropTarget (AbstractTreeViewItem &view_item, DropBehavior behavior=DropBehavior::Insert)
std::optional< DropLocation > choose_drop_location (const ARegion &region, const wmEvent &event) const override
template<class ViewType>
ViewType & get_view () const
Public Member Functions inherited from blender::ui::DropTargetInterface
 DropTargetInterface ()=default
virtual ~DropTargetInterface ()=default

Static Public Member Functions

static AssetCatalog * get_drag_catalog (const wmDrag &drag, const asset_system::AssetLibrary &asset_library)
static bool has_droppable_asset (const wmDrag &drag, const char **r_disabled_hint)
static bool can_modify_catalogs (const asset_system::AssetLibrary &asset_library, const char **r_disabled_hint)
static bool drop_assets_into_catalog (bContext *C, const AssetCatalogTreeView &tree_view, const wmDrag &drag, CatalogID catalog_id, StringRefNull simple_name="")
static bool drop_asset_catalog_into_catalog (const wmDrag &drag, AssetCatalogTreeView &tree_view, const std::optional< CatalogID > drop_catalog_id=std::nullopt)

Additional Inherited Members

Protected Attributes inherited from blender::ui::TreeViewItemDropTarget
AbstractTreeViewItem & view_item_
const DropBehavior behavior_

Detailed Description

Definition at line 119 of file asset_catalog_tree_view.cc.

Constructor & Destructor Documentation

◆ AssetCatalogDropTarget()

blender::ed::asset_browser::AssetCatalogDropTarget::AssetCatalogDropTarget ( AssetCatalogTreeViewItem & item,
const AssetCatalogTreeItem & catalog_item )

Member Function Documentation

◆ can_drop()

bool blender::ed::asset_browser::AssetCatalogDropTarget::can_drop ( const wmDrag & drag,
const char ** r_disabled_hint ) const
overridevirtual

Check if the data dragged with drag can be dropped on the element this drop target is for.

Parameters
r_disabled_hintReturn a static string to display to the user, explaining why dropping isn't possible on this UI element. Shouldn't be done too aggressively, e.g. don't set this if the drag-type can't be dropped here; only if it can but there's another reason it can't be dropped. Can assume this is a non-null pointer.

Implements blender::ui::DropTargetInterface.

Definition at line 393 of file asset_catalog_tree_view.cc.

References can_modify_catalogs(), get_asset_library(), get_drag_catalog(), has_droppable_asset(), blender::asset_system::AssetCatalogPath::parent(), blender::asset_system::AssetCatalog::path, RPT_, blender::wmDrag::type, blender::WM_DRAG_ASSET_CATALOG, and blender::WM_DRAG_ASSET_LIST.

◆ can_modify_catalogs()

bool blender::ed::asset_browser::AssetCatalogDropTarget::can_modify_catalogs ( const asset_system::AssetLibrary & asset_library,
const char ** r_disabled_hint )
static

Definition at line 605 of file asset_catalog_tree_view.cc.

References blender::ed::asset::catalogs_read_only(), and RPT_.

Referenced by can_drop().

◆ drop_asset_catalog_into_catalog()

bool blender::ed::asset_browser::AssetCatalogDropTarget::drop_asset_catalog_into_catalog ( const wmDrag & drag,
AssetCatalogTreeView & tree_view,
const std::optional< CatalogID > drop_catalog_id = std::nullopt )
static

◆ drop_assets_into_catalog()

◆ drop_tooltip()

std::string blender::ed::asset_browser::AssetCatalogDropTarget::drop_tooltip ( const ui::DragInfo & drag) const
overridevirtual

Custom text to display when dragging over the element using this drop target. Should explain what happens when dropping the data onto this UI element. Will only be used if #DropTargetInterface::can_drop() returns true, so the implementing override doesn't have to check that again. The returned value must be a translated string.

Implements blender::ui::DropTargetInterface.

Definition at line 422 of file asset_catalog_tree_view.cc.

References blender::ui::DragInfo::drag_data, blender::wmDrag::type, and blender::WM_DRAG_ASSET_CATALOG.

◆ get_asset_library()

asset_system::AssetLibrary & blender::ed::asset_browser::AssetCatalogDropTarget::get_asset_library ( ) const

Definition at line 615 of file asset_catalog_tree_view.cc.

References blender::ui::TreeViewItemDropTarget::get_view().

Referenced by can_drop().

◆ get_drag_catalog()

◆ has_droppable_asset()

bool blender::ed::asset_browser::AssetCatalogDropTarget::has_droppable_asset ( const wmDrag & drag,
const char ** r_disabled_hint )
static

Definition at line 583 of file asset_catalog_tree_view.cc.

References blender::BLI_assert(), RPT_, and blender::WM_drag_asset_list_get().

Referenced by can_drop().

◆ on_drop()

bool blender::ed::asset_browser::AssetCatalogDropTarget::on_drop ( bContext * C,
const ui::DragInfo & drag ) const
overridevirtual

Execute the logic to apply a drop of the data dragged with drag onto/into the UI element this drop target is for.

Implements blender::ui::DropTargetInterface.

Definition at line 463 of file asset_catalog_tree_view.cc.

References C, blender::ui::DragInfo::drag_data, drop_asset_catalog_into_catalog(), drop_assets_into_catalog(), blender::ui::TreeViewItemDropTarget::get_view(), blender::wmDrag::type, and blender::WM_DRAG_ASSET_CATALOG.


The documentation for this class was generated from the following file: