Define name of built-in attributes #82693

Closed
opened 2020-11-13 15:55:43 +01:00 by Dalai Felinto · 17 comments

Naming rule for attributes


  • built-in attribute use "snake_case"
    • position
    • rotation
    • radius
  • user defined attributes are initialiazed as "PascalCase", but can be renamed later to anything (unicodes, space, lowercase)
    • Col
    • Group
    • UVMap
    • FaceMap
    • Key

In both cases abbreviations are to be avoided. If they eventually happen, should be lower case for the built-in attributes. For user defined attributes they can be decided on a per-case basis.

Reference


  • lowercase
  • snake_case
  • camelCase
  • PascalCase
  • A combination of snake and camel case Written_Like_This

MaterialX: lowercase .e.g materialassign, variantset (example)

Blender datablocks uses "Title Case" and PascalCase:

  • View Layer
  • ParticleSettings

Built-in attributes:


  • density
  • position
  • radius
  • rotation
  • scale
  • temperature

Design presented on: https://wiki.blender.org/wiki/Source/Nodes/Modifier_Nodes#Attributes

Naming rule for attributes **** * built-in attribute use "snake_case" * position * rotation * radius * user defined attributes are initialiazed as "PascalCase", but can be renamed later to anything (unicodes, space, lowercase) * Col * Group * UVMap * FaceMap * Key In both cases abbreviations are to be avoided. If they eventually happen, should be lower case for the built-in attributes. For user defined attributes they can be decided on a per-case basis. Reference **** * lowercase * snake_case * camelCase * PascalCase * A combination of snake and camel case `Written_Like_This` MaterialX: lowercase .e.g `materialassign, variantset` ([example](https://graphics.pixar.com/usd/docs/api/usd_mtlx_page_front.html)) Blender datablocks uses "Title Case" and PascalCase: * View Layer * ParticleSettings Built-in attributes: **** * `density` * `position` * `radius` * `rotation` * `scale` * `temperature` Design presented on: https://wiki.blender.org/wiki/Source/Nodes/Modifier_Nodes#Attributes
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Member

Added subscriber: @pablovazquez

Added subscriber: @pablovazquez
Member

I think we should try to keep names shorter, since they will be used a lot in expressions.
Possibly supporting multiple names for built-in attributes. A longer, more descriptive name and a short-form version.

Proposal:

  • Location: P, position, (also location for compatibility?)
  • Rotation: R, rotation (also orientation, orient for compatibility?)
  • Scale: S, scale

Other names we could have by default for points/particles:

  • Age: age
  • Density: density
  • Temperature: temperature
  • Normal: N, normal
  • Velocity: V, velocity
  • Radius: r, radius
  • Point Number: index
  • Up (vector pointing up): up
I think we should try to keep names shorter, since they will be used a lot in expressions. Possibly supporting multiple names for built-in attributes. A longer, more descriptive name and a short-form version. Proposal: * Location: `P`, `position`, (also `location` for compatibility?) * Rotation: `R`, `rotation` (also `orientation`, `orient` for compatibility?) * Scale: `S`, `scale` Other names we could have by default for points/particles: * Age: `age` * Density: `density` * Temperature: `temperature` * Normal: `N`, `normal` * Velocity: `V`, `velocity` * Radius: `r`, `radius` * Point Number: `index` * Up (vector pointing up): `up`

Added subscriber: @SteffenD

Added subscriber: @SteffenD
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Can we get a set of rules for the names? Should the names be lower case always/usually. What about spaces? Should underscores be used instead? Do we want to enforce these rules (could be useful for expressions)?
What do we do if existing vertex groups do not follow these rules, are they just not accessible in geometry nodes?

I think giving attributes multiple names is calling for trouble. Having a single name will make things simpler. Maybe it makes sense to provide tooltips for some common attributes like P, but not sure if it is worth it.

Can we get a set of rules for the names? Should the names be lower case always/usually. What about spaces? Should underscores be used instead? Do we want to enforce these rules (could be useful for expressions)? What do we do if existing vertex groups do not follow these rules, are they just not accessible in geometry nodes? I think giving attributes multiple names is calling for trouble. Having a single name will make things simpler. Maybe it makes sense to provide tooltips for some common attributes like P, but not sure if it is worth it.

Added subscriber: @brecht

Added subscriber: @brecht

Talked to Dalai and Bastien about this, summarizing some of the points I made:

  • Most existing data names in Blender are capitalized full words, and in the few cases where multiple words are used they use camel case rather than spaces. This also goes for uv maps and vertex colors, which are also a type of attribute. The current naming was intended to be consistent with that.
  • We could also aim for interop with other applications, especially for file formats like USD, Alembic. Unfortunately there is no universal convention there, and names are often cryptic abbreviations that have no clear meaning in Blender. Those names can be translated to/from Blender conventions on import/export, which is only a heuristic but should work ok in practice. Also note that you'd have to do this type of translations for e.g. MaterialX shaders reading attributes, not just the geometry itself.
  • To the extent that there is a convention in similar 3D apps, it seems to be either an abbreviation with capital letter (P, Pref, Cd) or a lowecase name (uv, st, width, pscale, ..)
  • For volumes we use lowercase names for grids (density and temperature), because that is the OpenVDB convention.
  • I would not support multiple names for the same attributes, makes it harder to follow docs, tutorials, and interchange .blend or other files. Builtin geometry nodes can hide the difference to some extent, but at some point that stops and users have to deal with incompatibilities.
  • I would not strictly enforce conventions about case or spaces, for consistency with the rest of Blender and for easier interop with other apps. I would not use spaces and underscores by default but still allow them.
  • Rotation and orientation are like scale and size, one is relative the other is absolute. For instancing, I think relative terms make most sense. And they also makes sense for point clouds as a multiplier on some global radius.

Personally my recommendation is not to use abbreviations at all, which makes it a choice between capitialization or all-lowercase. Either works for me, depends if we prefer to be consistent with other default Blender data names, or if we consider it harmful or helpful that geometry attributes have a distinct naming convention. If we do change it to lowercase, I'd recommend changing default uv map and vertex color names to lowercase as well.

Talked to Dalai and Bastien about this, summarizing some of the points I made: * Most existing data names in Blender are capitalized full words, and in the few cases where multiple words are used they use camel case rather than spaces. This also goes for uv maps and vertex colors, which are also a type of attribute. The current naming was intended to be consistent with that. * We could also aim for interop with other applications, especially for file formats like USD, Alembic. Unfortunately there is no universal convention there, and names are often cryptic abbreviations that have no clear meaning in Blender. Those names can be translated to/from Blender conventions on import/export, which is only a heuristic but should work ok in practice. Also note that you'd have to do this type of translations for e.g. MaterialX shaders reading attributes, not just the geometry itself. * To the extent that there is a convention in similar 3D apps, it seems to be either an abbreviation with capital letter (`P`, `Pref`, `Cd`) or a lowecase name (`uv`, `st`, `width`, `pscale`, ..) * For volumes we use lowercase names for grids (`density` and `temperature`), because that is the OpenVDB convention. * I would not support multiple names for the same attributes, makes it harder to follow docs, tutorials, and interchange .blend or other files. Builtin geometry nodes can hide the difference to some extent, but at some point that stops and users have to deal with incompatibilities. * I would not strictly enforce conventions about case or spaces, for consistency with the rest of Blender and for easier interop with other apps. I would not use spaces and underscores by default but still allow them. * Rotation and orientation are like scale and size, one is relative the other is absolute. For instancing, I think relative terms make most sense. And they also makes sense for point clouds as a multiplier on some global radius. Personally my recommendation is not to use abbreviations at all, which makes it a choice between capitialization or all-lowercase. Either works for me, depends if we prefer to be consistent with other default Blender data names, or if we consider it harmful or helpful that geometry attributes have a distinct naming convention. If we do change it to lowercase, I'd recommend changing default uv map and vertex color names to lowercase as well.
Member

Thanks for the feedback. I don't have a strong opinion on whether capitalization or all-lowercase should be the convention then.

Thanks for the feedback. I don't have a strong opinion on whether capitalization or all-lowercase should be the convention then.

Also should mention that vertex groups are capitalized and I imagine will be accessible as attributes in geometry nodes. And those names are matched with bone names for armature deform. Changing to lowercase may just be more trouble than it is worth.

The volume grids inconsistency is not great. We could also capitalize/lowercase on import/export there. For render engines that directly read OpenVDB or USD files any renaming on import/export is also a pain, but I guess they have to deal with that regardless of the convention we choose.

Also should mention that vertex groups are capitalized and I imagine will be accessible as attributes in geometry nodes. And those names are matched with bone names for armature deform. Changing to lowercase may just be more trouble than it is worth. The volume grids inconsistency is not great. We could also capitalize/lowercase on import/export there. For render engines that directly read OpenVDB or USD files any renaming on import/export is also a pain, but I guess they have to deal with that regardless of the convention we choose.
Author
Owner

@pablovazquez and I came up with this proposal:

  • built-in attribute use "snake_case"
    • position
    • rotation
    • radius
  • user defined attributes are initialiazed as "PascalCase", but can be renamed later to anything (unicodes, space, lowercase)
    • Col
    • Group
    • UVMap
    • FaceMap
    • Key

Reference


  • lowercase
  • snake_case
  • camelCase
  • PascalCase
  • A combination of snake and camel case Written_Like_This

MaterialX: lowercase .e.g materialassign, variantset (example)

Blender datablocks uses "Title Case" and PascalCase:

  • View Layer
  • ParticleSettings
@pablovazquez and I came up with this proposal: * built-in attribute use "snake_case" * position * rotation * radius * user defined attributes are initialiazed as "PascalCase", but can be renamed later to anything (unicodes, space, lowercase) * Col * Group * UVMap * FaceMap * Key Reference **** * lowercase * snake_case * camelCase * PascalCase * A combination of snake and camel case `Written_Like_This` MaterialX: lowercase .e.g `materialassign, variantset` ([example](https://graphics.pixar.com/usd/docs/api/usd_mtlx_page_front.html)) Blender datablocks uses "Title Case" and PascalCase: * View Layer * ParticleSettings

I'm fine with that proposal.

I'm fine with that proposal.

Added subscriber: @Sergey

Added subscriber: @Sergey

Background: I was randomly pointed to this task.

Here are two easy steps to dramatically improve quality of the proposal.

  1. Have up-to-date conclusion in the task description. Just similar to what we do for reports. Make it easy for everyone to see what's what.

  2. Explicitly cover abbreviations. If they are unused at all, state so. If they are forbidden, state so. If there are any case when they might appear from (user attributes, for example) make explicit whether it is only first letter to be capital, or all of them (within the abbreviation).

Background: I was randomly pointed to this task. Here are two easy steps to dramatically improve quality of the proposal. 1. Have up-to-date conclusion in the task description. Just similar to what we do for reports. Make it easy for everyone to see what's what. 2. Explicitly cover abbreviations. If they are unused at all, state so. If they are forbidden, state so. If there are any case when they might appear from (user attributes, for example) make explicit whether it is only first letter to be capital, or all of them (within the abbreviation).
Author
Owner
Migrated the text to the wiki: https://wiki.blender.org/wiki/Source/Nodes/Modifier_Nodes#Attributes
Author
Owner

@Sergey thanks for the feedback. I addressed your 1st point. For the second I feel it is a bit premature to set a rule to a case I can't even think already. So I phrased in a way that leaves some leeway for when it comes to that while covering it for built-in attributes.

@Sergey thanks for the feedback. I addressed your 1st point. For the second I feel it is a bit premature to set a rule to a case I can't even think already. So I phrased in a way that leaves some leeway for when it comes to that while covering it for built-in attributes.
Author
Owner

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Dalai Felinto self-assigned this 2020-11-30 09:27:26 +01:00
Sign in to join this conversation.
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
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#82693
No description provided.