Fix #103761: creating a color attribute doesn't make it active #105020

Closed
Philipp Oeser wants to merge 3 commits from lichtwerk:103761 into blender-v3.5-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Originally caused by 6514bb05ea

More cases where the active/default color attributes were not set
correctly:

  1. Using the old Python vertex_colors API (vertex_colors.new)
  2. OBJ importer
  3. Collada importer
  4. Data Transfer layout (both standalone operator and "Generate Data
    Layers" from the modifier)

Similar to 101d04f41f.

Brought over from https://archive.blender.org/developer/D16977, see
discussion there why some of the code for data transfer is not for the
genereal attribute API.

Originally caused by 6514bb05ea5a More cases where the active/default color attributes were not set correctly: 1. Using the old Python vertex_colors API (vertex_colors.new) 2. OBJ importer 3. Collada importer 4. Data Transfer layout (both standalone operator and "Generate Data Layers" from the modifier) Similar to 101d04f41ffb. Brought over from https://archive.blender.org/developer/D16977, see discussion there why some of the code for data transfer is not for the genereal attribute API.
Philipp Oeser added 1 commit 2023-02-21 13:45:20 +01:00
abe5d7869a Fix #103761: creating a color attribute doesn't make it active
Originally caused by 6514bb05ea

More cases where the active/default color attributes were not set
correctly:

[1] Using the old Python vertex_colors API (vertex_colors.new)
[2] OBJ importer
[3] Collada importer
[4] Data Transfer layout (both standalone operator and "Generate Data
Layers" from the modifier)

Similar to 101d04f41f.

Brought over from https://archive.blender.org/developer/D16977, see
discussion there why some of the code for data transfer is not for the
genereal attribute API.
Philipp Oeser requested review from Hans Goudey 2023-02-21 13:45:33 +01:00
Philipp Oeser requested review from Martijn Versteegh 2023-02-21 13:45:57 +01:00
Philipp Oeser added this to the Modeling project 2023-02-21 13:46:06 +01:00
Hans Goudey requested changes 2023-02-21 17:57:11 +01:00
@ -253,0 +258,4 @@
static CustomDataLayer *data_transfer_attributes_color_float_find(const ID *id, const char *name)
{
if (!name) {
Member

BKE_id_attribute_find handles the null name case already

`BKE_id_attribute_find` handles the null name case already
@ -253,0 +262,4 @@
return nullptr;
}
CustomDataLayer *layer = BKE_id_attribute_find(id, name, CD_PROP_COLOR, ATTR_DOMAIN_POINT);
if (layer == nullptr) {
Member

Use BKE_id_attribute_search(id, name, CD_MASK_PROP_COLOR, ATTR_DOMAIN_MASK_POINT | ATTR_DOMAIN_MASK_CORNER);

Maybe this function can simplify some of the logic below too.

Use `BKE_id_attribute_search(id, name, CD_MASK_PROP_COLOR, ATTR_DOMAIN_MASK_POINT | ATTR_DOMAIN_MASK_CORNER);` Maybe this function can simplify some of the logic below too.
Author
Member

yeah, that simplifies things, thx!

yeah, that simplifies things, thx!
@ -253,0 +284,4 @@
/**
* When transfering color attributes, also transfer the active color attribute string.
* If a match cant be found, use the first color layer that can be found (to ensure a valid string
Member

cant -> can't

`cant` -> `can't`
Philipp Oeser added 2 commits 2023-02-22 14:40:48 +01:00
bbb8575ee3 Address Code review:
- use BKE_id_attribute_search() to simplify code
- typo in comment
Philipp Oeser requested review from Hans Goudey 2023-02-22 14:43:45 +01:00
Hans Goudey approved these changes 2023-02-22 14:49:38 +01:00
Hans Goudey left a comment
Member

This looks fine to me. Thanks.

It's helpful if you click "Resolve conversation" where you've addressed my comments BTW.

This looks fine to me. Thanks. It's helpful if you click "Resolve conversation" where you've addressed my comments BTW.
@ -253,0 +256,4 @@
* is set).
*/
static void data_transfer_mesh_attributes_transfer_active_color_string(
Mesh *mesh_dst, Mesh *mesh_src, const eAttrDomainMask mask_domain, const int data_type)
Member

const int data_type -> const eCustomDataType data_type

`const int data_type` -> `const eCustomDataType data_type`
Author
Member

Committed acfafeed88

Committed acfafeed88ee5439519ad6b60b56dc2bac9a6202
Philipp Oeser closed this pull request 2023-02-22 15:36:24 +01:00
Philipp Oeser deleted branch 103761 2023-02-23 09:30:00 +01:00

Pull request closed

Sign in to join this conversation.
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
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#105020
No description provided.