GPv3: Create weights on draw for new strokes. #119302

Open
casey-bianco-davis wants to merge 9 commits from casey-bianco-davis/blender:GPv3-Create-weights-on-draw into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Implements the legacy weight_data_add button for GPv3.

Note: This PR properly accounts for the bone's transformation when applying so that the stroke does not appear to teleport after drawing, unlike the legacy system.

Implements the legacy `weight_data_add` button for GPv3. Note: This PR properly accounts for the bone's transformation when applying so that the stroke does not appear to teleport after drawing, unlike the legacy system.
casey-bianco-davis added the
Interest
Grease Pencil
Module
Grease Pencil
labels 2024-03-11 01:54:10 +01:00
casey-bianco-davis added 1 commit 2024-03-11 01:54:15 +01:00
casey-bianco-davis added this to the Grease Pencil project 2024-03-11 01:54:18 +01:00
casey-bianco-davis requested review from Falk David 2024-03-11 01:59:46 +01:00
casey-bianco-davis added 1 commit 2024-03-11 02:07:14 +01:00
casey-bianco-davis added 1 commit 2024-03-11 03:14:14 +01:00
casey-bianco-davis added 1 commit 2024-03-13 04:17:00 +01:00
Sietse Brouwer reviewed 2024-03-13 19:49:47 +01:00
Sietse Brouwer left a comment
Member

You are really on fire, I see a lot of great PRs from your hand – very nice!

A few tiny remarks from a fellow community contributor.

Btw, I like the addition of compensating for the bone transformation. It's one of those smart little things that make Grease Pencil artist-friendly.

You are really on fire, I see a lot of great PRs from your hand – very nice! A few tiny remarks from a fellow community contributor. Btw, I like the addition of compensating for the bone transformation. It's one of those smart little things that make Grease Pencil artist-friendly.
@ -596,0 +616,4 @@
const bDeformGroup *defgroup = static_cast<const bDeformGroup *>(
BLI_findlink(BKE_object_defgroup_list(object), def_nr));
Member

In case there is no vertex group:

if (def_nr == -1) {
  return;
}
In case there is no vertex group: ``` if (def_nr == -1) { return; } ```
casey-bianco-davis marked this conversation as resolved
@ -596,0 +620,4 @@
const StringRef vertex_group_name = defgroup->name;
blender::bke::greasepencil::assign_to_vertex_group_from_selection(
curves, IndexMask(points), vertex_group_name, 1.0f);
Member

Any reason to switch here from IndexRange to IndexMask? Ignore my question when there is 🔕

And at first glance I thought this function had something to do with the .selection attribute. So perhaps something like assign_to_vertex_group_from_range is a better name?

Any reason to switch here from `IndexRange` to `IndexMask`? Ignore my question when there is :no_bell: And at first glance I thought this function had something to do with the `.selection` attribute. So perhaps something like `assign_to_vertex_group_from_range` is a better name?
casey-bianco-davis marked this conversation as resolved
@ -596,0 +623,4 @@
curves, IndexMask(points), vertex_group_name, 1.0f);
/* Loop through all modifiers trying to find the pose channel for the vertex group name. */
bPoseChannel *channel = NULL;
Member

Here and below: NULL -> nullptr

Here and below: `NULL` -> `nullptr`
casey-bianco-davis marked this conversation as resolved
@ -596,0 +635,4 @@
continue;
}
GreasePencilArmatureModifierData *amd = (GreasePencilArmatureModifierData *)md;
Member

reinterpret_cast<GreasePencilArmatureModifierData *>(md)

`reinterpret_cast<GreasePencilArmatureModifierData *>(md)`
casey-bianco-davis marked this conversation as resolved
@ -596,0 +655,4 @@
break;
}
/* nothing valid was found. */
Member

Nitpick: Capital N.

Nitpick: Capital N.
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 5 commits 2024-03-13 21:25:34 +01:00
Falk David requested changes 2024-03-29 12:56:25 +01:00
Falk David left a comment
Member

Thanks for looking into this. One concern I have is about trying to inverse the deformation of modifiers in the paint tool. From what I could find, this wasn't done in GPv2? Generally, if we wanted to support this, we should be using the get_evaluated_grease_pencil_drawing_deformation API. This would allow you to get a matrix per curve/point with the deformation. And each modifier that supports this deformed space, would write into the edit component.

Thanks for looking into this. One concern I have is about trying to inverse the deformation of modifiers in the paint tool. From what I could find, this wasn't done in GPv2? Generally, if we wanted to support this, we should be using the `get_evaluated_grease_pencil_drawing_deformation` API. This would allow you to get a matrix per curve/point with the deformation. And each modifier that supports this deformed space, would write into the edit component.
Author
Member

The legacy system did not convert the points when applying the weights.

I will look in to using get_evaluated_grease_pencil_drawing_deformation but currently it does not work with deform_mats

The legacy system did not convert the points when applying the weights. I will look in to using `get_evaluated_grease_pencil_drawing_deformation` but currently it does not work with `deform_mats`
This pull request has changes conflicting with the target branch.
  • scripts/startup/bl_ui/space_view3d.py
  • source/blender/blenkernel/intern/grease_pencil_vertex_groups.cc
  • source/blender/editors/sculpt_paint/grease_pencil_paint.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u GPv3-Create-weights-on-draw:casey-bianco-davis-GPv3-Create-weights-on-draw
git checkout casey-bianco-davis-GPv3-Create-weights-on-draw
Sign in to join this conversation.
No reviewers
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#119302
No description provided.