Blender  V3.3
Public Member Functions | Static Public Member Functions | List of all members
blender::ed::asset_browser::AssetCatalogDropController Class Reference
Inheritance diagram for blender::ed::asset_browser::AssetCatalogDropController:
blender::ui::AbstractViewItemDropController

Public Member Functions

 AssetCatalogDropController (AssetCatalogTreeView &tree_view, AssetCatalogTreeItem &catalog_item)
 
bool can_drop (const wmDrag &drag, const char **r_disabled_hint) const override
 
std::string drop_tooltip (const wmDrag &drag) const override
 
bool on_drop (struct bContext *C, const wmDrag &drag) override
 
::AssetLibraryget_asset_library () const
 
- Public Member Functions inherited from blender::ui::AbstractViewItemDropController
virtual ~AbstractViewItemDropController ()=default
 
 AbstractViewItemDropController (AbstractView &view)
 
template<class ViewType >
ViewType & get_view () const
 

Static Public Member Functions

static AssetCatalogget_drag_catalog (const wmDrag &drag, const ::AssetLibrary &asset_library)
 
static bool has_droppable_asset (const wmDrag &drag, const char **r_disabled_hint)
 
static bool drop_assets_into_catalog (struct 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::AbstractViewItemDropController
AbstractViewview_
 

Detailed Description

Definition at line 106 of file asset_catalog_tree_view.cc.

Constructor & Destructor Documentation

◆ AssetCatalogDropController()

blender::ed::asset_browser::AssetCatalogDropController::AssetCatalogDropController ( AssetCatalogTreeView tree_view,
AssetCatalogTreeItem catalog_item 
)

Definition at line 352 of file asset_catalog_tree_view.cc.

Member Function Documentation

◆ can_drop()

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

Check if the data dragged with drag can be dropped on the item this controller is for.

Parameters
r_disabled_hintReturn a static string to display to the user, explaining why dropping isn't possible on this item. 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::AbstractViewItemDropController.

Definition at line 358 of file asset_catalog_tree_view.cc.

References blender::bke::AssetCatalogTreeItem::catalog_path(), get_asset_library(), get_drag_catalog(), has_droppable_asset(), blender::bke::AssetCatalogPath::is_contained_in(), blender::bke::AssetCatalogPath::parent(), blender::bke::AssetCatalog::path, wmDrag::type, WM_DRAG_ASSET_CATALOG, and WM_DRAG_ASSET_LIST.

◆ drop_asset_catalog_into_catalog()

bool blender::ed::asset_browser::AssetCatalogDropController::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()

bool blender::ed::asset_browser::AssetCatalogDropController::drop_assets_into_catalog ( struct bContext C,
const AssetCatalogTreeView tree_view,
const wmDrag drag,
CatalogID  catalog_id,
StringRefNull  simple_name = "" 
)
static

◆ drop_tooltip()

std::string blender::ed::asset_browser::AssetCatalogDropController::drop_tooltip ( const wmDrag drag) const
overridevirtual

Custom text to display when dragging over a view item. Should explain what happens when dropping the data onto this item. Will only be used if #AbstractViewItem::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::AbstractViewItemDropController.

Definition at line 381 of file asset_catalog_tree_view.cc.

References wmDrag::type, and WM_DRAG_ASSET_CATALOG.

◆ get_asset_library()

AssetLibrary & blender::ed::asset_browser::AssetCatalogDropController::get_asset_library ( ) const

Definition at line 513 of file asset_catalog_tree_view.cc.

Referenced by can_drop().

◆ get_drag_catalog()

AssetCatalog * blender::ed::asset_browser::AssetCatalogDropController::get_drag_catalog ( const wmDrag drag,
const ::AssetLibrary asset_library 
)
static

◆ has_droppable_asset()

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

Definition at line 496 of file asset_catalog_tree_view.cc.

References LISTBASE_FOREACH, TIP_, and WM_drag_asset_list_get().

Referenced by can_drop().

◆ on_drop()

bool blender::ed::asset_browser::AssetCatalogDropController::on_drop ( struct bContext C,
const wmDrag drag 
)
overridevirtual

Execute the logic to apply a drop of the data dragged with drag onto/into the item this controller is for.

Implements blender::ui::AbstractViewItemDropController.

Definition at line 421 of file asset_catalog_tree_view.cc.

References C, drop_asset_catalog_into_catalog(), drop_assets_into_catalog(), blender::bke::AssetCatalogTreeItem::get_catalog_id(), blender::bke::AssetCatalogTreeItem::get_simple_name(), wmDrag::type, and WM_DRAG_ASSET_CATALOG.


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