GPv3: Handle vertex groups in the GPv2 conversion operator #117860

Merged
Lukas Tönne merged 12 commits from LukasTonne/blender:gp3-vertex-group-conversion into main 2024-02-06 12:36:26 +01:00
Member

Copies vertex group names from the GPv2 object to the new GPv3 GreasePencil data block.
Copies only those names to the drawings that are actually used by any of the strokes.
Updates group indices in MDeformVert data to point to local Drawing groups.

Copies vertex group names from the GPv2 object to the new GPv3 GreasePencil data block. Copies only those names to the drawings that are actually used by any of the strokes. Updates group indices in `MDeformVert` data to point to local Drawing groups.
Lukas Tönne added 8 commits 2024-02-05 17:34:57 +01:00
Lukas Tönne requested review from Falk David 2024-02-05 17:35:08 +01:00
Lukas Tönne added this to the Grease Pencil project 2024-02-05 17:35:13 +01:00
Hans Goudey reviewed 2024-02-05 17:39:42 +01:00
Hans Goudey left a comment
Member

Just reading out of curiosity and noticed one thing

Just reading out of curiosity and noticed one thing
@ -25,0 +34,4 @@
const bGPDframe &gpf, const ListBase &vertex_group_names)
{
const int num_vertex_groups = BLI_listbase_count(&vertex_group_names);
Vector<int> is_group_used(num_vertex_groups, false);
Member

Vector -> Array here since it isn't grown or resized

`Vector` -> `Array` here since it isn't grown or resized
LukasTonne marked this conversation as resolved
@ -25,0 +48,4 @@
}
ListBase new_names;
BLI_listbase_clear(&new_names);
Vector<int> index_map(num_vertex_groups);
Member

Array here too

`Array` here too
LukasTonne marked this conversation as resolved
Falk David requested changes 2024-02-05 17:42:07 +01:00
Falk David left a comment
Member

Only a few comments

Only a few comments
@ -25,0 +30,4 @@
* - ListBase with used vertex group names (bDeformGroup)
* - Vector of indices in the new vertex group list for remapping
*/
static std::tuple<ListBase, Vector<int>> find_used_vertex_groups(
Member

I suppose this might as well be std::pair

I suppose this might as well be `std::pair`
Author
Member

No practical advantage that i know of to use pair instead of tuple. pair implies a deeper reason there's 2 of them, which is not the case. I just prefer tuple for this purpose.

No practical advantage that i know of to use `pair` instead of `tuple`. `pair` implies a deeper reason there's 2 of them, which is not the case. I just prefer tuple for this purpose.
LukasTonne marked this conversation as resolved
@ -25,0 +42,4 @@
Span<MDeformVert> dverts = {gps->dvert, gps->totpoints};
for (const MDeformVert &dvert : dverts) {
for (const MDeformWeight &weight : Span<MDeformWeight>{dvert.dw, dvert.totweight}) {
is_group_used[weight.def_nr] = true;
Member

Should we check if the weight is > 0 ?

Should we check if the weight is > 0 ?
Author
Member

I think this might alter behavior in cases where the vertex weight is ignored and only membership in the group is taken into account. Not sure if such cases exist in GP2 modifiers, but i'd rather forego some minor optimization and be safe in this regard.

I think this might alter behavior in cases where the vertex weight is ignored and only membership in the group is taken into account. Not sure if such cases exist in GP2 modifiers, but i'd rather forego some minor optimization and be safe in this regard.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-02-05 17:56:16 +01:00
Use Array instead of Vector for fixed size arrays.
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
91632b7a0c
Author
Member

@blender-bot build

@blender-bot build
Lukas Tönne reviewed 2024-02-05 18:53:27 +01:00
@ -57,0 +111,4 @@
const MutableSpan<MDeformWeight> vertex_weights = {dst_dvert.dw, dst_dvert.totweight};
for (MDeformWeight &weight : vertex_weights) {
/* Map def_nr to the reduced vertex group list. */
weight.def_nr = stroke_def_nr_map[weight.def_nr];
Author
Member

Apparently apple builds don't like this:
https://builder.blender.org/admin/#/builders/134/builds/3618

error: capturing a structured binding is not yet supported in OpenMP

Apparently apple builds don't like this: https://builder.blender.org/admin/#/builders/134/builds/3618 > error: capturing a structured binding is not yet supported in OpenMP
Author
Member

Probably an clang bug: https://github.com/llvm/llvm-project/issues/66999
Using C style return values now.

Probably an clang bug: https://github.com/llvm/llvm-project/issues/66999 Using C style return values now.
LukasTonne marked this conversation as resolved
Lukas Tönne added 1 commit 2024-02-06 09:20:19 +01:00
Test: use pair instead of tuple, see if that fixes build errors.
Some checks failed
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
1e4501d009
Author
Member

@blender-bot build

@blender-bot build
Lukas Tönne added 1 commit 2024-02-06 11:13:24 +01:00
Use C style return values to avoid compiler bugs in OpenMP.
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
f3a67bb317
Author
Member

@blender-bot build

@blender-bot build
Falk David approved these changes 2024-02-06 11:15:25 +01:00
Falk David left a comment
Member

Code looks good to me.

Code looks good to me.
Lukas Tönne added 1 commit 2024-02-06 11:40:31 +01:00
Merge branch 'main' into gp3-vertex-group-conversion
All checks were successful
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
49c1fbf548
Author
Member

@blender-bot build

@blender-bot build
Lukas Tönne merged commit ee9a0f6014 into main 2024-02-06 12:36:26 +01:00
Lukas Tönne deleted branch gp3-vertex-group-conversion 2024-02-06 12:36:29 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#117860
No description provided.