Page MenuHome

Sculpt: Dyntopo detail size edit operator
ClosedPublic

Authored by Pablo Dobarro (pablodp606) on Oct 27 2020, 12:21 AM.
Tags
None
Tokens
"Love" token, awarded by dlc17."100" token, awarded by shader."Love" token, awarded by dreadknight."Love" token, awarded by Shimoon."Love" token, awarded by mindinsomnia."Love" token, awarded by KINjO."100" token, awarded by tiagoffcruz."Love" token, awarded by jmztn."100" token, awarded by 616."100" token, awarded by blackviking."Love" token, awarded by erickblender."Love" token, awarded by JulienKaspar."100" token, awarded by MetinSeven."Love" token, awarded by 14AUDDIN."Love" token, awarded by sick."Love" token, awarded by thecavelap."Love" token, awarded by DaveDeer.

Details

Summary

This introduces a new operator to edit the detail size of constant
detail mode in dyntopo. The way this operator works and the
functionality it provides is similar to the "Voxel size edit" operator
for the voxel remesher.

It also includes a sample mode. When pressing Ctrl, the detail size
will be sampled from the surface under the cursor, updating the
preview in real time. This allows quick resolution changes without
using the operator multiple times.

The operator is set to Shift + D, replacing the old way to change
the constant detail size of dyntopo. Shift + R will remain available to
be enabled when the voxel remesher works with dyntopo. Deciding
if both detail sizes can be unified needs a separate discussion as the
new dyntopo can work with detail sizes in parts of the mesh that can
easily crash the remesher.

The structure of these operators is similar, but the data they control,
ranges, drawing and setup functions are completely different, making it
hard to merge them into one.

Diff Detail

Repository
rB Blender

Event Timeline

Pablo Dobarro (pablodp606) requested review of this revision.Oct 27 2020, 12:21 AM
Pablo Dobarro (pablodp606) created this revision.
Sergey Sharybin (sergey) requested changes to this revision.Oct 27 2020, 9:22 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/editors/sculpt_paint/sculpt.c
9398

d -> details_size_delta

9403

Reoccurring topic: magic constants without any explanation.

9406

Another magic constant.
Which here also reads as if it's double-accounted (first time was via special branch in the if (cd->slow_mode)).

The comment about what and when is to be accounted for is asked to be written ;)

9413

Quite sure there is more commonly used term for this. Julian?

9452–9461

A lot of math without explaining what the end goal is.

This revision now requires changes to proceed.Oct 27 2020, 9:22 AM
Pablo Dobarro (pablodp606) marked 4 inline comments as done.
  • Review Update
  • Improve grid preview edge size

Currently, it is not added to the keymap. It should be added with the

shortcut "Shift + R" to be consistent with the voxel remesher workflow,

but if it is done this way it conflicts with the keymap. Is there a way
to do this without merging the operators?

I m really glad to see some love on Dyntopo. For the keymap, the actual Dyntopo detail size shortcut is shift+d, it is clear that this patch implementation is user friendlier than the one in Master. I m voting to remove the old one and update the manual :)

  • Add Sample mode

If you want to go to a previous detail size that was used in the mesh, instead of dragging multiple times to match the wireframe with the preview you can now press Ctrl and it will sample that resolution directly.

  • Fix sample, add keymap entry
Pablo Dobarro (pablodp606) retitled this revision from [WIP] Sculpt: Dyntopo detail size edit operator to Sculpt: Dyntopo detail size edit operator.Oct 27 2020, 3:44 PM
Pablo Dobarro (pablodp606) edited the summary of this revision. (Show Details)
source/blender/editors/sculpt_paint/sculpt.c
9285
9419–9439

This seems independent enough and can easily be moved to a separate function.

Generally, always try to:

  • Keep vertical space low
  • One function to do one thing
Pablo Dobarro (pablodp606) marked an inline comment as done.
Pablo Dobarro (pablodp606) retitled this revision from Sculpt: Dyntopo detail size edit operator to Sculpt: Dyntopo detail size edit operator.
  • refactor modes into separate functions
source/blender/editors/sculpt_paint/sculpt.c
9410–9419

Seems like this scan be simplified to:

if (cd->slow_mode) {
  const float detail_size_delta = mval[0] - cd->slow_mval[0];
  cd->detail_size = cd->slow_detail_size + detail_size_delta * DETAIL_SIZE_DELTA_SLOW_SPEED;
}
else {
  const float detail_size_delta = mval[0] - cd->init_mval[0];
  cd->detail_size = cd->init_detail_size + detail_size_delta * DETAIL_SIZE_DELTA_SPEED;
}
Pablo Dobarro (pablodp606) marked an inline comment as done.
  • review update

From my side the only open question is about term slow. I remember accurate was used.
I'll let @Julian Eisel (Severin) to drop his 2c here as it is something way more reoccurring in the interface code.

Currently, it is not added to the keymap. It should be added with the

shortcut "Shift + R" to be consistent with the voxel remesher workflow,

but if it is done this way it conflicts with the keymap. Is there a way
to do this without merging the operators?

I m really glad to see some love on Dyntopo. For the keymap, the actual Dyntopo detail size shortcut is shift+d, it is clear that this patch implementation is user friendlier than the one in Master. I m voting to remove the old one and update the manual :)

Then we need the resolution/detail size on the widget, Personally i don't care about a pretty UI as long as i can read the number somewhere.
Currently this patch doesn't show it anywhere.

I don't know if it already works as is.
But it would be interesting to keep Brush Texture Overlay visible when this is working.

The transform operator uses "Accurate" for the keymap editing UI. I'd go with that.

  • rename slow to accurate

Think accurate was the last point in my list.

This revision is now accepted and ready to land.Oct 30 2020, 9:37 AM