GPv3: Handle vertex groups in the GPv2 conversion operator #117860
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117860
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "LukasTonne/blender:gp3-vertex-group-conversion"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.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);
Vector
->Array
here since it isn't grown or resized@ -25,0 +48,4 @@
}
ListBase new_names;
BLI_listbase_clear(&new_names);
Vector<int> index_map(num_vertex_groups);
Array
here tooOnly 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(
I suppose this might as well be
std::pair
No practical advantage that i know of to use
pair
instead oftuple
.pair
implies a deeper reason there's 2 of them, which is not the case. I just prefer tuple for this purpose.@ -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;
Should we check if the weight is > 0 ?
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.
@blender-bot build
@ -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];
Apparently apple builds don't like this:
https://builder.blender.org/admin/#/builders/134/builds/3618
Probably an clang bug: https://github.com/llvm/llvm-project/issues/66999
Using C style return values now.
@blender-bot build
@blender-bot build
Code looks good to me.
@blender-bot build