Page MenuHome

Attributes: Add operator to convert generic attributes to other types
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Jan 14 2022, 5:13 PM.
Tags
None
Subscribers
None
Tokens
"Love" token, awarded by YannK."Love" token, awarded by Baga."Love" token, awarded by hitrpr.

Details

Summary

The main goal here is to provide a workaround for until all exporters etc. support generic attributes.

The operator supports converting attributes to uv maps, vertex groups and other generic attributes.



Diff Detail

Repository
rB Blender
Branch
attribute-conversion-operators (branched from master)
Build Status
Buildable 20091
Build 20091: arc lint + arc unit

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Jan 14 2022, 5:13 PM
Jacques Lucke (JacquesLucke) created this revision.
  • Merge branch 'master' into attribute-conversion-operators
  • rename operator
  • add menu
  • implement different modes
Jacques Lucke (JacquesLucke) retitled this revision from Attributes: Add operator to convert attributes to legacy attributes. (WIP) to Attributes: Add operator to convert generic attributes to other types.Jan 20 2022, 4:40 PM
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)
  • support converting to vertex color and add warning

The code looks very straightforward, and I like the design you chose for the conversion options. This looks good to me.

The commit message should have bit more detail than the patch description, and should mention that only meshes are supported currently, but it would be relatively easy to add support for point clouds and hair/curves in the future.

source/blender/editors/geometry/geometry_attributes.cc
52–58

Or this file could be moved to blender::ed::geometry instead, either way.

351

These "identifiers" "api callbacks" and "flags" comments are useless IMO, no need to copy them around.

367

Didn't test it, but what's your opinion on using int(ConvertAttributeMode::UVMap) instead of the full static_cast?

380

A description here is more difficult, but this is a bit too close to the data_type description IMO.
Maybe this is a bit more clear?
Convert to a different generic attribute type or a more specific data type

A bit hard to think of a great description for this one. If nothing seems helpful, having no description at all seems fine.

387

Avoid using the name of the property in its description wherever possible. Here, maybe this would be better:
Which geometry element to move the attribute to

This revision is now accepted and ready to land.Jan 20 2022, 5:53 PM
  • Merge branch 'master' into attribute-conversion-operators
  • cleanup
source/blender/editors/geometry/geometry_attributes.cc
367

I like it, but will stick to static_cast for now given the recent discussion about casts when more nodes were moved to c++.