Blender V5.0
blender::ed::asset::shelf::AssetViewItem Class Reference

Inherits blender::ui::PreviewGridItem.

Public Member Functions

 AssetViewItem (asset_system::AssetRepresentation &asset_, StringRef identifier, StringRef label)
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
virtual bool set_state_active ()
virtual std::optional< bool > should_be_selected () const
virtual void set_selected (const bool select)
void activate (bContext &C)
void activate_for_context_menu (bContext &C)
void deactivate ()
AbstractViewget_view () const
uiButViewItemview_item_button () const
void disable_interaction ()
bool is_interactive () const
void disable_activatable ()
void select_on_click_set ()
bool is_select_on_click () const
void always_reactivate_on_click ()
void activate_for_context_menu_set ()
bool is_active () const
bool is_selected () const
bool is_search_highlight () const
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)
virtual void delete_item (bContext *C)
virtual void on_filter_change ()
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 ()
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
std::string 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_selected_ = false
bool is_renaming_ = false
bool is_highlighted_search_ = false
bool is_filtered_visible_ = true
bool is_always_collapsible_ = false
bool select_on_click_ = false
bool reactivate_on_click_ = false
bool activate_for_context_menu_ = false

Detailed Description

Definition at line 58 of file asset_shelf_asset_view.cc.

Constructor & Destructor Documentation

◆ AssetViewItem()

blender::ed::asset::shelf::AssetViewItem::AssetViewItem ( asset_system::AssetRepresentation & asset_,
StringRef identifier,
StringRef label )

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 321 of file asset_shelf_asset_view.cc.

References AssetShelfType::drag_operator, blender::ui::AbstractGridViewItem::get_view(), and AssetShelf::type.

◆ 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 300 of file asset_shelf_asset_view.cc.

References AssetShelfType::activate_operator, C, blender::ed::asset::shelf::create_asset_operator_params(), blender::ui::AbstractGridViewItem::get_view(), 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 284 of file asset_shelf_asset_view.cc.

References AssetShelfType::get_active_asset, blender::ui::AbstractGridViewItem::get_view(), 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 315 of file asset_shelf_asset_view.cc.

References blender::StringRefNull::c_str().


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