GPv3: Stroke Simplify operator #110266

Merged
Falk David merged 13 commits from filedescriptor/blender:gpv3-stroke-simplify into main 2023-07-20 15:31:57 +02:00
Member

This adds the stroke_simplify operators.

It also implements the ramer_douglas_peucker_simplify core function.

This adds the `stroke_simplify` operators. It also implements the `ramer_douglas_peucker_simplify` core function.
Falk David requested review from Amélie Fondevilla 2023-07-19 17:12:58 +02:00
Falk David added this to the Grease Pencil project 2023-07-19 17:13:10 +02:00

Looks good to me. I only have two remarks.

  1. It looks like the case of cyclic curve is not dealt with.

simplify_cyclic-annotated.png

In this image for example if the curve is cyclic, the last point won't be deleted, even though the last segment (3,4) is aligned with the closing segment (4,0). It's very specific though 😅 .

  1. It seems like some variable could be const. I'll try to comment them directly on the code.
Looks good to me. I only have two remarks. 1) It looks like the case of cyclic curve is not dealt with. ![simplify_cyclic-annotated.png](/attachments/b5cc21a9-23b3-4275-bd26-e8e9e902cf00) In this image for example if the curve is cyclic, the last point won't be deleted, even though the last segment (3,4) is aligned with the closing segment (4,0). It's very specific though 😅 . 2) It seems like some variable could be const. I'll try to comment them directly on the code.
Amélie Fondevilla requested changes 2023-07-19 18:10:24 +02:00
@ -394,0 +419,4 @@
Stack<IndexRange> stack;
stack.push(src.index_range());
while (!stack.is_empty()) {
IndexRange range = stack.pop();

const IndexRange range = stack.pop();

`const IndexRange range = stack.pop();`
filedescriptor marked this conversation as resolved
@ -394,0 +420,4 @@
stack.push(src.index_range());
while (!stack.is_empty()) {
IndexRange range = stack.pop();
Span<float3> slice = src.slice(range);

const Span<float3> slice = src.slice(range);

`const Span<float3> slice = src.slice(range);`
filedescriptor marked this conversation as resolved
@ -394,0 +470,4 @@
const Span<float3> positions = curves.positions();
const OffsetIndices points_by_curve = curves.points_by_curve();
VArray<bool> selection = *curves.attributes().lookup_or_default<bool>(

const VArray<bool> selection = *curves.attributes().lookup_or_default<bool>( ".selection", ATTR_DOMAIN_POINT, true);

`const VArray<bool> selection = *curves.attributes().lookup_or_default<bool>( ".selection", ATTR_DOMAIN_POINT, true);`

const VArray<bool> &selection = *curves.attributes().lookup_or_default<bool>( ".selection", ATTR_DOMAIN_POINT, true);
Avoid to do extra copy/user counter increment.

`const VArray<bool> &selection = *curves.attributes().lookup_or_default<bool>( ".selection", ATTR_DOMAIN_POINT, true);` Avoid to do extra copy/user counter increment.
filedescriptor marked this conversation as resolved
@ -394,0 +484,4 @@
continue;
}
Vector<IndexRange> selection_ranges = array_utils::find_all_ranges(curve_selection,

const Vector<IndexRange> selection_ranges = array_utils::find_all_ranges(curve_selection, true);

`const Vector<IndexRange> selection_ranges = array_utils::find_all_ranges(curve_selection, true);`
filedescriptor marked this conversation as resolved
Falk David force-pushed gpv3-stroke-simplify from 842300c05a to a08d050ab0 2023-07-20 14:05:31 +02:00 Compare
Falk David force-pushed gpv3-stroke-simplify from a08d050ab0 to 021029eb16 2023-07-20 14:46:49 +02:00 Compare
Falk David added 1 commit 2023-07-20 15:30:12 +02:00
Falk David merged commit 7cd5e25743 into main 2023-07-20 15:31:57 +02:00
Falk David deleted branch gpv3-stroke-simplify 2023-07-20 15:31:59 +02:00
Amélie Fondevilla approved these changes 2023-07-20 16:02:25 +02:00
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#110266
No description provided.