USD IO: Move to the new Mesh attributes API for colors #104542

Closed
Charles Wardlaw wants to merge 1 commits from CharlesWardlaw/blender:D16103-mesh-color-attributes into main

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

Moving patch over from Phabricator: https://archive.blender.org/developer/D16103

This revision moves the vertex color reading and writing in the USD import and export functions over to the new Mesh Attributes API. I have removed anything else (new features or unnecessary changes) that was present in the prior patches to focus only on this task.

On the import side, I've introduced a class method named read_custom_data. In this function is the call-out for reading mesh colors. As requested, this function is intended to be the starting point for future Attribute reads, with methods like the new read_color_data* methods being called when a USD primvar matches a specific heuristic. UVs will (in the future, not in this revision) also need to be processed here. In a later patch, any primvars that do not match a heuristic can be imported as generic Attributes. There is a matching function on the export side, write_custom_data.

Attached is a .blend file for testing. The plane has five Color Attributes. The colors should be visibly the same when exported and re-imported.

I have also enabled color attribute imports by default. I believe it would be counter intuitive for most users for this feature to be off-- it means that at some point, a person round-tripping with default settings will lose data.

Moving patch over from Phabricator: https://archive.blender.org/developer/D16103 This revision moves the vertex color reading and writing in the USD import and export functions over to the new Mesh Attributes API. I have removed anything else (new features or unnecessary changes) that was present in the prior patches to focus only on this task. On the import side, I've introduced a class method named read_custom_data. In this function is the call-out for reading mesh colors. As requested, this function is intended to be the starting point for future Attribute reads, with methods like the new read_color_data* methods being called when a USD primvar matches a specific heuristic. UVs will (in the future, not in this revision) also need to be processed here. In a later patch, any primvars that do not match a heuristic can be imported as generic Attributes. There is a matching function on the export side, write_custom_data. Attached is a .blend file for testing. The plane has five Color Attributes. The colors should be visibly the same when exported and re-imported. I have also enabled color attribute imports by default. I believe it would be counter intuitive for most users for this feature to be off-- it means that at some point, a person round-tripping with default settings will lose data.
Charles Wardlaw added 1 commit 2023-02-09 20:04:38 +01:00
Hans Goudey changed title from Moving patch over from Phabricator to USD IO: Move to the new Mesh attributes API for colors 2023-02-09 20:10:00 +01:00
Hans Goudey added this to the Pipeline, Assets & IO project 2023-02-09 20:52:31 +01:00
Bastien Montagne modified the project from Pipeline, Assets & IO to USD 2023-02-10 12:47:06 +01:00
Member

Does this handle mesh->active_color_attribute (e.g. when there were no color attributes there prior) ?

Does this handle `mesh->active_color_attribute` (e.g. when there were no color attributes there prior) ?

@CharlesWardlaw When reading mesh colors, please add logic to set the mesh active color, as in this recent fix to the USD branch:

5ea31db2ce

@CharlesWardlaw When reading mesh colors, please add logic to set the mesh active color, as in this recent fix to the USD branch: https://projects.blender.org/blender/blender/commit/5ea31db2ce88a6f9131a362a8dea54ab57d0192d
Charles Wardlaw closed this pull request 2023-03-31 19:24:47 +02:00
Bastien Montagne removed this from the USD project 2023-08-25 23:52:58 +02:00

Pull request closed

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