Blender V4.3
blender::ed::asset::shelf::AssetViewItem Class Reference

Inherits blender::ui::PreviewGridItem.

Public Member Functions

 AssetViewItem (const AssetHandle &asset, StringRef identifier, StringRef label, int preview_icon_id)
 
void disable_asset_drag ()
 
void build_grid_tile (const bContext &C, uiLayout &layout) const override
 
void build_context_menu (bContext &C, uiLayout &column) const override
 
std::optional< bool > should_be_active () const override
 
void on_activate (bContext &C) override
 
bool should_be_filtered_visible (StringRefNull filter_string) const override
 
std::unique_ptr< ui::AbstractViewItemDragControllercreate_drag_controller () const override
 
- Public Member Functions inherited from blender::ui::PreviewGridItem
 PreviewGridItem (StringRef identifier, StringRef label, int preview_icon_id)
 
void build_grid_tile (const bContext &C, uiLayout &layout) const override
 
void build_grid_tile_button (uiLayout &layout, BIFIconID override_preview_icon_id=ICON_NONE) const
 
void set_on_activate_fn (ActivateFn fn)
 
void set_is_active_fn (IsActiveFn fn)
 
void hide_label ()
 
- Public Member Functions inherited from blender::ui::AbstractGridViewItem
 ~AbstractGridViewItem () override=default
 
std::optional< std::string > debug_name () const override
 
AbstractGridViewget_view () const
 
- Public Member Functions inherited from blender::ui::AbstractViewItem
virtual ~AbstractViewItem ()=default
 
AbstractViewget_view () const
 
uiButViewItemview_item_button () const
 
void disable_interaction ()
 
bool is_interactive () const
 
void disable_activatable ()
 
bool is_active () const
 
bool is_search_highlight () const
 
void activate (bContext &C)
 
void deactivate ()
 
virtual bool supports_renaming () const
 
virtual bool rename (const bContext &C, StringRefNull new_name)
 
virtual StringRef get_rename_string () const
 
bool is_renaming () const
 
void begin_renaming ()
 
void end_renaming ()
 
void rename_apply (const bContext &C)
 
bool is_filtered_visible () const
 

Additional Inherited Members

- Public Types inherited from blender::ui::PreviewGridItem
using IsActiveFn = std::function<bool()>
 
using ActivateFn = std::function<void(bContext &C, PreviewGridItem &new_active)>
 
- Public Attributes inherited from blender::ui::PreviewGridItem
std::string label
 
int preview_icon_id = ICON_NONE
 
- Protected Member Functions inherited from blender::ui::AbstractGridViewItem
 AbstractGridViewItem (StringRef identifier)
 
bool matches (const AbstractViewItem &other) const override
 
std::unique_ptr< DropTargetInterfacecreate_item_drop_target () final
 
virtual std::unique_ptr< GridViewItemDropTargetcreate_drop_target ()
 
- Protected Member Functions inherited from blender::ui::AbstractViewItem
 AbstractViewItem ()=default
 
virtual void update_from_old (const AbstractViewItem &old)
 
virtual void change_state_delayed ()
 
virtual bool set_state_active ()
 
void add_rename_button (uiBlock &block)
 
- Protected Attributes inherited from blender::ui::PreviewGridItem
ActivateFn activate_fn_
 
IsActiveFn is_active_fn_
 
bool hide_label_ = false
 
- Protected Attributes inherited from blender::ui::AbstractGridViewItem
StringRef identifier_ {}
 
- Protected Attributes inherited from blender::ui::AbstractViewItem
AbstractViewview_ = nullptr
 
uiButViewItemview_item_but_ = nullptr
 
bool is_activatable_ = true
 
bool is_interactive_ = true
 
bool is_active_ = false
 
bool is_renaming_ = false
 
bool is_highlighted_search_ = false
 
bool is_filtered_visible_ = true
 

Detailed Description

Definition at line 57 of file asset_shelf_asset_view.cc.

Constructor & Destructor Documentation

◆ AssetViewItem()

blender::ed::asset::shelf::AssetViewItem::AssetViewItem ( const AssetHandle & asset,
StringRef identifier,
StringRef label,
int preview_icon_id )

Definition at line 184 of file asset_shelf_asset_view.cc.

Member Function Documentation

◆ build_context_menu()

void blender::ed::asset::shelf::AssetViewItem::build_context_menu ( bContext & C,
uiLayout & column ) const
overridevirtual

◆ build_grid_tile()

◆ create_drag_controller()

std::unique_ptr< ui::AbstractViewItemDragController > blender::ed::asset::shelf::AssetViewItem::create_drag_controller ( ) const
overridevirtual

If an item wants to support being dragged, it has to return a drag controller here. That is an object implementing #AbstractViewItemDragController.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 325 of file asset_shelf_asset_view.cc.

References blender::ui::AbstractGridViewItem::get_view(), and blender::ed::asset::handle_get_representation().

◆ disable_asset_drag()

void blender::ed::asset::shelf::AssetViewItem::disable_asset_drag ( )

◆ on_activate()

void blender::ed::asset::shelf::AssetViewItem::on_activate ( bContext & C)
overridevirtual

Called when the view changes an item's state from inactive to active. Will only be called if the state change is triggered through the view, not through external changes. E.g. a click on an item calls it, a change in the value returned by should_be_active() to reflect an external state change does not.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 304 of file asset_shelf_asset_view.cc.

References AssetShelfType::activate_operator, blender::ed::asset::shelf::create_activate_operator_params(), blender::ui::AbstractGridViewItem::get_view(), blender::ed::asset::handle_get_representation(), AssetShelf::type, WM_operator_name_call_ptr(), and WM_operator_properties_free().

◆ should_be_active()

std::optional< bool > blender::ed::asset::shelf::AssetViewItem::should_be_active ( ) const
overridevirtual

If the result is not empty, it controls whether the item should be active or not, usually depending on the data that the view represents. Note that since this is meant to reflect externally managed state changes, on_activate() will never be called if this returns true.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 287 of file asset_shelf_asset_view.cc.

References AssetShelfType::get_active_asset, blender::ui::AbstractGridViewItem::get_view(), blender::ed::asset::handle_get_representation(), blender::asset_system::AssetRepresentation::make_weak_reference(), blender::ui::AbstractGridViewItem::matches(), and AssetShelf::type.

◆ should_be_filtered_visible()

bool blender::ed::asset::shelf::AssetViewItem::should_be_filtered_visible ( StringRefNull filter_string) const
overridevirtual
Note
Do not call this directly to avoid constantly rechecking the filter state. Instead use is_filtered_visible() for querying.

Reimplemented from blender::ui::AbstractViewItem.

Definition at line 319 of file asset_shelf_asset_view.cc.

References blender::StringRefNull::c_str(), blender::asset_system::AssetRepresentation::get_name(), and blender::ed::asset::handle_get_representation().


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