bpy.ops.gpencil.vertex_group_assign() doesn't work when invoked from the python console #74538
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#74538
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: Linux-5.3.0-40-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21
Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-02-12 16:20, hash:
77d23b0bd7
Worked: (optional)
Short description of error
Having a GP object in Edit Mode with selected vertices and an active vertex group and invoking the bpy.ops.gpencil.vertex_group_assign() operator
from the python console or a script fails to assign the selected vertices to the active vertex group. This also happens in the greasepencil-object branch.
Exact steps for others to reproduce the error
1)Start blender.
2)Add a GP object.
3) Create a stroke.
4) Create a vertex group.
5) Tab into edit mode.
6) Select some vertices.
7) In the python console type bpy.ops.gpencil.vertex_group_assign()
The selected vertices are not assigned to the active vertex group.
Added subscriber: @MarceloGomez
Added subscriber: @iss
Changed status from 'Needs Triage' to: 'Archived'
You need to override context for this operator, see https://docs.blender.org/api/current/bpy.ops.html#overriding-context
Added subscriber: @Ornibulon
Blender version: 3.3.1 master
b292cfe5a9
Tried overriding context and stuff, whatever I test, no problem with operators in bpy.ops.object and bpy.ops.view3d, but operators in bpy.ops.gpencil either execute successfully but don't affect the scene or fail with incorrect context while contect seems coherent with the documentation.
example:
Scene was just a grease pencil stroke, I had selected a few points in edit mode before switching to object mode before running the script.
I am not familiar with context override so that's probably the reason, if someone stumbles on this again could they explain a bit more what Richard Antalik (ISS) meant ?
thanks
@Ornibulon Usually you need to override area and region which seems you have done. If above doesn't work, it could be a bug, so you can make new report for this. But I would encourage you to discuss such issues on one of the community websites: https://www.blender.org/community/
We do not handle user support on this tracker.
ok thanks a lot!
I'll try a bit more and discuss it there.