Page MenuHome

GPencil: Scripting weight_get and Vertex Groups not working at expected with several groups
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 960M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 391.25

Blender Version
Broken: version: 2.93.1, branch: master, commit date: 2021-06-22 05:57, hash: rB1b8d33b18c2f{F10481110}

Short description of error

  • weight_get will result in a vertex_group index error (RuntimeError: Error: Groups: index out of range) even when the stroke is weight-painted completely
  • Running weight_set along stroke first, weight-painting manually, and then running weight_get will not throw the error (most of the time).
  • The vertex_group index property of weight_get will result in a (RuntimeError: Error: Groups: index out of range) if a lower vertex_group index property had resulted in an index out of range error.

Exact steps for others to reproduce the error
See attached blend.

I've included 3 examples:
A try and except script to get the vertex weight of 4 strokes which fails on 3 upper vertex group indices.
A script that sets the vertex weight of all points to 0 and after which when you weight paint manually and rerun the first script, you get the vertex weight successfully
A script where you create the vertex_group and set them with a specific value successfully, but when you try to read them back with weight_get, it results with a vertex group index out of range

Event Timeline

Antonio Vazquez (antoniov) changed the task status from Needs Triage to Confirmed.Sep 20 2021, 11:02 AM
Antonio Vazquez (antoniov) claimed this task.
Antonio Vazquez (antoniov) changed the subtype of this task from "Report" to "Bug".

The problem is checking the number of available weights.

Antonio Vazquez (antoniov) renamed this task from Greasepencil Scripting weight_get and Vertex Groups to GPencil: Scripting weight_get and Vertex Groups not working at expected with several groups.Sep 20 2021, 11:10 AM