Fix: Skip anonymous CustomData layers for the python API #104783
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#104783
Loading…
Reference in New Issue
No description provided.
Delete Branch "Baardaap/blender:skipanonymousuvlayers"
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?
Now that the UV map names are read from the evaluated mesh the names of the anonymous layers would show up in the UV Map node and be accessible via the python interface.
This changes the collection definition to skip anonymous layers.
Codewise it would be more logical to have CustomData_get_number_of_nonanonymous_layers() But I don't really like the 'nonanonymous' part for readability.
I'm surprised and it seems strange to give the user access to anonymous attributes. It seemed to me that this was just the specifics of the implementation of computational abstraction.
@ -2994,0 +2995,4 @@
{
int number = 0;
for (int i = 0; i < data->totlayer; i++) {
How about
for (const CustomDataLayer &layer : Span(data->layers, data->totlayer)) {
?Can do, but then maybe change CustomData_get_number_of_layers() as well?
Mainly I just think new code should be "clean", even if slightly inconsistent with the surrounding area. Cleaning up existing code is another task.
@ -965,3 +965,3 @@
/* uv_layers */
DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_PROP_FLOAT2)
DEFINE_CUSTOMDATA_LAYER_COLLECTION_SKIP_ANONYMOUS(uv_layer, ldata, CD_PROP_FLOAT2)
Looking at all the uses of
DEFINE_CUSTOMDATA_LAYER_COLLECTION
, I think it would be fine to just modify it instead of adding a new macroAre we sure there's no place where an anonymous layer needs to be exposed to python? Probably not indeed. I'll take a look at all uses of that macro.
What do you mean to say? The anonymous layers showing up is a side effect of the uv layers being listed from the evaluated object instead of the original. It's not on purpose.
I mean, if you didn't get it by link in the geometry node tree space, then there shouldn't be (at least from a design standpoint, it's context data where it's needed, without explicitly creating a named attribute, it doesn't should be available) /
Looking good. I can't really accept this without a PR description though.
@ -2984,3 +2984,2 @@
for (int i = 0; i < data->totlayer; i++) {
if (data->layers[i].type == type) {
for (const CustomDataLayer &layer : Span(data->layers, data->totlayer)) {
Better to leave these cleanups out IMO, and not mix cleaning up existing code with a bug fix.
Hm, I have some mental problems to use the modern syntax for the new function, but leave the two analogous ones directly below it in the old synax.
Then I'd prefer to use the same (old) syntax for the new function.
That's fine too. The more important part is not mixing cleanups with fixes too much.
Fix: Skip anonymous uv layers for the python APIto Fix: Skip anonymous UV layers for the python APIFix: Skip anonymous UV layers for the python APIto Fix: Skip anonymous layers for the python APIFix: Skip anonymous layers for the python APIto Fix: Skip anonymous CustomData layers for the python API