Regression: Python: removing a color attribute may leave a mesh without an active color attribute #105152
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
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105152
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
Blender Version
Broken: 3.6.0-alpha+main.e497a50aa207
Worked: 3.2
Caused by
6514bb05ea
Short description of error
Removing a color attribute via the
mesh.color_attributes.remove
API can leave the mesh without an active/active render color attribute.This is yet another continuation of #103761.
Exact steps for others to reproduce the error
C.object.data.color_attributes.remove(C.object.data.color_attributes[1])
.Deleting the attribute through the UI, or using Python in 3.2 works correctly.
I looked into this a bit. It seems possible to fix. I just noticed that this has never even worked properly from the UI. When you delete the last attribute in the list, the first attribute becomes active rather than the previous one. That's because it's just calling
next_color_attribute
before deleting the attribute. So this behavior needs some general fixing/cleanup.I wrote this oddity in the comments of an old report, not sure if it's waiting for more verification...
Note :
mesh.vertex_colors.remove()
is also still not handled at allPython: removing a color attribute may leave a mesh without an active color attributeto Regression: Python: removing a color attribute may leave a mesh without an active color attributeDo you think this is something that should be handled in
BKE_id_attribute_remove
?So I guess we need to subclass
CustomDataAttributeProvider
for this?If we want to handle it in the C++ attribute API, which probably makes sense, a good approach might be to add another callback to
MutableAttributeAccessor
which could be called after removing an attribute. Adding more logic toCustomDataAttributeProvider
might work too, but it's also used in situations that don't need the logic, and it would probably be better to keep that part generic.We are one week away from Bcon4 and this is still scheduled for 3.5. Any updates here?
If nobody is working on this, I could give it a try.
Not an ideal solution but here's something that seems to work, at least in edit mode:
Basically just get the index, then remove the attribute, and find the attribute that corresponds with that index now.
I'll see about cleaning this up tomorrow, making sure the index is in range etc.