GPv3: Clean loose points operator #115923
No reviewers
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115923
Loading…
Reference in New Issue
No description provided.
Delete Branch "PratikPB2123/blender:gpv3-clean-loose"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Similar to the legacy GP operator. Removes strokes with a number of points less than or equal to the "limit" property.
Resolves #113599.
Based on the code, this looks good. Just a few cleanup comments.
@ -1705,0 +1714,4 @@
threading::parallel_for_each(
drawings, [&](MutableDrawingInfo &info) {
bke::CurvesGeometry &curves = info.drawing.strokes_for_write();
if (curves.curves_num() == 0) {
This check should be unnecessary
@ -1705,0 +1725,4 @@
return points_by_curve[i].size() <= limit;
});
curves.remove_curves(curves_to_delete);
Looks like clang format is missing
@ -1705,0 +1721,4 @@
IndexMaskMemory memory;
const IndexMask curves_to_delete = IndexMask::from_predicate(
curves.curves_range(), GrainSize(4096), memory, [&](const int i) {
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
Retrieve
points_by_curve
outside of thefrom_predicate
loop. Such data access isn't necessarily cheap enough to do once per curveThanks @PratikPB2123 :) I have one comment
@ -1705,0 +1716,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
IndexMaskMemory memory;
const IndexMask curves_to_delete = IndexMask::from_predicate(
One thing I'm noticing here is that this ignores the
editable_strokes
. E.g. it will remove strokes even if they can't be edited. I think we should get both masks, then combine them, similar to how it's done inretrieve_editable_and_selected_strokes
usingBitVector
.Thanks for the review :)
Instead, can we just pass IndexMask from
retrieve_editable_strokes()
to the predicate?Haven't tried using the
universe
for this, but sure! If it works, then that's even better :)Yep, this is case for
universe
.@ -1705,0 +1742,4 @@
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna,
Looks like this isn't formatted.
One last comment. Otherwise looks good 👍
@ -1705,0 +1716,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
IndexMaskMemory memory;
const IndexMask editable_strokes = ed::greasepencil::retrieve_editable_strokes(
Put this above the
bke::CurvesGeometry &curves = ...
and addThe
is_empty
check is unnecessary. It should be redundant with checks inside offrom_predicate
andremove_curves
.Alright then
GPv3: Clean loose pointsto GPv3: Clean loose points operator@blender-bot build
@PratikPB2123 please run
make format
there are still linting issues (see https://builder.blender.org/admin/#/builders/210/builds/11).@blender-bot build
Thanks for reviewing and merging :)
Windows build failed though on buildbot : https://builder.blender.org/admin/#/builders/133/builds/2884
@PratikPB2123 It compiled the code but then failed before running the tests. So it was a buildbot issue. Since the tests ran fine on all the other platforms I assumed it's ok.