Status: In development.
Team
Commissioner: @Antonio Vazquez (antoniov)
Project leader: @Falk David (filedescriptor)
Project members: @Daniel Martinez Lara (pepeland), @Matias Mendiola (mendio)
Description
Big picture: The goal is to make a bézier-curve-based workflow possible that covers all areas in grease pencil (Drawing, Editing, Sculpting, etc.).
- Introduce curves as a new stroke type: Bézier type. Previous strokes have the Poly type.
- Curves are editable just like strokes in Sculpt Mode, Vertex Paint, and Weight Paint.
- Users can convert strokes between Bezier and Poly type using a dedicated operator: Set stroke type.
Work plan
Milestone 1 - Remove Curve Editing toggle
Remove the curve editing-related UI elements and code (like the keymap).
Milestone 2 - Selection operators
Adapt the selection operators to work for curves and strokes simultaneously. Some of the selection code might need a refactor as well.
- Remove code that generates curves when selecting strokes.
- GPENCIL_OT_select (rBa0562388286c)
- GPENCIL_OT_select_all (rBc40efe078f47)
- GPENCIL_OT_select_circle (rBa063c5a7cafa, rB91792983f8e7)
- GPENCIL_OT_select_box (rB01799306e703)
- GPENCIL_OT_select_lasso (rB01799306e703)
- GPENCIL_OT_select_linked (rB739a7f984623)
- GPENCIL_OT_select_grouped (rBe251509b5410)
- GPENCIL_OT_select_more (rBf1c97a561423)
- GPENCIL_OT_select_less (rBf1c97a561423)
- GPENCIL_OT_select_first (rB5b1e79105494)
- GPENCIL_OT_select_last (rB5b1e79105494)
- GPENCIL_OT_select_alternate (rB47fe846254a8)
- GPENCIL_OT_select_vertex_color (rB6d922553593b)
Additional changes:
- Curves now have runtime data. Since some selection operators can also select from evaluated data (generated by modifiers), it is necessary that curves have runtime data. (rBd603c9c7ecb6) EDIT: This was later partially removed again. The curve itself does not need runtime data, because it can use the normal stroke runtime data. Curve points do need runtime data.
- When curves are refitted, they keep their previous selection (as good as possible). (rBbed0e8a9a278)
- To test runtime data for curves, the "Offset" modifier was implemented for curves. (rB310810188420)
Milestone 3 - Conversion operators
To convert between the two types we need a "Set Stroke Type" operator.
- Add operator (rB633086e97967)
- Add it to the UI (Stroke menu and context menu in Edit mode) (rBa591eabe94a4)
Milestone 4 - Transform
The transform code will have to be implemented. The TransData can no longer be separated for strokes and curves and will have to take both into account.
Note: The code is implemented and has been tested, but there could still be some bugs. Needs more thorough testing.
- Implement transform for bezier strokes (rB82a225acb50c)
- Implement shrink/fatten for bezier strokes (rB756bc5d94db6)
- Implement opacity change for bezier strokes (rB756bc5d94db6)
Milestone 5 - Editing operators and modifiers
Operators
Adapt/implement all the editing operators. Some of these might only need minor changes like checking if a stroke is a curve and then calling the right function (the bulk has already been implemented).
- GPENCIL_OT_duplicate (rB5a82aa69f7a4)
- GPENCIL_OT_delete (rBfa76a163d3ba)
- GPENCIL_OT_dissolve (rBc944003d2940, rBeec4d20a4486)
- GPENCIL_OT_copy (rBb110bc7820eb)
- GPENCIL_OT_paste (rBb110bc7820eb)
- GPENCIL_OT_extrude (rB9ee08542a21b)
- GPENCIL_OT_move_to_layer (rB15f2dcf46ded)
- GPENCIL_OT_snap_to_grid (rBd443af12f22d)
- GPENCIL_OT_snap_to_cursor (rB07966cbacfc1)
- GPENCIL_OT_snap_cursor_to_selected (rB51a00dfc59e3)
- GPENCIL_OT_reproject (rBc7a0d397988d) (Note: This can be more efficient and more 'correct' if we project the curve points instead of the stroke points)
- GPENCIL_OT_convert (Note: The conversion could use the curve data to make it more efficient and accurate)
- GPENCIL_OT_stroke_arrange (rBb25cc036fcec)
- GPENCIL_OT_stroke_change_color (rB2f39d6b00263)
- GPENCIL_OT_stroke_cyclical_set (rB548f57921149)
- GPENCIL_OT_stroke_caps_set (rB50bdc83cda0a)
- GPENCIL_OT_stroke_join (rB44a1990286bb)
- GPENCIL_OT_stroke_flip (rBd6ff9444ead3)
- GPENCIL_OT_stroke_subdivide (rBaed4b6a2fa67)
- GPENCIL_OT_stroke_simplify (rB799704df18dd)
- GPENCIL_OT_stroke_simplify_fixed (rBeb5591fc9aba)
- GPENCIL_OT_stroke_separate (rBf34e17fcb7e9)
- GPENCIL_OT_stroke_split (rB015476f92381)
- GPENCIL_OT_stroke_smooth (rBe70e618ce745)
- GPENCIL_OT_stroke_sample
- GPENCIL_OT_stroke_merge
- GPENCIL_OT_stroke_cutter
- GPENCIL_OT_stroke_trim
- GPENCIL_OT_stroke_merge_by_distance (rB87d5bd5fb063)
- GPENCIL_OT_stroke_reset_vertex_color (rB13fe1b242cf0)
Modifiers
Adapt modifiers to work with Bezier type.
- Rename callback deformStroke to deformPolyline. (ccbe9d7ab15f)
- Add new callback deformBezier. (fa7c2b6b22aa)
- Transfer Polyline weight data into Bezier type. (f59c9364cbcf)
- MOD_gpencilarmature.c (rB592d356c4a35, rB39e1a77fdb47, rB6d5ba8857175)
- MOD_gpencilarray.c (d1ce52120cd3)
- MOD_gpencilbuild.c (This modifier is not using deformStroke callback)
- MOD_gpencilcolor.c (48ee94f15d61)
- MOD_gpencilhook.c (9405d3f9e38d)
- MOD_gpencillattice.c (8bcc203ed707)
- MOD_gpencillineart.c (This modifier uses deformStroke but the strokes are not editable, so no changes needed.)
- MOD_gpencilmirror.c (6e5080bd643c)
- MOD_gpencilmultiply.c
- MOD_gpencilnoise.c
- MOD_gpenciloffset.c (4f0098760a69)
- MOD_gpencilopacity.c (531704813df8)
- MOD_gpencilsimplify.c
- MOD_gpencilsmooth.c (rBe4c81a0a2b22, rB06abb9d99c79)
- MOD_gpencilsubdiv.c
- MOD_gpenciltexture.c (7c38066bb7c8)
- MOD_gpencilthick.c (82c2236259bd)
- MOD_gpenciltime.c (This modifier is not using deformStroke callback)
- MOD_gpenciltint.c (1700e9977c21)
Milestone 6 - Sculpting, weight painting and vertex painting
Sculpting curves is similar to sculpting strokes. In fact, the only difference is that with curves, we sculpt the stroke points and then refit the curve after the operation. In order to make this work properly though, we need to be able to do partial curve refitting.
Sculpting
- Do curve update if the stroke that was transformed is a curve. (rB7783f7ea1dc4)
- Tag the points that have been transformed. (rB7783f7ea1dc4)
- Change BKE_gpencil_stroke_editcurve_update to handle partial updates.
- Create function to find curve segments that need updating.
- Write BKE to do partial curve updates.
Weight painting
- Implement painting weights to the curve points. (rB54c19452c0b0)
- Adapt the visual drawing of the weights for bezier strokes (rBfb587e68be3b, rB85b78a14d29b, rBceec9a6ddd14)
Vertex painting
- Implement painting to the curve points. (rB1ddc36d42d18)
- Update the vertex color of the poly points. (rB1ddc36d42d18)
- Implement all brushes: brush_blur, brush_average, brush_smear, brush_replace
Milestone 7 - Drawing curves
To make curves part of all areas, we need at least one way to create curves directly in Draw Mode. There are multiple ideas:
- Brush option: Setting that converts a drawn stroke to a curve on release. This would allow the user to automatically convert every stroke they draw to a curve (which they can then further edit in Edit Mode).
- Bézier pen tool: Dedicated tool that allows drawing a bézier curve. Similar to the pen tool in other software. (need a subtask for this)
Branch: temp-gpencil-bezier-stroke-type