GPv3: Vertex groups in GreasePencil data block and conversion #117337

Closed
opened 2024-01-19 15:33:58 +01:00 by Lukas Tönne · 5 comments
Member
  • Add a list of vertex group names to GreasePencil data block DNA.
  • RNA API for vertex group names.
  • Basic UI for vertex group names.
  • Extend conversion functions in grease_pencil_convert_legacy.cc:
    • copy vertex group names from old bGPdata to new GreasePencil.
    • copy vertex group names from old bGPdata to all Drawings in the data block.
      Optimization: skip vertex groups in Drawings where they have no assigned vertices
    • copy MDeformVert from bGPDstroke to new CustomData
- Add a list of vertex group names to `GreasePencil` data block DNA. - RNA API for vertex group names. - Basic UI for vertex group names. - Extend conversion functions in `grease_pencil_convert_legacy.cc`: - copy vertex group names from old `bGPdata` to new `GreasePencil`. - copy vertex group names from old `bGPdata` to all `Drawings` in the data block. _Optimization: skip vertex groups in `Drawings` where they have no assigned vertices_ - copy `MDeformVert` from `bGPDstroke` to new `CustomData`
Lukas Tönne added the
Type
To Do
label 2024-01-19 15:33:58 +01:00
Lukas Tönne added this to the Grease Pencil project 2024-01-19 15:34:01 +01:00
Lukas Tönne added the
Module
Grease Pencil
Priority
Normal
labels 2024-01-19 15:34:39 +01:00
Lukas Tönne self-assigned this 2024-01-19 15:34:49 +01:00
Author
Member

Adding a conventional DNA ListBase of vertex group names to GreasePencil is not ideal. It raises questions of where data is actually defined. Vertex groups could be added both through the GreasePencil DNA and through the attributes API in Curves, and the respective other side of the data would need to be kept in sync.

A radical solution would be to not store vertex groups in GreasePencil data blocks at all. Each Drawing stores an independent list of vertex groups. This would require adding each vertex group individually to each drawing. Modifiers would not be able to select a vertex group.

Compromise: use Drawings as the primary storage for vertex groups, and derive a cached runtime list in GreasePencil from that data. This has implications for workflow:

Task
Add vertex group Have to select a drawing first (cannot add vertex group without any drawings!). New vertex groups are not automatically added to all drawings
Remove vertex group Removed from all drawings
Rename vertex group Renamed in all drawings
Move vertex group up/down Meaningless! Order of vertex groups in the runtime cache is arbitrary: Added in the order in which they appear in drawings (first come, first serve). Cache vgroup order does not have to match order in any of the drawings.
Adding a conventional DNA `ListBase` of vertex group names to `GreasePencil` is not ideal. It raises questions of where data is actually defined. Vertex groups could be added both through the `GreasePencil` DNA and through the attributes API in `Curves`, and the respective other side of the data would need to be kept in sync. A radical solution would be to not store vertex groups in `GreasePencil` data blocks at all. Each `Drawing` stores an independent list of vertex groups. This would require adding each vertex group individually to each drawing. Modifiers would not be able to select a vertex group. Compromise: use `Drawings` as the primary storage for vertex groups, and derive a cached runtime list in `GreasePencil` from that data. This has implications for workflow: |Task|| |-|-| |Add vertex group|Have to select a drawing first (cannot add vertex group without any drawings!). New vertex groups are not automatically added to all drawings| |Remove vertex group|Removed from all drawings| |Rename vertex group|Renamed in all drawings| |Move vertex group up/down|Meaningless! Order of vertex groups in the runtime cache is arbitrary: Added in the order in which they appear in drawings (first come, first serve). Cache vgroup order does not have to match order in any of the drawings.|
Member

A read-only collection property on GreasePencil called all_drawing_vertex_groups seems like a good place to start. That would be used to choose vertex groups in the modifiers.

The property editor will have to be extended to show properties of the active drawing: attributes and vertex groups.

A read-only collection property on `GreasePencil` called `all_drawing_vertex_groups` seems like a good place to start. That would be used to choose vertex groups in the modifiers. The property editor will have to be extended to show properties of the active drawing: attributes and vertex groups.
Member

As I see it, there is no functional relationship between vertex groups and layers (drawings). A vertex group has a 1:n relationship with stroke points. Those points can reside in multiple layers.
A vertex group is really an object-level thing. So storing it at layer level, sounds like a troublesome design to me.

As I see it, there is no functional relationship between vertex groups and layers (drawings). A vertex group has a 1:n relationship with stroke _points_. Those points can reside in multiple layers. A vertex group is really an object-level thing. So storing it at layer level, sounds like a troublesome design to me.
Author
Member

At the module meeting we decided to try the "runtime cache" approach:

  1. Authoritative vertex group names are stored per drawing (CurvesGeometry).
  2. List of vertex groups in GreasePencil data block is cached at runtime.
  3. GreasePencil names are used for global ordering between drawings.
At the module meeting we decided to try the "runtime cache" approach: 1. Authoritative vertex group names are stored per drawing (`CurvesGeometry`). 2. List of vertex groups in `GreasePencil` data block is cached at runtime. 3. `GreasePencil` names are used for global ordering between drawings.
Author
Member

Vertex groups definitions (bDeformGroup) have a lock_weight flag, which is used to maintain relative weights during editing. With the "drawings own vertex groups" approach this begs the question: do we use the individual flags on the drawings to determine locking state?

As a user-facing editor setting i would expect all drawings to use the same property. But if drawings are the source of truth this could become a bit more difficult. We could apply the same principle as for vertex group names:

  • Primary storage is on drawings.
  • After changes the data block property is updated to reflect overall state.
  • Operators (for setting the flag) apply to all drawings, only indirectly changing the data block property.
  • If the lock_weight flag is disabled on any drawing it is disabled on the data block too.
Vertex groups definitions (`bDeformGroup`) have a `lock_weight` flag, which is used to maintain relative weights during editing. With the "drawings own vertex groups" approach this begs the question: do we use the individual flags on the drawings to determine locking state? As a user-facing editor setting i would expect all drawings to use the same property. But if drawings are the source of truth this could become a bit more difficult. We could apply the same principle as for vertex group names: - Primary storage is on drawings. - After changes the data block property is updated to reflect overall state. - Operators (for setting the flag) apply to all drawings, only indirectly changing the data block property. - If the `lock_weight` flag is disabled on any drawing it is disabled on the data block too.
Blender Bot added the
Status
Resolved
label 2024-01-31 17:46:11 +01:00
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
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
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#117337
No description provided.