Fix #105152: Removing color attribute doesn't update active #105871
No reviewers
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#105871
Loading…
Reference in New Issue
No description provided.
Delete Branch "bonj/blender:fix/remove-color-attribute"
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?
It now gets the index before deleting the attribute,
then sets the attribute at that index as active.
Thanks for looking into this. Based on the code, it looks like it's missing moving to the previous active/default index when removing the last color attribute.
Correct, I didn't get around to implementing that last night.
Just doing
max(index, count-1)
should do it I think.No need to check for negative values, because the function I send the index to already checks for that.
I also want to make a utility function to use in the 4 places with copy pasted code.
As well as remove some utility functions that are not used anymore, though perhaps that needs a separate PR.
That sounds great, thanks!
@HooglyBoogly Alright done. This works as it should, but only for meshes; it doesn't affect behavior for Point Cloud or the new Curves type.
I've removed the now unused utility functions in a separate PR #105886.
WIP: Fix #105152 Removing a color attribute may leave a mesh without an active color attributeto Fix #105152 Removing a color attribute may leave a mesh without an active color attributeThis works great. This patch should remove
next_color_attributes
itself to avoid adding warnings, even temporarily. That isn't really a separate IMO cleanup since that implementation is being replaced here.@ -441,0 +466,4 @@
const bool is_default_color_attribute = name == StringRef(mesh->default_color_attribute);
const int active_index = color_name_to_index(id, mesh->active_color_attribute);
const int default_index = color_name_to_index(id, mesh->default_color_attribute);
if (attributes->remove(name)) {
I'd suggest flipping the condition here and returning early instead of indenting the rest of the logic.
@HooglyBoogly Okay it uses an early return in both places now, and I've added the cleanup commit.
Great, the last remaining thing is updating the description/title to match https://wiki.blender.org/wiki/Style_Guide/Commit_Messages
Fix #105152 Removing a color attribute may leave a mesh without an active color attributeto Fix #105152 Removing color attribute doesn't update active@HooglyBoogly I've changed the title and description to hopefully be suitable.
Sorry it took so long, I got distracted.
Fix #105152 Removing color attribute doesn't update activeto Fix #105152: Removing color attribute doesn't update activeI committed this manually to the 3.5 branch:
ea019cf01e
Oh should I have targeted the 3.5 branch?
Anyway thanks!
This caused a failure in the operators test:
https://builder.blender.org/admin/#/builders/166/builds/243
@HooglyBoogly if you manually commit something, there is a "Manually merged" option to link the PR to the commit.
The message is confusing but I just marked this as manually merged, not merged it a second time.