Sculpt: Add dyntopo size edit support for BRUSH and RELATIVE modes #118403

Merged
Raul Fernandez Hernandez merged 3 commits from Sean-Kim/blender:108111-dynotopo-detail-size-edit into main 2024-02-21 14:24:54 +01:00
Contributor

This PR adds support for the SCULPT_OT_dyntopo_detail_size_edit operator for the Brush Detail and Relative Detail modes, replacing the old generic radial menu.

Changes

  • Triangle grid shown for all detailing modes
  • Support for modal left / right scaling and sampling added
  • Status bar updates with current value while editing the parameter.

dyntopo_edit.gif

Limitations

  • The brush size percent value is no longer shown in the 3D viewport when using this modal. This will be added with later functionality in #106243

Addresses #108111

This PR adds support for the `SCULPT_OT_dyntopo_detail_size_edit` operator for the `Brush Detail` and `Relative Detail` modes, replacing the old generic radial menu. ## Changes * Triangle grid shown for all detailing modes * Support for modal left / right scaling and sampling added * Status bar updates with current value while editing the parameter. ![dyntopo_edit.gif](/attachments/34b67621-4e6e-4960-9e23-0ea7b10fe2af) ## Limitations * The brush size percent value is no longer shown in the 3D viewport when using this modal. This will be added with later functionality in #106243 Addresses #108111
Sean Kim added 1 commit 2024-02-17 04:08:15 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
d76421d4fa
Sculpt: Add dyntopo size edit support for BRUSH and RELATIVE modes
Ref: \#108111
Sean Kim requested review from Julien Kaspar 2024-02-17 04:08:40 +01:00
Member

The general behavior works exactly like expected. Well done! 👍

But on my Linux computer I ran into a bug with the grid.

Screenshot_20240218_123939

To be fair, this has been an illusive bug that I wasn't able to consistently reproduce for years. I don't think there's an existing report.
Maybe this PR is causing this to persistently happen?
@Sean-Kim Did you encounter this issue in this PR?

The general behavior works exactly like expected. Well done! 👍 But on my Linux computer I ran into a bug with the grid. ![Screenshot_20240218_123939](/attachments/a040a1f5-8ba3-49e5-9e22-40c22d5eed61) To be fair, this has been an illusive bug that I wasn't able to consistently reproduce for years. I don't think there's an existing report. Maybe this PR is causing this to persistently happen? @Sean-Kim Did you encounter this issue in this PR?
Author
Contributor

@JulienKaspar - Didn't see this bug during my own testing of this. Can you get this to constantly happen on this mesh in a particular mode?

@JulienKaspar - Didn't see this bug during my own testing of this. Can you get this to constantly happen on this mesh in a particular mode?
Member

@Sean-Kim I can replicate it in all of the modes. I"ll try to avoid this bug and test it on Windows. I think it happens less there.

@blender-bot package

@Sean-Kim I can replicate it in all of the modes. I"ll try to avoid this bug and test it on Windows. I think it happens less there. @blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR118403) when ready.
Julien Kaspar added the
Module
Sculpt, Paint & Texture
label 2024-02-19 11:01:36 +01:00
Julien Kaspar added this to the Sculpt, Paint & Texture project 2024-02-19 11:01:42 +01:00
Author
Contributor

Strange, aside from calculating the max edge length for each of the other modes, the drawing code was untouched - aside from some conditional logic and variable renames the constant / manual detail modes drawing logic should be identical to the prior commit. From the picture you attached it looks like every line segment is somehow sharing one of its points.

Strange, aside from calculating the max edge length for each of the other modes, the drawing code was untouched - aside from some conditional logic and variable renames the constant / manual detail modes drawing logic should be identical to the prior commit. From the picture you attached it looks like every line segment is somehow sharing one of its points.
Member

Ok I tested it via the buildbot and now the visual bug is gone... must be something with my build then.

Overall it works great but the Relative detail mode has a delay in updating the grid scale.
After resizing the brush with F, it shows the wrong grid scale on R.

Screenshot_20240219_115923

After using the brush and pressing R again to show teh grid, it updated and now shows the correct grid scale.

Screenshot_20240219_115931

Ok I tested it via the buildbot and now the visual bug is gone... must be something with my build then. Overall it works great but the Relative detail mode has a delay in updating the grid scale. After resizing the brush with `F`, it shows the wrong grid scale on `R`. ![Screenshot_20240219_115923](/attachments/91532d93-ca49-4032-afc7-2c29b24dee5d) After using the brush and pressing `R` again to show teh grid, it updated and now shows the correct grid scale. ![Screenshot_20240219_115931](/attachments/d0d39603-c350-4fde-b638-9eacbc936504)
Julien Kaspar requested review from Raul Fernandez Hernandez 2024-02-19 12:02:33 +01:00
Julien Kaspar requested review from Sergey Sharybin 2024-02-19 12:02:33 +01:00
Raul Fernandez Hernandez reviewed 2024-02-19 15:24:30 +01:00
@ -501,0 +526,4 @@
}
else {
object_space_constant_detail = (cd->brush_radius / cd->pixel_radius) *
(cd->current_value * U.pixelsize) / 0.4f;

I would suggest that the magic numbers that are not obvious (/ 0.4f) should have a const meaningful name for future reference.

I would suggest that the magic numbers that are not obvious (/ 0.4f) should have a const meaningful name for future reference.
Author
Contributor

Good point, will do.

Good point, will do.
Author
Contributor

Found the commit that added it: e659cfdaf7 - I suppose I'll change this to something like relative_scale_factor and update the other value in sculpt.cc in a subsequent commit along with some other deduplication to consolidate this logic.

Found the commit that added it: `e659cfdaf7` - I suppose I'll change this to something like `relative_scale_factor` and update the other value in `sculpt.cc` in a subsequent commit along with some other deduplication to consolidate this logic.
Sean-Kim marked this conversation as resolved
Raul Fernandez Hernandez approved these changes 2024-02-19 15:57:45 +01:00
Member

Some magic numbers will benefit from having const meaningful_names for future reference.

Some magic numbers will benefit from having const meaningful_names for future reference.
Sean Kim added 1 commit 2024-02-20 03:35:34 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
1767b503a7
Address PR comments
Raul Fernandez Hernandez approved these changes 2024-02-20 04:23:32 +01:00
Author
Contributor

@JulienKaspar - the issue with relative scaling should be fixed now.

@JulienKaspar - the issue with relative scaling should be fixed now.
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR118403) when ready.
Julien Kaspar approved these changes 2024-02-20 12:13:36 +01:00
Julien Kaspar left a comment
Member

Works exactly as expected now. Great work!

Works exactly as expected now. Great work!
Sergey Sharybin approved these changes 2024-02-20 19:06:29 +01:00
Sergey Sharybin left a comment
Owner

I did manage to reproduce the incorrect rendering, where triangle lines were all over the place, but it only happened once and I was not able to reproduce the issue since then.

There is some cosmetic change which would be nice to address to comply to the style guide. Maybe Sean Kim can address it, or Raul can ensure it is tackled before landing.

I don't think it worth having extra review iteration after that, so marking the patch as green.

I did manage to reproduce the incorrect rendering, where triangle lines were all over the place, but it only happened once and I was not able to reproduce the issue since then. There is some cosmetic change which would be nice to address to comply to the style guide. Maybe Sean Kim can address it, or Raul can ensure it is tackled before landing. I don't think it worth having extra review iteration after that, so marking the patch as green.
@ -596,0 +631,4 @@
static void dyntopo_detail_size_bounds(DyntopoDetailSizeEditCustomData *cd)
{
// TODO: Get range from RNA for these values?

Style: We use C-style comments, even in C++ code: /* ... */

Style: We use C-style comments, even in C++ code: `/* ... */`
Sean-Kim marked this conversation as resolved
Sean Kim added 1 commit 2024-02-20 23:58:32 +01:00

@Sean-Kim Thanks for addressing the comment style.

@farsthary Can you take care of landing the feature and adding it to the release notes?

@Sean-Kim Thanks for addressing the comment style. @farsthary Can you take care of landing the feature and adding it to the release notes?
Raul Fernandez Hernandez merged commit 28dae0c917 into main 2024-02-21 14:24:54 +01:00
Sean Kim deleted branch 108111-dynotopo-detail-size-edit 2024-02-21 23:36:24 +01:00
Sign in to join this conversation.
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
5 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#118403
No description provided.