FIX #110946: vgroup normalize all check if armature is deforming before normalizing #112648

Merged
Member

The issue in #110946 is if an armature is present, but not active the group_select_mode defaults to WT_VGROUP_BONE_DEFORM, and throws an error because it can't find any active vertex groups.

To fix this, we're now checking to see if any bone is actively deforming before switching toWT_VGROUP_BONE_DEFORM (else defaulting to WT_VGROUP_ALL)

The issue in #110946 is if an armature is present, but not active the group_select_mode defaults to WT_VGROUP_BONE_DEFORM, and throws an error because it can't find any active vertex groups. To fix this, we're now checking to see if any bone is actively deforming before switching toWT_VGROUP_BONE_DEFORM (else defaulting to WT_VGROUP_ALL)
Nate Rupsis added the
Module
Animation & Rigging
label 2023-09-21 03:58:49 +02:00
Sybren A. Stüvel reviewed 2023-09-22 08:42:02 +02:00
@ -2897,2 +2895,2 @@
"group_select_mode",
BKE_modifiers_is_deformed_by_armature(ob) ? WT_VGROUP_BONE_DEFORM : WT_VGROUP_ALL);
/* Default to All Groups. */
eVGroupSelect targetGroup = WT_VGROUP_ALL;

This functionality is at a different abstraction level than the surrounding code. Because of that, I think it's better to put it into a little static function of its own that returns either WT_VGROUP_BONE_DEFORM or WT_VGROUP_ALL.

This functionality is at a different abstraction level than the surrounding code. Because of that, I think it's better to put it into a little `static` function of its own that returns either `WT_VGROUP_BONE_DEFORM` or `WT_VGROUP_ALL`.
Author
Member

That's a good call, and the reason this is still a WIP. It's a bit ugly at the moment.

That's a good call, and the reason this is still a WIP. It's a bit ugly at the moment.
dr.sybren marked this conversation as resolved
Nate Rupsis changed title from WIP: FIX #110946: vgroup normalize all check if armature is deforming before normalizing to FIX #110946: vgroup normalize all check if armature is deforming before normalizing 2023-09-27 03:01:45 +02:00
Nate Rupsis requested review from Sybren A. Stüvel 2023-09-27 03:02:02 +02:00
Nate Rupsis requested review from Daniel Salazar 2023-09-27 03:02:02 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR112648) when ready.
Sybren A. Stüvel requested changes 2023-09-28 11:52:36 +02:00
Sybren A. Stüvel left a comment
Member

Thanks, I can confirm this fixes things :)

Please rebase this PR onto the blender-v4.0-release branch. This takes two steps:

  • Actually rebase your branch & force-push
  • Edit this PR so that Gitea also understands it shouldn't go onto main but onto the release branch.

More info on https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch

Thanks, I can confirm this fixes things :) Please rebase this PR onto the `blender-v4.0-release` branch. This takes two steps: - Actually rebase your branch & force-push - Edit this PR so that Gitea also understands it shouldn't go onto `main` but onto the release branch. More info on https://wiki.blender.org/wiki/Process/Using_Stabilizing_Branch
@ -2891,0 +2901,4 @@
if (BKE_modifiers_is_deformed_by_armature(ob)) {
bool *defgroup_validmap = nullptr;
int r_defgroup_tot = BKE_object_defgroup_count(ob);

r_defgroup_tot is not used as a return parameter anywhere, so remove the r_ prefix and make it const.

`r_defgroup_tot` is not used as a return parameter anywhere, so remove the `r_` prefix and make it `const`.
nrupsis marked this conversation as resolved
@ -2891,0 +2903,4 @@
int r_defgroup_tot = BKE_object_defgroup_count(ob);
defgroup_validmap = BKE_object_defgroup_validmap_get(ob, r_defgroup_tot);

I think these three lines are tightly related, so better to remove the newlines between them. Also it shows that defgroup_validmap is not used between its initialisation to nullptr and its later assignment, so you can shorten it further to:

    int r_defgroup_tot = BKE_object_defgroup_count(ob);
    bool *defgroup_validmap = BKE_object_defgroup_validmap_get(ob, r_defgroup_tot);
I think these three lines are tightly related, so better to remove the newlines between them. Also it shows that `defgroup_validmap` is not used between its initialisation to `nullptr` and its later assignment, so you can shorten it further to: ```cpp int r_defgroup_tot = BKE_object_defgroup_count(ob); bool *defgroup_validmap = BKE_object_defgroup_validmap_get(ob, r_defgroup_tot); ```
@ -2891,0 +2906,4 @@
defgroup_validmap = BKE_object_defgroup_validmap_get(ob, r_defgroup_tot);
for (int i = 0; i < r_defgroup_tot; i++) {
if (defgroup_validmap[i] == true) {

Usually I'm not a fan of == true, but here it kinda helps to drive the point home that this is a boolean array.

Usually I'm not a fan of `== true`, but here it kinda helps to drive the point home that this is a boolean array.
Nate Rupsis changed title from FIX #110946: vgroup normalize all check if armature is deforming before normalizing to FIX #110946: vgroup normalize all check if armature is deforming before normalizing 2023-09-28 20:19:40 +02:00
nrupsis changed target branch from main to blender-v4.0-release 2023-09-28 20:19:42 +02:00
Nate Rupsis force-pushed 110946-Normalize-V-Groups-Armature-Mod-Hidden from 0d6121e346 to a286b90ff8 2023-09-28 20:21:16 +02:00 Compare
Author
Member

Looks like I switched the PR target before the rebase took effect 😬 sorry for the clutter.

Looks like I switched the PR target before the rebase took effect 😬 sorry for the clutter.
Nate Rupsis added 1 commit 2023-09-28 22:54:16 +02:00
Sybren A. Stüvel approved these changes 2023-09-29 08:41:37 +02:00
Sybren A. Stüvel left a comment
Member

Looks like I switched the PR target before the rebase took effect 😬 sorry for the clutter.

No fuss, that happens.

The patch works like a charm! Thanks :)

> Looks like I switched the PR target before the rebase took effect 😬 sorry for the clutter. No fuss, that happens. The patch works like a charm! Thanks :)
Nate Rupsis merged commit d1f250c0bc into blender-v4.0-release 2023-09-29 15:32:08 +02:00
Nate Rupsis deleted branch 110946-Normalize-V-Groups-Armature-Mod-Hidden 2023-09-29 15:32:12 +02:00
Daniel Salazar refused to review 2023-10-02 23:57:21 +02:00
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#112648
No description provided.