Attribute identification and semantics #97452
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
10 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#97452
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?
We are in the process of unifying the geometry attribute system in Blender. To continue with that, we have to make a decision on how to deal with different kinds of attributes and their relations.
Attribute Kinds
Below is a list of the different kinds of attributes we know of. It's unknown whether there are more.
my_mask
a float attribute on the point domain.position
on meshes.Attribute Relations
Some higher level concepts have to store more than one piece of data for each element.
For example, each uv layer has to store the actual uv coordinate and a selection/pin state for each face corner.
Currently, this data is packed together into a single struct (
MLoopUV
).This is not ideal because:
For these reasons, we want to split
MLoopUV
and similar types into separate attributes. There still has to be some relation between these attributes.Proposal
How these design problems are solved mostly depends on how we want to identify attributes.
Domain + CustomDataType + Name
(whereby the name could be empty for someCustomDataTypes
).Name
.There seem to be two main ways to move forward:
AttributeKind
enumCustomDataType
but it would only encode the semantics of an attribute (CustomDataType
mixes the concepts of semantic and data type).ATTR_KIND_UI
,ATTR_KIND_ANONYMOUS
,ATTR_KIND_GENERIC
,ATTR_KIND_UV_LAYER_PIN
, ...AttributeKind + Name
.Name
..
)..a_
for anonymous attributes (e.g..a_23425234
)..uv_pinned_
for uv layer pinning (e.g..uv_pinned_UVMap
, that corresponds to theUVMap
layer)..select_vertex
for vertex selection.sculpt_mask_vertex
for masking in sculpt mode.CustomData
currently)..uv_pinned_
layer (or it is only created when it's first used).Personally, I prefer option (B).
.
attributes anyway.Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @JacquesLucke
Added subscriber: @HooglyBoogly
Added subscriber: @Baardaap
Just to clarify: In option A) the linked layers would share the same name? Do I read that correctly?
I also prefer option B, with the added remark that we would need to male sure the maximum name length of 64 chars is dropped. Encoding subtypes in the name would make it easier for code to add subtypes for a specific task without needing to edit a global enum in a headerfile. Considering changing such an ENUM would probably cause a full recompile I would rather avoid that.
Yes correct.
That's right. At least for some of the use cases that is necessary. Just changing
char[64]
tochar*
sounds like a good option to me, We could keep thechar[64]
around for forward compatibility in theory, but actually maintaining forward compatibility with the proposed changes may prove to be tricky.I'm not too much concerned about a full recompile (vs. a partial recompile) since I don't expect that to happen very often. I do think it's good to avoid having a global enum for this though.
Added subscriber: @filedescriptor
Maybe instead of the prefix, which feels a bit arbitrary, we could use the
CustomDataLayer.flag
and something likeCD_FLAG_ATTR_BUILTIN
orCD_FLAG_RESERVED
?Well, that is what option (A) is, with the described pros and const.
But I don't think an enum to encode the semantics is the right choice. Using the name there feels a lot more logical. So I would still use e.g.
select_
as the prefix, just unsure about the>
(or whatever it might be in the end). But maybe that's not an issue.How is having a flag vs having the enum different for you? In both cases attributes would have to be identified by
Some Number + Name
instead of justName
.Obviously using something like a
>
prefix (for attributes the name of which users don't usually see) is not entirely pretty. So far I still think it's the best solution. But I could still change my mind in light of better arguments. When Hans and I discussed we were also on the fence about this exact topic.[edit] In theory the prefix could just be skipped of course. The reason it's there is to make it less likely that there are name collisions with user generated attributes, especially when we add more of these "private attributes" over time.
The > prefix might not be ideal. But some other less common character (dare I say an 'escape code', i.e. char 27? Though for exporting it might be a bad idea to use unprintables ) would never clash with user typed names. I think it's a very nice property that a single key (the name) uniquely identiefies a layer. makes it easier to keep things in sync.
But it does need some extra string-scanning on layer rename to find dependant layers. So all in all it's not a great difference with the global enum.
On the one hand I agree that adding sublayers will probably not happen often. On the other hand when you are in the process of adding new layers and the code is still in a state of flux you can end up renaming stuff quite often. Speaking from experience here ;-).
Added subscriber: @lichtwerk
Added subscriber: @brecht
.
is common for hiding things. USD has a concept of namespaces with names likenamespace:attr
. Starting with>
seems a bit weird to me, but also I guess is unlikely to clash with existing names from .blend or other files. FWIW I think primvar (=attribute) names in USD are restricted like this:.mesh.positions
ormesh.vertex_selection
? And then looping over the full attributes you could still discover them, but it would not be recommended to use e.g.mesh.attributes['>select_vertex']
.In reply to Brechts 3d+4th point.
Yes, we would keep API compatibility. But what I'm wondering is what would recommend for API users. For UI attributes, just keep using the existing API as the most convenient method?
I can see how it would work, it's just not clear to me that the code complexity and risks for things going out of sync is worth it.
Oh, the seam layer is edge-data probably? That would mean a dependency across a domain. I can see that being more of a hassle indeed. Though the 'keeping stuff in sync' would only mean to handle layer renames/deletes, so not too complicated I'd think.
That's correct.
I'm not particularly attached to using
>
. Using.
is fine as well, there just might be a larger risk that people are using that prefix for other purposes as well, because it is a more common convention.I think we'd generally recommend using properties we provide for convinience as you suggest.
I'm also not aware of other cases where associated attributes are needed, but I wouldn't rule it out. Either way, I think in cases where we do want to support it, just matching them by name seems reasonably straight forward to me. Given that all attributes are identified by name, it would also be fairly easy to debug issues when stuff goes out of sync for some reason.
Didn't think too much about how that would be used. Do you mean that a UV unwrap nodes just updates the uvs for unpinned face corners? Seems reasonable, but I'd expect that to be a normal selection in geometry nodes, and not a special built-in or associated attribute.
Added subscriber: @Erindale
Added subscriber: @mont29
Regarding the original main question, I am fine with encoding the semantic in names, as suggested in option (B).
I would also favor following some already reasonable standard (like the one from USD as suggested by @brecht) when it comes to what we consider valid names, and syntax for things like namespace/'hidden' values. I do not see much added value to having our own here, besides potential extra hassle when converting to other formats (like USD).
Added subscriber: @zNight
The implementation is probably not so bad. For this to be actually useful it would also need per UV map seams which I guess is the more complex part to implement. It just seems unnecessary to me, but I might be missing practical use cases.
Yes, UV unwrap would only updated unpinned UVs, and the pinned ones influence the position and shape of the rest of the UV island. This is more theoretical as procedural workflows and are not as likely to use pinning. The attribute is no more special than seams.
I changed the proposal to use
.
instead of>
. I left the "pinned uv" part in, just as a demonstration for how associated attributes could work, in case we decide to use them in the future.Here are some UI attributes that we'll need in the near future (this week?) for curves:
.selection_float_point
.selection_bool_point
.selection_bool_curve
Edit: "Mask" is now just called selection too, to unify the concepts between modes.
Maybe better to use vertex_selection and edge_selection as example. As those are clear-cut examples of a case of associated attributes. We need vertex_selection and edge_selection with each uv map. At least if we want to keep the selection behaviour the same as it is in current blender versions where all three bools are packed in with the MLoopUV struct and the selection status is preserved when switching uv maps.
This issue was referenced by
9913196470
Changed status from 'Confirmed' to: 'Resolved'