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
Member

Don't use a keymap for the asset shelf to activate brushes; there's no
need to recreate basic UI interaction at this level. Instead use an
operator button so the ability to add a shortcut is automaticaly added
by other UI code.

Also change the operator to use an explicit asset reference instead of
the "context asset". This was already done for other operators that add
data-blocks from assets.


image

Don't use a keymap for the asset shelf to activate brushes; there's no need to recreate basic UI interaction at this level. Instead use an operator button so the ability to add a shortcut is automaticaly added by other UI code. Also change the operator to use an explicit asset reference instead of the "context asset". This was already done for other operators that add data-blocks from assets. --- ![image](/attachments/8182daaf-197e-44a9-bcd1-ba950d81d580)
Hans Goudey added 11 commits 2024-02-05 17:51:34 +01:00
Hans Goudey requested review from Julian Eisel 2024-02-05 17:51:54 +01:00
Hans Goudey added this to the Brush Assets & Asset Shelf project 2024-02-05 17:52:01 +01:00
Brecht Van Lommel reviewed 2024-02-05 19:05:25 +01:00
Brecht Van Lommel left a comment
Owner

Great, just one minor comment.

Great, just one minor comment.
@ -214,0 +211,4 @@
const AssetShelfType &shelf_type = *asset_view.shelf_.type;
wmOperatorType *ot = WM_operatortype_find(shelf_type.activate_operator.c_str(), false);
PointerRNA op_props;
WM_operator_properties_create_ptr(&op_props, ot);

This function does not check if ot is null (but WM_operator_properties_create does check).

This function does not check if `ot` is null (but `WM_operator_properties_create` does check).
HooglyBoogly marked this conversation as resolved
Julian Eisel reviewed 2024-02-07 11:19:33 +01:00
Julian Eisel left a comment
Member

I think wit

I think wit
@ -207,0 +208,4 @@
/**
* \note: Takes ownership of the operator properies defined in \a op_props.
*/
void build_grid_tile_button(uiLayout &layout,
Member

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.
HooglyBoogly marked this conversation as resolved
@ -1005,0 +998,4 @@
const asset_system::AssetRepresentation *asset =
asset::operator_asset_reference_props_get_asset_from_all_library(*C, *op->ptr, op->reports);
if (!asset) {
return OPERATOR_CANCELLED;
Member

Best do some report so this doesn't just fail silently.

Best do some report so this doesn't just fail silently.
Author
Member

operator_asset_reference_props_get_asset_from_all_library handles the reports already

`operator_asset_reference_props_get_asset_from_all_library` handles the reports already
Hans Goudey added 3 commits 2024-02-07 18:44:48 +01:00
Hans Goudey added 1 commit 2024-02-07 19:00:54 +01:00
Hans Goudey merged commit 44b80df241 into brush-assets-project 2024-02-07 19:02:47 +01:00
Hans Goudey deleted branch brush-assets-shortcut 2024-02-07 19:02:54 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117861
No description provided.