wrong result in bpy.context.mode (*Postponed until after 2.63*) #30911
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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-addons#30911
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?
%%%Hi,
in some case bpy.context.mode give bad result and use old variable name i think.
Result expected for in texture mode should be TEXTURE_PAINT but it's PAINT_TEXTURE, some for vertex paint and weight paint.
In blender/source/blender/makesrna/intern/rna_context.c, line 147 to 149, i've change in my build:
{CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""},
{CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""},
{CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""},
to
{CTX_MODE_PAINT_WEIGHT, "WEIGHT_PAINT", 0, "Weight Paint", ""},
{CTX_MODE_PAINT_VERTEX, "VERTEX_PAINT", 0, "Vertex Paint", ""},
{CTX_MODE_PAINT_TEXTURE, "TEXTURE_PAINT", 0, "Texture Paint", ""},
and it seem to work normaly.%%%
Changed status to: 'Open'
%%%and in script/startup/bl_ui/space_view3d.py, line 46 to 55 change:
# Select Menu
to:
%%%
%%%asside from this being inconsistent, can you explain how this is a bug? - for eg, can this mis-match cause some error message or blender to fail on some operation?%%%
%%%For exemple you are in scultp or texture mode, you want to make something in object mode and come back in the first mode
cm = bpy.context.mode
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.mode_set(mode=cm, toggle=False)
for sculpt to object, it's work, but for texture mode it don't because cm equal 'PAINT_TEXTURE' and mode from bpy.ops.object.mode_set accepts only 'TEXTURE_PAINT'.
But it's the same probleme for vertex paint and weight paint.
%%%
%%%I'd say it's not actually a bug, but more like mis-usage of api: you're getting mode from context and applying it on object. You need to get mode from active object, not context's mode.
Making this more consistent makes sense but i'd rather not do such changes before upcoming release.
Final word for Campbell :)%%%
%%%ok, i'll use the object's context.
Thanks%%%
%%%This context.mode is quite different from object.mode, for edit mode it can't match anyway, so don't think we should change it, better not even try to use it this way.%%%
Changed status from 'Open' to: 'Archived'