Fix #119586: Vertex paint mode crash after converting color attribute #119657

Merged
Hans Goudey merged 3 commits from HooglyBoogly/blender:fix-paint-color-name-crash into blender-v4.1-release 2024-03-19 19:49:10 +01:00
Member

Converting a color attribute to a non-color domain or type causes vertex
paint mode to try to change the attribute even though it's unsupported.
That leads to a crash here and unpredictable behavior elsewhere.

This PR modifies some poll functions to check for the proper domain and
data type before continuing. Even if converting an attribute properly
updates the active color attribute, we can still run into situations where
the active name references an attribute with incorrect metadata.

Converting a color attribute to a non-color domain or type causes vertex paint mode to try to change the attribute even though it's unsupported. That leads to a crash here and unpredictable behavior elsewhere. This PR modifies some poll functions to check for the proper domain and data type before continuing. Even if converting an attribute properly updates the active color attribute, we can still run into situations where the active name references an attribute with incorrect metadata.
Hans Goudey added 1 commit 2024-03-19 13:37:53 +01:00
e1a1d53201 Fix #119586: Vertex paint mode crash after converting color attribute
Converting a color attribute to a non-color domain or type causes vertex
paint mode to try to change the attribute even though it's unsupported.
That leads to a crash here and unpredictable behavior elsewhere.

This PR modifies some poll functions to check for the proper domain and
data type before continuing. Even if converting an attribute properly
updates the active color attribute, we can still run into situations where
the active name references an attribute with incorrect metadata.
Hans Goudey requested review from Pratik Borhade 2024-03-19 13:42:54 +01:00
Hans Goudey added this to the 4.1 milestone 2024-03-19 13:43:00 +01:00
Pratik Borhade reviewed 2024-03-19 16:36:06 +01:00
Pratik Borhade left a comment
Member

Hi, looks correct to me.
We still need to change active_colot_attribute otherwise new color attribute is added after converting the attribute if

  • we toggle vertex paint mode
  • call Paint > Vertex colors from Weight
    Which is wrong 🙂
Hi, looks correct to me. We still need to change `active_colot_attribute` otherwise new color attribute is added after converting the attribute if - we toggle `vertex paint mode` - call `Paint > Vertex colors from Weight` Which is wrong 🙂
@ -597,6 +597,24 @@ void smooth_brush_toggle_on(const bContext *C, Paint *paint, StrokeCache *cache)
/** \} */
} // namespace blender::ed::sculpt_paint::vwpaint
static bool attribute_supported(const std::optional<bke::AttributeMetaData> meta_data)
Member

maybe color_attribute_supported? :)

maybe `color_attribute_supported`? :)
HooglyBoogly marked this conversation as resolved
Hans Goudey added 1 commit 2024-03-19 16:41:33 +01:00
f98c724a36 Fix #119177: False positive dyntopo attribute detection warning
".sculpt_mask" is handled as a special case for dynamic topology
but wasn't detected that way in the warning.
Author
Member

Hi, looks correct to me.
We still need to change active_colot_attribute otherwise new color attribute is added after converting the attribute

Yeah, I thought this PR could focus on solving the crash, then the pressure would be reduced for correcting the active color attribute name. But we should still do that in your PR. Does that sound okay to you?

> Hi, looks correct to me. > We still need to change `active_colot_attribute` otherwise new color attribute is added after converting the attribute Yeah, I thought this PR could focus on solving the crash, then the pressure would be reduced for correcting the active color attribute name. But we should still do that in your PR. Does that sound okay to you?
Hans Goudey force-pushed fix-paint-color-name-crash from 760d053500 to aec781c0c6 2024-03-19 16:43:32 +01:00 Compare
Author
Member

Oops, I merged the wrong branch here. Corrected with a force push.

Oops, I merged the wrong branch here. Corrected with a force push.
Pratik Borhade approved these changes 2024-03-19 17:54:08 +01:00
Pratik Borhade left a comment
Member

👍

Yeah, I thought this PR could focus on solving the crash,... But "correcting the active color attribute name" we should still do that in your PR.

No problem :)

👍 > Yeah, I thought this PR could focus on solving the crash,... But "correcting the active color attribute name" we should still do that in your PR. No problem :)
Author
Member

@blender-bot build

@blender-bot build
Hans Goudey merged commit 3641b4b884 into blender-v4.1-release 2024-03-19 19:49:10 +01:00
Hans Goudey deleted branch fix-paint-color-name-crash 2024-03-19 19:49:16 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#119657
No description provided.