Blender V4.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::AssetLibraryget_asset_library () const
 
- Public Member Functions inherited from blender::ui::TreeViewItemDropTarget
 TreeViewItemDropTarget (AbstractTreeViewItem &view_item, DropBehavior behavior=DropBehavior::Insert)
 
std::optional< DropLocationchoose_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 AssetCatalogget_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
AbstractTreeViewItemview_item_
 
const DropBehavior behavior_
 

Detailed Description

Definition at line 109 of file asset_catalog_tree_view.cc.

Constructor & Destructor Documentation

◆ AssetCatalogDropTarget()

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

Definition at line 361 of file asset_catalog_tree_view.cc.

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 367 of file asset_catalog_tree_view.cc.

References can_modify_catalogs(), blender::asset_system::AssetCatalogTreeItem::catalog_path(), get_asset_library(), get_drag_catalog(), has_droppable_asset(), blender::asset_system::AssetCatalogPath::is_contained_in(), blender::asset_system::AssetCatalogPath::parent(), blender::asset_system::AssetCatalog::path, RPT_, wmDrag::type, WM_DRAG_ASSET_CATALOG, and 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 528 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 396 of file asset_catalog_tree_view.cc.

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

◆ get_asset_library()

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

Definition at line 538 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 512 of file asset_catalog_tree_view.cc.

References LISTBASE_FOREACH, RPT_, and 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

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