GPv3: Invert weight operator #126275
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
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#126275
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "PratikPB2123/blender:gpv3-weight-invert"
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?
Port gp legacy "invert weight" operator.
Thanks for working on this! Added some comments
@ -360,0 +379,4 @@
/* Active vgroup index of drawing. */
const int drawing_vgroup_index = BLI_findstringindex(
&curves.vertex_group_names, active_defgroup->name, offsetof(bDeformGroup, name));
Should assert here that
drawing_vgroup_index != -1
.@ -360,0 +387,4 @@
return;
}
for (int i : weights.index_range()) {
const int i
@blender-bot build
Thanks for reviewing :)
I know this PR is already merged, but a 'review after the facts' was the easiest way for me to address a few things 😉
@ -360,0 +371,4 @@
const bDeformGroup *active_defgroup = static_cast<const bDeformGroup *>(
BLI_findlink(BKE_object_defgroup_list(object), active_index));
There should be a check-and-report here when the active vertex group is locked.
(active_defgroup->flag & DG_LOCK_WEIGHT)
@ -360,0 +379,4 @@
/* Active vgroup index of drawing. */
const int drawing_vgroup_index = BLI_findstringindex(
&curves.vertex_group_names, active_defgroup->name, offsetof(bDeformGroup, name));
BLI_assert(drawing_vgroup_index != -1);
There is no guarantee the active vertex group exists in the drawing. Instead of asserting, it should just skip the drawing (with a
return
) when the vertex group isn't used (drawing_vgroup_index == -1
).@ -360,0 +389,4 @@
}
for (const int i : weights.index_range()) {
const float invert_weight = 1 - weights[i];
Nitpick, but the style-guided way would be
1.0f
.@ -360,0 +408,4 @@
/* api callbacks */
ot->exec = grease_pencil_weight_invert_exec;
ot->poll = grease_pencil_weight_painting_poll;
It would be nicer to have a poll here that checks the existence of any vertex group, e.g.
!BLI_listbase_is_empty(BKE_object_defgroup_list(object))
. Then the menu item will be properly greyed out when there is no vertex group in the object.Thanks @SietseB . I'll make a new PR then to address these points :)