GPencil: New bézier stroke type #85754

Closed
opened 2021-02-17 23:32:06 +01:00 by Falk David · 11 comments
Member

Status: In development.


Team
Commissioner: @antoniov
Project leader: @filedescriptor
Project members: @pepe-school-land, @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

**{icon check-circle color=green} Milestone 1 - Remove Curve Editing toggle Remove the curve editing-related UI elements and code (like the keymap).{icon check-circle color=green} 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 (a056238828)
    • GPENCIL_OT_select_all (c40efe078f)
    • GPENCIL_OT_select_circle (a063c5a7ca, 91792983f8)
    • GPENCIL_OT_select_box (01799306e7)
    • GPENCIL_OT_select_lasso (01799306e7)
    • GPENCIL_OT_select_linked (739a7f9846)
    • GPENCIL_OT_select_grouped (e251509b54)
    • GPENCIL_OT_select_more (f1c97a5614)
    • GPENCIL_OT_select_less (f1c97a5614)
    • GPENCIL_OT_select_first (5b1e791054)
    • GPENCIL_OT_select_last (5b1e791054)
    • GPENCIL_OT_select_alternate (47fe846254)
    • GPENCIL_OT_select_vertex_color (6d92255359)

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. (d603c9c7ec) 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). (bed0e8a9a2)
  • To test runtime data for curves, the "Offset" modifier was implemented for curves. (3108101884)

**{icon check-circle color=green} Milestone 3 - Conversion operators **
To convert between the two types we need a "Set Stroke Type" operator.

    • Add operator (633086e979)
    • Add it to the UI (Stroke menu and context menu in Edit mode) (a591eabe94)

**{icon check-circle color=green} 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 (82a225acb5)
    • Implement shrink/fatten for bezier strokes (756bc5d94d)
    • Implement opacity change for bezier strokes (756bc5d94d)

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 (5a82aa69f7)
    • GPENCIL_OT_delete (fa76a163d3)
    • GPENCIL_OT_dissolve (c944003d29, eec4d20a44)
    • GPENCIL_OT_copy (b110bc7820)
    • GPENCIL_OT_paste (b110bc7820)
    • GPENCIL_OT_extrude (9ee08542a2)
    • GPENCIL_OT_move_to_layer (15f2dcf46d)
    • GPENCIL_OT_snap_to_grid (d443af12f2)
    • GPENCIL_OT_snap_to_cursor (07966cbacf)
    • GPENCIL_OT_snap_cursor_to_selected (51a00dfc59)
    • GPENCIL_OT_reproject (c7a0d39798) (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 (b25cc036fc)
    • GPENCIL_OT_stroke_change_color (2f39d6b002)
    • GPENCIL_OT_stroke_cyclical_set (548f579211)
    • GPENCIL_OT_stroke_caps_set (50bdc83cda)
    • GPENCIL_OT_stroke_join (44a1990286)
    • GPENCIL_OT_stroke_flip (d6ff9444ea)
    • GPENCIL_OT_stroke_subdivide (aed4b6a2fa)
    • GPENCIL_OT_stroke_simplify (799704df18)
    • GPENCIL_OT_stroke_simplify_fixed (eb5591fc9a)
    • GPENCIL_OT_stroke_separate (f34e17fcb7)
    • GPENCIL_OT_stroke_split (015476f923)
    • GPENCIL_OT_stroke_smooth (e70e618ce7)
    • GPENCIL_OT_stroke_sample
    • GPENCIL_OT_stroke_merge
    • GPENCIL_OT_stroke_cutter
    • GPENCIL_OT_stroke_trim
    • GPENCIL_OT_stroke_merge_by_distance (87d5bd5fb0)
    • GPENCIL_OT_stroke_reset_vertex_color (13fe1b242c)

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 (592d356c4a, 39e1a77fdb, 6d5ba88571)
    • 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 (e4c81a0a2b, 06abb9d99c)
    • 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. (7783f7ea1d)
    • Tag the points that have been transformed. (7783f7ea1d)
    • 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. (54c19452c0)
    • Adapt the visual drawing of the weights for bezier strokes (fb587e68be, 85b78a14d2, ceec9a6ddd)

Vertex painting

    • Implement painting to the curve points. (1ddc36d42d)
    • Update the vertex color of the poly points. (1ddc36d42d)
    • 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

**Status:** `In development`. --- **Team** **Commissioner:** @antoniov **Project leader:** @filedescriptor **Project members:** @pepe-school-land, @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** **{icon check-circle color=green} Milestone 1 - Remove Curve Editing toggle **Remove the curve editing-related UI elements and code (like the keymap).**{icon check-circle color=green} 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. * - [x] Remove code that generates curves when selecting strokes. * - [x] GPENCIL_OT_select (a056238828) * - [x] GPENCIL_OT_select_all (c40efe078f) * - [x] GPENCIL_OT_select_circle (a063c5a7ca, 91792983f8) * - [x] GPENCIL_OT_select_box (01799306e7) * - [x] GPENCIL_OT_select_lasso (01799306e7) * - [x] GPENCIL_OT_select_linked (739a7f9846) * - [x] GPENCIL_OT_select_grouped (e251509b54) * - [x] GPENCIL_OT_select_more (f1c97a5614) * - [x] GPENCIL_OT_select_less (f1c97a5614) * - [x] GPENCIL_OT_select_first (5b1e791054) * - [x] GPENCIL_OT_select_last (5b1e791054) * - [x] GPENCIL_OT_select_alternate (47fe846254) * - [x] GPENCIL_OT_select_vertex_color (6d92255359) *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. (d603c9c7ec) 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). (bed0e8a9a2) - To test runtime data for curves, the "Offset" modifier was implemented for curves. (3108101884) **{icon check-circle color=green} Milestone 3 - Conversion operators ** To convert between the two types we need a "Set Stroke Type" operator. * - [x] Add operator (633086e979) * - [x] Add it to the UI (Stroke menu and context menu in Edit mode) (a591eabe94) **{icon check-circle color=green} 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.* * - [x] Implement transform for bezier strokes (82a225acb5) * - [x] Implement shrink/fatten for bezier strokes (756bc5d94d) * - [x] Implement opacity change for bezier strokes (756bc5d94d) **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). * - [x] GPENCIL_OT_duplicate (5a82aa69f7) * - [x] GPENCIL_OT_delete (fa76a163d3) * - [x] GPENCIL_OT_dissolve (c944003d29, eec4d20a44) * - [x] GPENCIL_OT_copy (b110bc7820) * - [x] GPENCIL_OT_paste (b110bc7820) * - [x] GPENCIL_OT_extrude (9ee08542a2) * - [x] GPENCIL_OT_move_to_layer (15f2dcf46d) * - [x] GPENCIL_OT_snap_to_grid (d443af12f2) * - [x] GPENCIL_OT_snap_to_cursor (07966cbacf) * - [x] GPENCIL_OT_snap_cursor_to_selected (51a00dfc59) * - [x] GPENCIL_OT_reproject (c7a0d39798) (`Note: This can be more efficient and more 'correct' if we project the curve points instead of the stroke points`) * - [x] GPENCIL_OT_convert (`Note: The conversion could use the curve data to make it more efficient and accurate`) * - [x] GPENCIL_OT_stroke_arrange (b25cc036fc) * - [x] GPENCIL_OT_stroke_change_color (2f39d6b002) * - [x] GPENCIL_OT_stroke_cyclical_set (548f579211) * - [x] GPENCIL_OT_stroke_caps_set (50bdc83cda) * - [x] GPENCIL_OT_stroke_join (44a1990286) * - [x] GPENCIL_OT_stroke_flip (d6ff9444ea) * - [x] GPENCIL_OT_stroke_subdivide (aed4b6a2fa) * - [x] GPENCIL_OT_stroke_simplify (799704df18) * - [x] GPENCIL_OT_stroke_simplify_fixed (eb5591fc9a) * - [x] GPENCIL_OT_stroke_separate (f34e17fcb7) * - [x] GPENCIL_OT_stroke_split (015476f923) * - [x] GPENCIL_OT_stroke_smooth (e70e618ce7) * - [ ] GPENCIL_OT_stroke_sample * - [ ] GPENCIL_OT_stroke_merge * - [ ] GPENCIL_OT_stroke_cutter * - [ ] GPENCIL_OT_stroke_trim * - [x] GPENCIL_OT_stroke_merge_by_distance (87d5bd5fb0) * - [x] GPENCIL_OT_stroke_reset_vertex_color (13fe1b242c) **Modifiers** Adapt modifiers to work with Bezier type. * - [x] Rename callback `deformStroke` to `deformPolyline`. (ccbe9d7ab15f) * - [x] Add new callback `deformBezier`. (fa7c2b6b22aa) * - [x] Transfer Polyline weight data into Bezier type. (f59c9364cbcf) * - [x] MOD_gpencilarmature.c (592d356c4a, 39e1a77fdb, 6d5ba88571) * - [x] MOD_gpencilarray.c (d1ce52120cd3) * - [x] MOD_gpencilbuild.c (`This modifier is not using deformStroke callback`) * - [x] MOD_gpencilcolor.c (48ee94f15d61) * - [x] MOD_gpencilhook.c (9405d3f9e38d) * - [x] MOD_gpencillattice.c (8bcc203ed707) * - [x] MOD_gpencillineart.c (`This modifier uses deformStroke but the strokes are not editable, so no changes needed.`) * - [x] MOD_gpencilmirror.c (6e5080bd643c) * - [ ] MOD_gpencilmultiply.c * - [ ] MOD_gpencilnoise.c * - [x] MOD_gpenciloffset.c (4f0098760a69) * - [x] MOD_gpencilopacity.c (531704813df8) * - [ ] MOD_gpencilsimplify.c * - [x] MOD_gpencilsmooth.c (e4c81a0a2b, 06abb9d99c) * - [ ] MOD_gpencilsubdiv.c * - [x] MOD_gpenciltexture.c (7c38066bb7c8) * - [x] MOD_gpencilthick.c (82c2236259bd) * - [x] MOD_gpenciltime.c (`This modifier is not using deformStroke callback`) * - [x] 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** * - [x] Do curve update if the stroke that was transformed is a curve. (7783f7ea1d) * - [x] Tag the points that have been transformed. (7783f7ea1d) * - [ ] 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** * - [x] Implement painting weights to the curve points. (54c19452c0) * - [x] Adapt the visual drawing of the weights for bezier strokes (fb587e68be, 85b78a14d2, ceec9a6ddd) **Vertex painting** * - [x] Implement painting to the curve points. (1ddc36d42d) * - [x] Update the vertex color of the poly points. (1ddc36d42d) * - [ ] 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`
Falk David self-assigned this 2021-02-17 23:32:06 +01:00
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member
Added subscribers: @filedescriptor, @mendio, @antoniov, @pepe-school-land

Added subscriber: @SimplSam

Added subscriber: @SimplSam
Falk David changed title from GPencil: Next steps for curve editing to GPencil: New bézier stroke type 2021-03-12 18:25:16 +01:00

Added subscriber: @laurelkeys

Added subscriber: @laurelkeys

Added subscriber: @Gabi_love

Added subscriber: @Gabi_love

Do you believe this will be included in 3.0?

Do you believe this will be included in 3.0?
Contributor

Added subscriber: @ok_what

Added subscriber: @ok_what

Added subscriber: @hamza-el-barmaki

Added subscriber: @hamza-el-barmaki

any update for 3.3 or 3.4 ? or waiting for new curve structure data block and then ....?

any update for 3.3 or 3.4 ? or waiting for new curve structure data block and then ....?
Author
Member

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Author
Member

@hamza-el-barmaki This project is now being replaced by a more general proposal. See https://devtalk.blender.org/t/developer-discussion-new-grease-pencil-data-structure-proposal .

@hamza-el-barmaki This project is now being replaced by a more general proposal. See https://devtalk.blender.org/t/developer-discussion-new-grease-pencil-data-structure-proposal .
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
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
6 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#85754
No description provided.