GPv3: Soft mode for the Eraser tool #110310

Open
Amélie Fondevilla wants to merge 57 commits from amelief/blender:gpv3-erase-operator-soft-mode into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Implementation of the soft mode of the eraser tool for grease pencil.
In this mode, the eraser decreases the opacity of the points it hits. The new opacity is computed as a minimum between the current opacity and a linear falloff function of the distance of the point to the center of the eraser.
If the opacity of a point falls below a threshold, then the point is removed from the curves.

Implementation of the soft mode of the eraser tool for grease pencil. In this mode, the eraser decreases the opacity of the points it hits. The new opacity is computed as a minimum between the current opacity and a linear falloff function of the distance of the point to the center of the eraser. If the opacity of a point falls below a threshold, then the point is removed from the curves.
Amélie Fondevilla added this to the Grease Pencil project 2023-07-20 18:17:00 +02:00
Amélie Fondevilla requested review from Falk David 2023-07-20 18:17:08 +02:00
First-time contributor

to confirm, when we reach the threshold , is it creates the new points at the edge of the eraser gizmo? or it create points inside of it ? and thanks for your works, hope enjoy it

to confirm, when we reach the threshold , is it creates the new points at the edge of the eraser gizmo? or it create points inside of it ? and thanks for your works, hope enjoy it
Author
Member

to confirm, when we reach the threshold , is it creates the new points at the edge of the eraser gizmo? or it create points inside of it ? and thanks for your works, hope enjoy it

No, right now it only deletes the points that are transparent, and splits the curve accordingly.
Ideally, we would add new points in between at the positions where the opacity is at the threshold.
I don't think we can have that for this PR thought.

> to confirm, when we reach the threshold , is it creates the new points at the edge of the eraser gizmo? or it create points inside of it ? and thanks for your works, hope enjoy it No, right now it only deletes the points that are transparent, and splits the curve accordingly. Ideally, we would add new points in between at the positions where the opacity is at the threshold. I don't think we can have that for this PR thought.
Amélie Fondevilla changed title from WIP: GPv3: Soft mode for the Eraser tool to GPv3: Soft mode for the Eraser tool 2023-07-21 13:00:38 +02:00
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 9945798049 to 01e3378a1a 2023-08-03 10:39:22 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 01e3378a1a to 6d78ae7632 2023-08-07 12:52:53 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 6d78ae7632 to 822a302812 2023-08-07 15:37:51 +02:00 Compare
casey-bianco-davis reviewed 2023-08-14 04:47:28 +02:00
@ -577,0 +648,4 @@
for (const int src_point : src_points) {
src_remove_point[src_point] = (src_new_opacity[src_point] < opacity_threshold);
}
});

Maybe this could be split into a CurvesGeometry function that takes a IndexMask and handles the point deleting and the topological changes, and soft_eraser only needs to handle the opacity.
something like

IndexMaskMemory memory;
IndexMask points_to_delete = IndexMask::from_bools(src_remove_point, memory);

dst = delete_points(src, points_to_delete);
Maybe this could be split into a `CurvesGeometry` function that takes a `IndexMask` and handles the point deleting and the topological changes, and `soft_eraser` only needs to handle the opacity. something like ``` IndexMaskMemory memory; IndexMask points_to_delete = IndexMask::from_bools(src_remove_point, memory); dst = delete_points(src, points_to_delete); ```
Author
Member

Yes, that is one idea I have for refactoring the eraser in all modes. Right now, this PR is still pending because we would like to improve a bit the behavior of the soft eraser, so that it inserts points to respect at best the falloff and the radius of the brush tool.
The thing is, if we want to both insert and remove points, it would be best to do it in one pass, because we are going to re-build a new CurvesGeometry in both cases. So maybe this function would be more like dst = insert_and_delete(src, points_to_delete, points_to_insert) (or something similar).
I agree with you that this is going to need a refactor, with the hard eraser mode as well.

Yes, that is one idea I have for refactoring the eraser in all modes. Right now, this PR is still pending because we would like to improve a bit the behavior of the soft eraser, so that it inserts points to respect at best the falloff and the radius of the brush tool. The thing is, if we want to both insert and remove points, it would be best to do it in one pass, because we are going to re-build a new CurvesGeometry in both cases. So maybe this function would be more like `dst = insert_and_delete(src, points_to_delete, points_to_insert)` (or something similar). I agree with you that this is going to need a refactor, with the hard eraser mode as well.
casey-bianco-davis marked this conversation as resolved
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 822a302812 to 858b552edd 2023-08-14 10:53:20 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 858b552edd to 94ec1fae71 2023-08-16 14:38:04 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 94ec1fae71 to a45ba83bab 2023-08-22 16:01:55 +02:00 Compare
Amélie Fondevilla added a new dependency 2023-08-22 16:12:31 +02:00
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 0e68d7f01e to bd31070d53 2023-08-22 17:06:21 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from fc56c01c2c to d0ad35a692 2023-08-23 12:35:45 +02:00 Compare
Amélie Fondevilla force-pushed gpv3-erase-operator-soft-mode from 97e9f5a739 to 94e6621f42 2023-08-23 14:30:10 +02:00 Compare
Amélie Fondevilla added 3 commits 2023-08-23 14:36:29 +02:00
Amélie Fondevilla removed a dependency 2023-08-23 14:37:59 +02:00
This pull request has changes conflicting with the target branch.
  • scripts/startup/bl_ui/space_toolsystem_toolbar.py
  • source/blender/editors/sculpt_paint/grease_pencil_erase.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u gpv3-erase-operator-soft-mode:amelief-gpv3-erase-operator-soft-mode
git checkout amelief-gpv3-erase-operator-soft-mode
Sign in to join this conversation.
No reviewers
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
3 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#110310
No description provided.