GPv3: Simplify Modifier #120018
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#120018
Loading…
Reference in New Issue
No description provided.
Delete Branch "filedescriptor/blender:gpv3-simplify-modifier"
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?
Implements the GPv2 simplify modifier.
TODO:
WIP: GPv3: Simplify Modifierto GPv3: Simplify Modifier@ -0,0 +1,430 @@
/* SPDX-FileCopyrightText: 2005 Blender Authors
Copyright year
@ -0,0 +138,4 @@
if (src_point_size == 0) {
return {};
}
OffsetIndices<int> points_by_curve = src_curves.points_by_curve();
Declare these const
@ -0,0 +169,4 @@
}
});
bke::CurvesGeometry dst_curves = bke::curves::copy_only_curve_domain(src_curves);
Create the curves above the counting, using
bke::curves::copy_only_curve_domain
, then fill in the offsets directly.Currently I think this is losing curve domain attributes
@ -0,0 +178,4 @@
offset_indices::accumulate_counts_to_offsets(dst_curves.offsets_for_write());
int merged_points = 0;
Array<int> src_to_dst_indices(src_point_size);
Any chance you could share this index manipulation with the point cloud merge by distance index manipulation? I remember that being a huge pain to get right, and it might be nice to avoid having to refactor it multiple times.
OTOH there's always the argument that sharing code with the legacy modifiers makes it harder to change, but maybe that's not so relevant here.
I would prefer a
curves_merge_by_distance
implementation in thegeometry
namespace then TBH. And I can work on that soonish when e.g. porting the edit mode operator to merge by distance.I would extract the index mapping code from the point cloud stuff and just use that here. It could be in a separate header, or in the same point cloud header. My main concern is just not duplicating all this tricky code, even if we hope it's only temporary.
I didn't look to see how much of a direct copy this was though, maybe you changed some parts of it?
It's mostly the same as far as I remember. I'll have a look at what could be reused and report back here.
Hm this will be tricky to share because of
merge_indices_per_curve
it looks like. The logic is sort of the same but has one more level of nesting.Okay, no need to force it, we can just leave it as is maybe. Thanks for checking.
@ -0,0 +274,4 @@
const bke::CurvesGeometry &curves = drawing.strokes();
const IndexMask strokes = modifier::greasepencil::get_filtered_stroke_mask(
&ob, curves, mmd.influence, memory);
Removing this newline is nice aesthetically since it puts the empty check right after the variable it's checking :)
@ -0,0 +282,4 @@
switch (mmd.mode) {
case MOD_GREASE_PENCIL_SIMPLIFY_FIXED: {
const IndexMask points_to_delete = simplify_fixed(curves, mmd.step, memory);
drawing.strokes_for_write().remove_points(points_to_delete, {});
If you have the energy, better to implement this in terms of
curves_copy_point_selection
to avoid theIndexMask
complement inside ofremove_points
.@ -0,0 +298,4 @@
break;
}
case MOD_GREASE_PENCIL_SIMPLIFY_SAMPLE: {
drawing.strokes_for_write() = std::move(geometry::resample_to_length(
No need to move an R-Value
@ -0,0 +314,4 @@
}
return false;
});
drawing.strokes_for_write() = std::move(
No need to
std::move
an R-value@ -0,0 +318,4 @@
curves_merge_by_distance(curves, mmd.distance, points, {}));
break;
}
default:
No need for the default here
@ -0,0 +329,4 @@
const ModifierEvalContext *ctx,
bke::GeometrySet *geometry_set)
{
auto *mmd = reinterpret_cast<GreasePencilSimplifyModifierData *>(md);
const
@ -0,0 +243,4 @@
for (const int dst_point_i : range) {
/* Create a separate mixer for every point to avoid allocating temporary buffers
* in the mixer the size of the result curves and to improve memory locality. */
bke::attribute_math::DefaultMixer<T> mixer{dst_attribute.span.slice(dst_point_i, 1)};
@HooglyBoogly @mod_moder had a comment here in the PR that was merged by mistake: #118546 (comment).
What do you think?
I think this is fine. It's using a size of one just to avoid unnecessary temporary array allocations. Maybe use an array is better but I wouldn't worry about it here.
Thanks for remaind, didn't understand the idea of merging pr and opening another one\
@blender-bot build