Fix: Skip anonymous CustomData layers for the python API #104783

Merged
Martijn Versteegh merged 5 commits from Baardaap/blender:skipanonymousuvlayers into main 2023-02-15 23:55:01 +01:00

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.

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.
Martijn Versteegh added 1 commit 2023-02-15 15:29:14 +01:00
Author
Member

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.

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.

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.
Hans Goudey reviewed 2023-02-15 17:33:22 +01:00
@ -2994,0 +2995,4 @@
{
int number = 0;
for (int i = 0; i < data->totlayer; i++) {
Member

How about for (const CustomDataLayer &layer : Span(data->layers, data->totlayer)) {?

How about `for (const CustomDataLayer &layer : Span(data->layers, data->totlayer)) {`?
Author
Member

Can do, but then maybe change CustomData_get_number_of_layers() as well?

Can do, but then maybe change CustomData_get_number_of_layers() as well?
Member

Mainly I just think new code should be "clean", even if slightly inconsistent with the surrounding area. Cleaning up existing code is another task.

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)
Member

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 macro

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 macro
Author
Member

Are 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.

Are 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.
Author
Member

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.

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'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. 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'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.

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) /

> > 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. > > 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) /
Martijn Versteegh added 2 commits 2023-02-15 19:20:16 +01:00
Hans Goudey requested changes 2023-02-15 19:31:09 +01:00
Hans Goudey left a comment
Member

Looking good. I can't really accept this without a PR description though.

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)) {
Member

Better to leave these cleanups out IMO, and not mix cleaning up existing code with a bug fix.

Better to leave these cleanups out IMO, and not mix cleaning up existing code with a bug fix.
Author
Member

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.

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.
Member

That's fine too. The more important part is not mixing cleanups with fixes too much.

That's fine too. The more important part is not mixing cleanups with fixes too much.
Martijn Versteegh added 1 commit 2023-02-15 21:51:45 +01:00
Martijn Versteegh requested review from Hans Goudey 2023-02-15 21:52:52 +01:00
Martijn Versteegh added 1 commit 2023-02-15 21:53:18 +01:00
Hans Goudey changed title from Fix: Skip anonymous uv layers for the python API to Fix: Skip anonymous UV layers for the python API 2023-02-15 21:57:36 +01:00
Hans Goudey approved these changes 2023-02-15 22:06:56 +01:00
Martijn Versteegh changed title from Fix: Skip anonymous UV layers for the python API to Fix: Skip anonymous layers for the python API 2023-02-15 22:10:42 +01:00
Martijn Versteegh changed title from Fix: Skip anonymous layers for the python API to Fix: Skip anonymous CustomData layers for the python API 2023-02-15 22:10:53 +01:00
Martijn Versteegh merged commit b1abc23899 into main 2023-02-15 23:55:01 +01:00
Martijn Versteegh deleted branch skipanonymousuvlayers 2023-02-15 23:55:01 +01:00
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#104783
No description provided.