GPv3: Clean Loose Points #113599

Closed
opened 2023-10-12 14:08:39 +02:00 by Pratik Borhade · 2 comments
Member

Clear stroke from the viewport if stroke points are less than or equal to operator "limit" value

  • Define GREASE_PENCIL_OT_frame_clean_loose operator in grease_pencil_edit.cc
  • Create new operator property "limit" (same as legacy GP)
  • Iterate through all the drawings at current scene frame (foreach_editable_drawing)
    • Get geometry of this drawing: bke::CurvesGeometry &curves = drawing.strokes_for_write();
    • Iterate through all the curves present in this drawing (use curves.curves_range())
      • Get points count of individual curve: curves.points_by_curve()[curve_index].size()
      • Delete curve when points in single curve are <= limit (CurvesGeometry::remove_curves())
  • Send dependency graph update and send notifiers to other editors
Clear stroke from the viewport if stroke points are less than or equal to operator "limit" value - Define `GREASE_PENCIL_OT_frame_clean_loose` operator in `grease_pencil_edit.cc` - Create new operator property "limit" (same as legacy GP) - Iterate through all the drawings at current scene frame (`foreach_editable_drawing`) - Get geometry of this drawing: `bke::CurvesGeometry &curves = drawing.strokes_for_write();` - Iterate through all the curves present in this drawing (`use curves.curves_range()`) - Get points count of individual curve: `curves.points_by_curve()[curve_index].size()` - Delete curve when points in single curve are <= limit (`CurvesGeometry::remove_curves()`) - Send dependency graph update and send notifiers to other editors
Pratik Borhade added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-10-12 14:08:40 +02:00
Pratik Borhade added
Module
Grease Pencil
Type
To Do
and removed
Status
Needs Triage
Type
Report
labels 2023-10-12 14:36:05 +02:00
Pratik Borhade added this to the Grease Pencil project 2023-10-12 14:36:23 +02:00
Member

Nice! Two things I'd point out:

  • This should probably work within the existing curves selection, which can be retrieved as an index mask with some existing utilities
  • There's a utility to create an index mask based on a predicate, IndexMask::from_predicate which should help make it just a few lines to select all the single-point curves
Nice! Two things I'd point out: - This should probably work within the existing curves selection, which can be retrieved as an index mask with some existing utilities - There's a utility to create an index mask based on a predicate, `IndexMask::from_predicate` which should help make it just a few lines to select all the single-point curves
Author
Member

Thanks @HooglyBoogly

This should probably work within the existing curves selection, which can be retrieved as an index mask with some existing utilities

AFAICS legacy GP considers all strokes (not selected) available at the current frame.

Thanks @HooglyBoogly > This should probably work within the existing curves selection, which can be retrieved as an index mask with some existing utilities AFAICS legacy GP considers all strokes (not selected) available at the current frame.
Pratik Borhade self-assigned this 2023-11-27 13:03:29 +01:00
Blender Bot added the
Status
Resolved
label 2023-12-08 16:53:25 +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 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#113599
No description provided.