Refactor: Tools: Change how tools are marked as using brushes #125911

Merged
Julian Eisel merged 7 commits from JulianEisel/blender:temp-brush-asset-tool-brush-flag into main 2024-09-16 12:20:41 +02:00
Member

The previous way of considering tools with the data_block member set
as using brushes was rather unclear/confusing, but also a bit outdated
with the brush assets changes. Since then most sculpt/paint modes use a
unified brush tool, there was no tool for every brush type (aka brush
tool) anymore. So now the data_block member was just set dynamically to
match the active brush type which is otherwise irrelevant to the tool
system now.

Further, this will become important to bring back some of the tools that
use brushes in grease pencil draw mode, see #116337. For that we want to
keep the unified brush tool, but still allow other tools that only use a
specific brush type. So marking a tool as using brushes should be done
separatly from indicating a specific brush type.

Removing/replacing the data_block member should happen separately
still, pending further developments (e.g. see #125449).

The previous way of considering tools with the `data_block` member set as using brushes was rather unclear/confusing, but also a bit outdated with the brush assets changes. Since then most sculpt/paint modes use a unified brush tool, there was no tool for every brush type (aka brush tool) anymore. So now the `data_block` member was just set dynamically to match the active brush type which is otherwise irrelevant to the tool system now. Further, this will become important to bring back some of the tools that use brushes in grease pencil draw mode, see #116337. For that we want to keep the unified brush tool, but still allow other tools that only use a specific brush type. So marking a tool as using brushes should be done separatly from indicating a specific brush type. Removing/replacing the `data_block` member should happen separately still, pending further developments (e.g. see #125449).
Julian Eisel added 1 commit 2024-08-05 19:13:23 +02:00
Refactor: Tools: Change how tools are marked as using brushes
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
f0139e7169
The previous way of considering tools with the `data_block` member set
as using brushes was rather unclear/confusing, but also a bit outdated
with the brush assets changes. Since then most sculpt/paint modes use a
unified brush tool, there was no tool for every brush type (aka brush
tool) anymore. So now the `data_block` member was just set dynamically to
match the active brush type which is otherwise irrelevant to the tool
system now.

Further, this will become important to bring back some of the tools that
use brushes in grease pencil draw mode, see #116337. For that we want to
keep the unified brush tool, but still allow other tools that only use a
specific brush type. So marking a tool as using brushes should be done
separate from indicating a specific brush type.

Removing/replacing the `data_block` member should happen separately
still, pending further developments (e.g. see #125449).
Julian Eisel added this to the Brush Assets & Asset Shelf project 2024-08-05 19:13:28 +02:00
Julian Eisel requested review from Campbell Barton 2024-08-05 19:14:02 +02:00
Julian Eisel requested review from Hans Goudey 2024-08-05 19:14:20 +02:00
Author
Member

@blender-bot build

@blender-bot build
Julian Eisel added 1 commit 2024-08-05 19:19:18 +02:00
Julian Eisel added 1 commit 2024-09-05 18:11:01 +02:00
Hans Goudey approved these changes 2024-09-05 18:41:43 +02:00
Hans Goudey left a comment
Member

Looks good! Removing generate_from_brushes seemed a bit too complicated for me before, so it's great to have it replaced by something more explicit.

Looks good! Removing `generate_from_brushes` seemed a bit too complicated for me before, so it's great to have it replaced by something more explicit.
Campbell Barton requested changes 2024-09-06 13:53:52 +02:00
Dismissed
Campbell Barton left a comment
Owner

Nice! Happy to see the data-block code go.

  • ./scripts/startup/bl_ui/space_image.py has one instance of has_datablock that looks like it should be replaced along with the other instances.
  • It would be good to note the use of data_block which is now only used as an ID for particle brushes.

Other notes inline.

Nice! Happy to see the data-block code go. - `./scripts/startup/bl_ui/space_image.py` has one instance of `has_datablock` that looks like it should be replaced along with the other instances. - It would be good to note the use of `data_block` which is now only used as an ID for particle brushes. Other notes inline.
@ -30,6 +30,7 @@ enum {
* Typically gizmos handle this but some tools (such as the knife tool) don't use a gizmo.
*/
TOOLREF_FLAG_FALLBACK_KEYMAP = (1 << 0),
TOOLREF_FLAG_USES_BRUSHES = (1 << 1),

See related comment, prefer: *_USE_BRUSH / *_USE_BRUSHES.

See related comment, prefer: `*_USE_BRUSH` / `*_USE_BRUSHES`.
JulianEisel marked this conversation as resolved
@ -300,2 +307,4 @@
RNA_def_property_ui_text(prop, "Has Data-Block", "");
RNA_def_property_boolean_funcs(prop, "rna_WorkSpaceTool_has_datablock_get", nullptr);
prop = RNA_def_property(srna, "uses_brushes", PROP_BOOLEAN, PROP_NONE);

Prefer use_brush or use_brushes. Mixing uses_ / use_ seems an unnecessary inconsistency which makes conventions harder to memorize.

Prefer `use_brush` or `use_brushes`. Mixing `uses_` / `use_` seems an unnecessary inconsistency which makes conventions harder to memorize.
JulianEisel marked this conversation as resolved
Julian Eisel added 1 commit 2024-09-06 14:18:17 +02:00
Julian Eisel requested review from Campbell Barton 2024-09-06 14:19:24 +02:00
Julian Eisel added 1 commit 2024-09-06 14:23:07 +02:00
Author
Member

Note that !125449 brings back a version of data_block, but it's just for the few tools meant for a specific brush type (like the grease pencil eraser or fill tools). I think I'll also change this already to use a new brush_type field, instead of data_block.

Note that !125449 brings back a version of `data_block`, but it's just for the few tools meant for a specific brush type (like the grease pencil eraser or fill tools). I think I'll also change this already to use a new `brush_type` field, instead of `data_block`.
Julian Eisel added 1 commit 2024-09-06 15:45:05 +02:00
Campbell Barton approved these changes 2024-09-11 07:16:32 +02:00
Julian Eisel added 1 commit 2024-09-16 12:18:51 +02:00
Julian Eisel merged commit b64bf66257 into main 2024-09-16 12:20:41 +02:00
Julian Eisel deleted branch temp-brush-asset-tool-brush-flag 2024-09-16 12:20:44 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#125911
No description provided.