Page MenuHome

Curves: Add float selection in sculpt mode
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on May 12 2022, 9:06 AM.

Details

Summary

This commit adds a "soft" selection to curve control points,
a sculpt tool to paint the selection, and uses the selection influence
in the existing sculpt brushes.

The selection is the inverse of the "mask" from mesh sculpt mode
currently. That change is described in more detail here: T97903


Since some sculpt tools are really "per curve" tools, they use the average
point selection of all of their points. The delete brush considers a curve
selected if any of its points have a non-zero selection.

There is a new option to choose the selection domain, which affects how
painting the selection works. You can also turn the selection off by clicking
on the active domain.

The main limitation currently is that we can't see the selection in the viewport by default.
For now, to see the selection one has to add a simple material to the curves object as shown below.
And one has to switch to Material Preview in the 3d view.
Note, with the approach the automatic switch between point and curve selection preview does not work.

Old file from Hans:

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.May 12 2022, 9:06 AM
Hans Goudey (HooglyBoogly) created this revision.

It is a bit hard to test this since we don't see it, so so far I have only a few comments:

  1. We need an operator to select all/deselect all (with the expected shortcuts).
  2. The other selection modes (box and lasso) could be super useful as well. Either as part of this patch or as a separate one.
  3. I wonder we should have the Select Circle as a separate tool, or if this is the select circle (I'm at the moment more inclined to separate tools to be honest. The painting one you can worry about texture and whatnot, and we keep the circle one simpler).
  4. In which case we may want to call this "Select Paint"? (to go along with Select Box, Select Lasso).
  5. I think we need an option (for all selection tools) to pick between control-points or splines, until we can have them as separate selection modes (together with the root points).

PS: We will probably a notifier to show the updated selection in the viewport. But that can wait until we have proper support for
PPS: At the moment the .hidden_attribute is visible while I believe it shouldn't.

Note: I added two new icons to the icons file:

  • ops.generic.select_paint
  • ops.generic.select_line

They are in the Unused collection at the moment. The 'select paint' should be used for this tool.

For the records:

  1. We need an operator to select all/deselect all (with the expected shortcuts).

Right. in this update I've added A, Alt-A and Crtl-I shortcuts for the relevant functions. It's fast, but apparently mesh sculpt mode uses a pie menu for this. I think it's okay to be more similar to edit mode now though.

  1. The other selection modes (box and lasso) could be super useful as well. Either as part of this patch or as a separate one.

I looked into adding these, and it doesn't seem trivial, so I'd rather look into that with a separate patch.

  1. I wonder we should have the Select Circle as a separate tool, or if this is the select circle...

After some more discussion, I think we decided that just selection paint was okay for now, right?

  1. In which case we may want to call this "Select Paint"? (to go along with Select Box, Select Lasso).

No strong opinion about the name here, it's easy to change.

  1. I think we need an option (for all selection tools) to pick between control-points or splines, until we can have them as separate selection modes (together with the root points).

Actually, thinking about this a bit more, I think starting with adding the selection modes might be the easiest and most intuitive solution, regardless of how the data is actually stored.

  • Use icon from Dalai
  • Add (De)select All operator
  • Some cleanup
  • The performance of most brushes should improve significantly when a small selection is used
  • There are two selection modes, and conversion of selections between the two domains
  • Fix: Add the add brush back to the toolbar
  • Support painting curve domain selection in the selection paint brush

The one test I did ended in a crash, so I woudn't recommend using this yet.

Hans Goudey (HooglyBoogly) planned changes to this revision.May 17 2022, 7:34 PM

Needs to be tested properly before review.

We had another round of discussions about this feature:

  • Have only two selection domain/modes: control points and splines.
  • The None is no longer a mode but the modes can both be turned off.
  • Instead of using a toggle use Alt+1, Alt+2.
  • When switching to a tool or selection operator automatically turn the previous used mode on.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

This should include the proposed final behavior above, and the code is in a good enough state for review, except for the 1 and 2 shortcuts.

  • Add shortcuts for setting the selection domain and turning off the selection influence.
source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
344–345

re is wrong here.

Fixes, merge master, cleanup

Bug 1: If I have disabled one of the modes (e.g., control point mode) I cannot go back to it directly.

A. Press 2 to be in the splines mode.
B. Press Alt+2 to disable it.
C. Press 2 again, nothing happens.

(in order to re-able splines mode I need to first press 1 and then 2).

Bug 2: This should be also hidden if experimental Curve tools are disabled:

  • Disable access to .selection_* attributes in a procedural context.
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)
  • Merge branch 'master' into curves-float-selection
  • fix enabling selection
  • don't show selection items without experimental option

Just for the records we still need to hide the .selection_* attributes from the Spreadsheet Editor and the attributes panel in the Properties Editor.

Other than that the patch seems fine.

Note: I'm not totally convinced that the way we convert from control points to spline is the best (when user goes from 1 to 2). But we can adjust that once this lands in master. My original thought would be to set the spline to the highest value of any of the control points. Or the lower number even (it depends on what we settle when it comes to the boolean selection tools). I have a feeling that using the average as it is now is a bit strange when compared to the behaviour for the boolean selections (when going from 1 to 2 is fine, the other way around is fine).

  • Merge branch 'master' into curves-float-selection
  • hide selection attribute in spreadsheet

Hiding the attribute in the attributes panel is more tricky. Not sure if there is a good way to filter the list
without making attributes non-available from Python.

  • Cleanup, merge master

Found one issue, but other than that it looks good to me.

source/blender/editors/sculpt_paint/curves_sculpt_selection.cc
53 ↗(On Diff #52077)

points_num

This revision is now accepted and ready to land.May 31 2022, 6:30 PM