Brush Assets: Support adding shortcut to asset shelf items #117861

Merged
Hans Goudey merged 15 commits from HooglyBoogly/blender:brush-assets-shortcut into brush-assets-project 2024-02-07 19:02:47 +01:00
3 changed files with 6 additions and 6 deletions
Showing only changes of commit 3ef7652fdd - Show all commits

View File

@ -217,7 +217,7 @@ void AssetViewItem::build_grid_tile(uiLayout &layout) const
asset::operator_asset_reference_props_set(*handle_get_representation(&asset_), op_props);
}
ui::PreviewGridItem::build_grid_tile_button(layout, ot, op_props);
ui::PreviewGridItem::build_grid_tile_button(layout, ot, &op_props);
}
void AssetViewItem::build_context_menu(bContext &C, uiLayout &column) const

View File

@ -209,8 +209,8 @@ class PreviewGridItem : public AbstractGridViewItem {
* \note: Takes ownership of the operator properies defined in \a op_props.
*/
void build_grid_tile_button(uiLayout &layout,
HooglyBoogly marked this conversation as resolved
Review

Would add default arguments for convenience, but also to simply communicate that these are optional.

Would add default arguments for convenience, but also to simply communicate that these are optional.
const wmOperatorType *ot,
const PointerRNA &op_props) const;
const wmOperatorType *ot = nullptr,
const PointerRNA *op_props = nullptr) const;
/**
* Set a custom callback to execute when activating this view item. This way users don't have to

View File

@ -413,7 +413,7 @@ PreviewGridItem::PreviewGridItem(StringRef identifier, StringRef label, int prev
void PreviewGridItem::build_grid_tile_button(uiLayout &layout,
const wmOperatorType *ot,
const PointerRNA &op_props) const
const PointerRNA *op_props) const
{
const GridViewStyle &style = this->get_view().get_style();
uiBlock *block = uiLayoutGetBlock(&layout);
@ -430,7 +430,7 @@ void PreviewGridItem::build_grid_tile_button(uiLayout &layout,
style.tile_width,
style.tile_height,
"");
but->opptr = MEM_new<PointerRNA>(__func__, op_props);
but->opptr = MEM_new<PointerRNA>(__func__, *op_props);
}
else {
but = uiDefBut(block,
@ -465,7 +465,7 @@ void PreviewGridItem::build_grid_tile_button(uiLayout &layout,
void PreviewGridItem::build_grid_tile(uiLayout &layout) const
{
this->build_grid_tile_button(layout, nullptr, {});
this->build_grid_tile_button(layout);
}
void PreviewGridItem::set_on_activate_fn(ActivateFn fn)