Blender V5.3
blender::AssetLibraryRepoItem Struct Reference

Inherits blender::AssetLibraryListItem.

Public Member Functions

void build_row (ui::Layout &row) override
bool matches_single (const ui::AbstractTreeViewItem &other) const override
std::optional< bool > should_be_collapsed () const override
bool set_collapsed (const bool collapsed) override
void on_collapse_change (bContext &C, const bool is_collapsed) override
Public Member Functions inherited from blender::AssetLibraryListItem
void on_activate (bContext &) override
std::optional< bool > should_be_active () const override
 AssetLibraryListItemCommon (const AnyAssetLibraryDefinition &library, const int index_in_list)
Public Member Functions inherited from blender::AssetLibraryListItemCommon
 AssetLibraryListItemCommon (const AnyAssetLibraryDefinition &library, const int index_in_list)
bool supports_renaming () const override
bool rename (const bContext &C, StringRefNull new_name) override
Public Member Functions inherited from blender::ui::AbstractTreeViewItem
 AbstractTreeViewItem ()
 ~AbstractTreeViewItem () override=default
std::optional< std::string > debug_name () const override
std::unique_ptr< DropTargetInterface > create_item_drop_target () final
virtual std::unique_ptr< TreeViewItemDropTarget > create_drop_target ()
AbstractTreeView & get_tree_view () const
std::optional< rctf > get_win_rect (const ARegion &region) const
void begin_renaming ()
bool toggle_collapsed ()
void uncollapse_by_default ()
bool is_collapsed () const
bool is_collapsible () const
int count_parents () const
AbstractTreeViewItem * get_parent ()
AbstractTreeViewItem * get_child ()
void on_filter () override
StringRefNull label () const
Public Member Functions inherited from blender::ui::AbstractViewItem
virtual ~AbstractViewItem ()=default
virtual void build_context_menu (bContext &C, Layout &column) const
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 ()
virtual std::unique_ptr< AbstractViewItemDragController > create_drag_controller () const
AbstractView & get_view () const
ui::ButtonViewItem * view_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_hovered () const
bool is_active () const
bool is_selected () const
bool is_search_highlight () const
bool is_renaming () const
void begin_renaming ()
void end_renaming ()
void rename_apply (const bContext &C)
virtual void delete_item (bContext *C)
bool is_filtered_visible () const
Public Member Functions inherited from blender::ui::TreeViewItemContainer
template<class ItemT, typename... Args>
ItemT & add_tree_item (Args &&...args)
AbstractTreeViewItem & add_tree_item (std::unique_ptr< AbstractTreeViewItem > item)

Additional Inherited Members

Public Types inherited from blender::ui::TreeViewItemContainer
enum class  IterOptions { None = 0 , SkipCollapsed = 1 << 0 , SkipFiltered = 1 << 1 }
using ItemIterFn = FunctionRef<void(AbstractTreeViewItem &)>
Public Attributes inherited from blender::AssetLibraryListItemCommon
AnyAssetLibraryDefinition library
int index_in_list = 0
Protected Member Functions inherited from blender::ui::AbstractTreeViewItem
StringRef get_rename_string () const override
virtual bool supports_collapsing () const
void toggle_collapsed_from_view (bContext &C)
void change_state_delayed () override
bool matches (const AbstractViewItem &other) const override
void update_from_old (const AbstractViewItem &old) override
bool should_be_filtered_visible (StringRefNull filter_string) const override
void ensure_parents_uncollapsed ()
Protected Member Functions inherited from blender::ui::AbstractViewItem
 AbstractViewItem ()=default
void add_rename_button (Block &block)
Protected Member Functions inherited from blender::ui::TreeViewItemContainer
void foreach_item_recursive (ItemIterFn iter_fn, IterOptions options=IterOptions::None) const
void foreach_parent (ItemIterFn iter_fn) const
void sort_alpha ()
void foreach_sort_invert (TreeViewSortOrder order)
Protected Attributes inherited from blender::ui::AbstractTreeViewItem
std::string label_
Protected Attributes inherited from blender::ui::AbstractViewItem
AbstractView * view_ = nullptr
ui::ButtonViewItem * view_item_but_ = nullptr
bool is_activatable_ = true
bool is_interactive_ = true
bool is_hovered_ = false
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
Protected Attributes inherited from blender::ui::TreeViewItemContainer
Vector< std::unique_ptr< AbstractTreeViewItem > > children_
TreeViewItemContainer * root_ = nullptr
AbstractTreeViewItem * parent_ = nullptr
bool is_flat_ = false

Detailed Description

The collapsible row grouping the libraries of an extension repository.

Definition at line 214 of file userpref_asset_libraries_list.cc.

Member Function Documentation

◆ build_row()

◆ matches_single()

bool blender::AssetLibraryRepoItem::matches_single ( const ui::AbstractTreeViewItem & other) const
inlineoverridevirtual

Compare this item to other to check if they represent the same data. Used to recognize an item from a previous redraw, to be able to keep its state (e.g. open/closed, active, etc.). Items are only matched if their parents also match. By default this just matches the item's label (if the parents match!). If that isn't good enough for a sub-class, that can override it.

TODO matches_single() is a rather temporary name, used to indicate that this only compares the item itself, not the parents. Item matching is expected to change quite a bit anyway.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 231 of file userpref_asset_libraries_list.cc.

◆ on_collapse_change()

void blender::AssetLibraryRepoItem::on_collapse_change ( bContext & C,
const bool is_collapsed )
inlineoverridevirtual

Called when the view changes an item's state from expanded to collapsed, or vice versa. 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_collapsed() to reflect an external state change does not.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 256 of file userpref_asset_libraries_list.cc.

References C, blender::ui::AbstractTreeViewItem::is_collapsed(), blender::RNA_pointer_create_discrete(), blender::RNA_property_boolean_set(), blender::RNA_property_update(), and blender::RNA_struct_find_property().

◆ set_collapsed()

bool blender::AssetLibraryRepoItem::set_collapsed ( const bool collapsed)
inlineoverridevirtual

Expand or collapse this tree view item.

Note
this does not call on_collapse_change().
Returns
true when the collapsed state was changed, false otherwise.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 244 of file userpref_asset_libraries_list.cc.

References SET_FLAG_FROM_TEST, and blender::USER_EXTENSION_REPO_FLAG_ASSET_LIBRARIES_COLLAPSED.

◆ should_be_collapsed()

std::optional< bool > blender::AssetLibraryRepoItem::should_be_collapsed ( ) const
inlineoverridevirtual

If the result is not empty, it controls whether the item should be collapsed or not, usually depending on the data that the view represents.

Reimplemented from blender::ui::AbstractTreeViewItem.

Definition at line 238 of file userpref_asset_libraries_list.cc.

References blender::bUserExtensionRepo::flag, and blender::USER_EXTENSION_REPO_FLAG_ASSET_LIBRARIES_COLLAPSED.


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