Prepare custom data API for attribute sharing. #95842
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#95842
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?
The custom data api in
BKE_customdata.h
has multiple methods to get a specific layer. For exampleCustomData_get_layer
. The main issue is that these functions are not const correct. They always return a non-constvoid *
and have no idea whether the caller wants to modify the data or not.That is problematic when we want to use attribute sharing, because we have to make a copy of shared attributes when the caller wants to modify the attribute.
The solution is to split every
CustomData_get_*
method in two:*_for_read
method that returns a const pointer, that the caller must never change.*_for_write
method that returns a non-const pointer and internally makes a copy of the data if necessary.With this refactor, the
CustomData_duplicate_referenced_layer_*
functions become redundant, because the*_for_write
methods will make the copy already.Unfortunately, the "convenience pointers" like
Mesh.mvert
make this system quite annoying and error prone:*_for_write
methods, so that the pointer can be updated if necessary.MVert *BKE_mesh_mverts_for_write(Mesh *)
and aconst MVert *BKE_mesh_mvert_for_read(const Mesh *)
method. This refactor is a bit ugly because the direct data access through convenience pointers is very common, but it might be worth it regardless.Added subscriber: @JacquesLucke
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @HooglyBoogly
Added subscriber: @JacobMerrill-1
Added subscriber: @GeorgiaPacific
Added subscriber: @hzuika
This issue was referenced by
cf69652618
This issue was referenced by
e9f82d3dc7
This issue was referenced by
410a6efb74
This issue was referenced by
05952aa94d
This issue was referenced by
3a3d9488a1