GPencil: Scripting weight_get cannot retrieve weights of certain vertex groups #96799
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#96799
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Kubuntu 21.04
Graphics card: AMD Radeon Vega 6 Graphics
Blender Version
Broken: 3.2.0.Alpha (branch: master, commit hash :
6bf51ab03a
, commit date: Fri, 25 Mar 2022 9:33 PM)Short description of error
When points of a stroke belong to just one vertex group and the index of that vertex group is not zero, Python API
weight_get
cannot retrieve weight assigned to points.Not resolved after #91511.
Exact steps for others to reproduce the error
Run script in attached .blend file (bug.blend).
stroke.points.weight_get(0, 0)
results in -1.0stroke.points.weight_get(1, 0)
throwsGroups: index out of range
It seems that the code in
rna_GPencilStrokePoints_weight_get
interpretsvertex_group_index
in two different ways: index indw
arrayMDeformVert
and index of vertex group in object. It checks bounds wrttotweight
but gives weights associated. I have a fix ; I'll see if I can figure out how to attach it here.Added subscriber: @KenyC
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @PratikPB2123
Added subscriber: @antoniov
Changed status from 'Confirmed' to: 'Needs User Info'
I cannot reproduce. I guess you are mixing things in your script. I have done a test file to verify the weight API.
BugWeightAPI.blend
This blend file has a stroke with two vertex group. The first vertex group has assigned a weight of
1.0
to all points. The second vertex group has a0.5
value for all points. Running the script you get this:Changed status from 'Needs User Info' to: 'Confirmed'
I looked again and I was testing the wrong thing.
Indeed, the problem does not arise when there is just one stroke. Looking at the code, the one stroke vs. two strokes difference makes sense. As I understand it,
weight_get
checks bounds onvertex_group_index
wrttotweight
, which is the total number of vertex groups associated with the stroke, not the object.Yes, this is the problem... Fixing it!
This issue was referenced by
343fc38b8d
This issue was referenced by
9450057b43
Changed status from 'Confirmed' to: 'Resolved'