Cleanup: Perform cleanup on sculpt_automasking.cc #117651

Merged
Hans Goudey merged 4 commits from Sean-Kim/blender:cleanup-automask into main 2024-01-31 21:43:12 +01:00
Member
  • Adds documentation / comments
  • Applies const where possible to cache_init function codepath
  • Minor cleanup of conditionals and initialization

Contains changes that were deferred from #117316

* Adds documentation / comments * Applies const where possible to cache_init function codepath * Minor cleanup of conditionals and initialization Contains changes that were deferred from #117316
Sean Kim added 1 commit 2024-01-29 23:36:51 +01:00
* Adds documentation / comments
* Applies const where possible to cache_init function
* Minor cleanup of conditionals and initialization
Sean Kim requested review from Hans Goudey 2024-01-29 23:37:17 +01:00
Hans Goudey requested changes 2024-01-30 04:03:50 +01:00
Hans Goudey left a comment
Member

Thanks for the cahnges. I'm still being a bit picky inline, so we can align on cleanup goals, etc.

Thanks for the cahnges. I'm still being a bit picky inline, so we can align on cleanup goals, etc.
@ -205,2 +205,4 @@
}
/* TODO: Unsure why the BRUSH_AUTOMASKING_VIEW_NORMAL mode requires a check against the
* propagation steps variable. This can probably be limited to checking if the brush itself
Member

TBH I'm not too convinced by adding a TODO comment in a cleanup commit. This is more likely to become outdated, and maybe better handled as a discussion in chat or another PR that tries removing this.

TBH I'm not too convinced by adding a TODO comment in a cleanup commit. This is more likely to become outdated, and maybe better handled as a discussion in chat or another PR that tries removing this.
Sean-Kim marked this conversation as resolved
@ -1290,0 +1291,4 @@
* For automasking modes that cannot be calculated in real time,
* data is also stored at the vertex level prior to the stroke starting.
*
* \param sd: the sculpt tool
Member

Typically we won't add descriptions for parameters that are "obvious". IMO they just add noise. I would just remove the "param" and "return" comments here. The "brush can be null" part is better "documented" by making every non-null pointer into a reference

Typically we won't add descriptions for parameters that are "obvious". IMO they just add noise. I would just remove the "param" and "return" comments here. The "brush can be null" part is better "documented" by making every non-null pointer into a reference
Author
Member

I'll remove the boilerplate parameters - for the non-null pointer to reference, do you just mean changing the callers to be cache_init(s, &brush, ... ) and cache_init(s, nullptr, ...)?

I'll remove the boilerplate parameters - for the non-null pointer to reference, do you just mean changing the callers to be `cache_init(s, &brush, ... )` and `cache_init(s, nullptr, ...)`?
Member

Yeah, that sounds good. Could be done here or later, as part of a more general "Use references instead of pointers in sculpt code" cleanup

Yeah, that sounds good. Could be done here or later, as part of a more general "Use references instead of pointers in sculpt code" cleanup
Author
Member

I suppose an alternate option would be to have some form of overload:

std::unique_ptr<Cache> cache_init(const Sculpt *sd, Object *ob);
std::unique_ptr<Cache> cache_init(const Sculpt *sd, const Brush *brush, Object *ob);

Where the former method just passes in nullptr to the latter. I'm mainly thinking about this from the POV of someone working on the sculpt_automasking.cc file where it may not be obvious that the null checks are required for brush but not sd

I suppose an alternate option would be to have some form of overload: ``` std::unique_ptr<Cache> cache_init(const Sculpt *sd, Object *ob); std::unique_ptr<Cache> cache_init(const Sculpt *sd, const Brush *brush, Object *ob); ``` Where the former method just passes in `nullptr` to the latter. I'm mainly thinking about this from the POV of someone working on the `sculpt_automasking.cc` file where it may not be obvious that the null checks are required for `brush` but not `sd`
Member

An overload seems even better!

An overload seems even better!
Sean-Kim marked this conversation as resolved
Sean Kim added 2 commits 2024-01-31 20:16:45 +01:00
Sean Kim requested review from Hans Goudey 2024-01-31 20:18:01 +01:00
Author
Member

Oh, I just realized I didn't change the callers; ignore review request for a bit.

Edit: updated

~~Oh, I just realized I didn't change the callers; ignore review request for a bit.~~ Edit: updated
Sean Kim added 1 commit 2024-01-31 20:22:06 +01:00
Update callers of automask::cache_init
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
df9490c0b5
Hans Goudey approved these changes 2024-01-31 20:27:26 +01:00
Member

@blender-bot build

@blender-bot build
Hans Goudey merged commit b0063a4690 into main 2024-01-31 21:43:12 +01:00
Sean Kim deleted branch cleanup-automask 2024-01-31 22:47:32 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
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 project
No Assignees
2 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#117651
No description provided.