GPv3: Simplify modifier #118546
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#118546
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChengduLittleA/blender:gp3-mod-simplify"
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 simplify modifier from GPv2.
@ -0,0 +90,4 @@
switch (mmd.mode) {
case MOD_GREASE_PENCIL_SIMPLIFY_FIXED: {
for (int i = 0; i < mmd.step; i++) {
Seems like this would use
geometry::resample_to_count
@ -0,0 +102,4 @@
}
case MOD_GREASE_PENCIL_SIMPLIFY_SAMPLE: {
//geometry::resample_to_length(drawing.strokes(),field_context,
//BKE_gpencil_stroke_sample(gpd, gps, mmd->length, false, mmd->sharp_threshold);
and this would use
geometry::resample_to_length
@ -0,0 +106,4 @@
break;
}
case MOD_GREASE_PENCIL_SIMPLIFY_MERGE: {
//BKE_gpencil_stroke_merge_distance(gpd, gpf, gps, mmd->distance, true);
This one will be tricky...
This doesn't connect multiple strokes, it only merges points inside one stroke it seems, so may not be that complicated eventually... But I'm not sure.
Stil, we'd need a version of
point_merge_by_distance
for curves.e739f875bf
tob1e3bd13c7
Some comments
@ -0,0 +80,4 @@
bke::greasepencil::Drawing &drawing)
{
IndexMaskMemory memory;
bke::CurvesGeometry curves = drawing.strokes_for_write();
Make this
const bke::CurvesGeometry &curves = drawing.strokes();
Then to write to the curves geometry use
drawing.strokes_for_write() = std::move(...);
@ -0,0 +94,4 @@
const OffsetIndices points_by_curve = curves.points_by_curve();
Array<int> target_count(curves.curves_num());
strokes.foreach_index(GrainSize(4096), [&](const int i) {
target_count[i] = math::round(float(points_by_curve[i].size()) / 2.0f + 0.5);
just use
and get rid of the outer loop.
this is probably different than doing it step by step
One more comment. Can you explain what is not working with the fixed mode now?
@ -0,0 +92,4 @@
case MOD_GREASE_PENCIL_SIMPLIFY_FIXED: {
const OffsetIndices points_by_curve = curves.points_by_curve();
Array<int> target_count(curves.curves_num());
target_count.fill(2);
This line is not needed.
@filedescriptor It will crash at the same old place with this code 🤔
@ChengduLittleA What's the crash log?
@filedescriptor I'll update in a bit
WIP: GPv3: Simplify modifierto GPv3: Simplify modifier@blender-bot build
@ -0,0 +245,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)};
Using mixer of single value size does not improve something and violates the design of using this.
This is taken from
blender/source/blender/geometry/intern/point_merge_by_distance.cc:142
This need to be refactored :)\
@HooglyBoogly Let me know what should be done here. I can refactor the pointcould one in a separate commit if it's necessary.
Didn't want to say that
point_merge_by_distance
should be refactored today..\If I fix it here, better fix it in the other place too :D