Sculpt: Migrate Box Hide to common gesture code #119040
No reviewers
Labels
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 project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119040
Loading…
Reference in New Issue
No description provided.
Delete Branch "Sean-Kim/blender:migrate-hide-show"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR migrates the existing
PAINT_OT_hide_show
operator to the previously extractedgesture
namespace performed in #118881Changes
The current operator has support for choosing whether the hide / show action is performed on every vertex inside or outside the selection area. This has been added to the common gesture functionality too, but no common operator property has been exposed for it for the other Lasso / Box tools to use.
Previously, the
PAINT_OT_hide_show
operator handled three main cases (exposed as theVisArea
enum
):ALL
0.5
-MASKED
INSIDE
) or all unselected vertices (OUTSIDE
)The existing code has been refactored to handle the first two options separately from the selection usecase to more clearly delineate a separation of concerns.
Open Questions
Front Faces Only
setting that other box tools support?Testing
Box Hide
operator with bothINSIDE
andOUTSIDE
functionalityPrerequisite for #80390
I like where you're heading here, but I'm finding the code a bit more confusing now. I left some comments inline with ideas.
@ -277,1 +267,4 @@
static void partialvis_update_mesh(gesture::GestureData *gesture_data)
{
HideShowOperation *operation = (HideShowOperation *)gesture_data->operation;
Use C++
reinterpret_cast
rather than C-style casts@ -594,2 +666,3 @@
switch (pbvh_type) {
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh,
[&](PBVHNode & /* node */) { return true; });
You can just pas
{}
to gather all nodes.@ -650,9 +733,12 @@ void PAINT_OT_hide_show(wmOperatorType *ot)
ot->idname = "PAINT_OT_hide_show";
ot->description = "Hide/show some vertices";
/* Because this operator handles both interactive viewport functionality and predefined menu
This seems to make the code quite a bit more complicated honestly. It's sort of hard to understand the diff and the code when it mixes these things. Especially with all the switches with defaults now, it's hard to tell where everything is handled at a glance. What do you think about splitting this into more operators? Something like:
PAINT_OT_hide_masked
PAINT_OT_hide_all
More operators was my first idea, but I was worried if doing so would be a breaking change. I’ll work on splitting them up.
I can see it being confusing too because of the function naming, I’ll spend some time thinking about that as well.
@ -1671,6 +1671,11 @@ enum eShapeType {
SCULPT_GESTURE_SHAPE_LINE,
};
enum eSelectionType {
enum eSelectionType
->enum class SelectionType
And it can have
Inside
andOutside
as names. Combined with other changes I suggested, this could completely replaceVisArea
too.Really nice! Just a few small comments.
@ -276,0 +268,4 @@
vert_hide_update(*object, nodes, [&](const Span<int> verts, MutableSpan<bool> hide) {
for (const int i : verts.index_range()) {
if (gesture::is_affected(gesture_data, positions[verts[i]], normals[verts[i]]))
hide[i] = value;
Missing curly braces here. We use them around all if statements
@ -531,3 +518,1 @@
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
BoundBox bb;
ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, rect);
partialvis_update_bmesh_nodes(ob, nodes, action, {});
Rather than checking whether
should_update
is empty in the callback, maybe it's cleaner to pass[](const BMVert &vert) { return true; }
here. That way the price isn't payed for other tests where it isn't necessary@ -1671,6 +1671,11 @@ enum eShapeType {
SCULPT_GESTURE_SHAPE_LINE,
};
enum class eSelectionType {
Sorry this is a bit nitpicky, the
e
is something we want to move away from though, and they sort of just look better without all caps ;) I'll commit more cleanups to move in that directions in more of the surrounding code later.Oh, was unaware of the change in standards - I think the handbook style guide is a bit out of date with those regards then
What do you think about "hide_show_all" vs "hide_show_global"? I think it's a reasonable idea, but I didn't get used to "global" yet. It just has so many other connotations. "All" might be clear enough here.
Other than that, this looks good to go.
@blender-bot build
I was debating the same naming myself, I think
all
is fine,global
does imply that it would apply to multiple objects.Renamed the files and merged from main. I ran the tests locally and they should be passing on buildbot now, just get the usual expected failures due to running in developer mode. PR should be good to go now @HooglyBoogly
@blender-bot build
This test is failing in main too, I'll commit this now.