Page MenuHome

Attributes: Infrastructure for generic 8-bit integer data type
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Jan 4 2022, 6:26 AM.

Details

Summary

This commit adds infrastructure for 8 bit signed integer attributes.
This can be useful given the discussion in T94193, where we want to
store spline type, Bezier handle type, and other small enums as
attributes.

This is only exposed in the interface in the attribute lists, so it
shouldn't be an option in geometry nodes, at least for now.
I expect that this type won't be used directly very often, it
should mostly be cast to an enum type. However, with support
for 8 bit integers, it also makes sense to add things like mixing
implementations for consistency.

Diff Detail

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Jan 4 2022, 6:26 AM
Hans Goudey (HooglyBoogly) updated this revision to Diff 46573.
Hans Goudey (HooglyBoogly) created this revision.

Fix incorrect change

Brecht Van Lommel (brecht) requested changes to this revision.Jan 5 2022, 2:26 PM

The bigger picture of handling enums in attributes is not obvious to me, but the change seems fine by itself regardless.

For the naming, we have ByteColorAttribute now. Should we then also name this ByteAttribute for consistency? It's also inconsistent that we have for example Float2Attribute where the 2 means 2 components, whereas the 8 here means something different.

This revision now requires changes to proceed.Jan 5 2022, 2:26 PM

What do you think about ByteIntegerAttribute? I'm not sure about ByteAttribute, since there are other data types that only use a byte for storage-- uint8_t in particular.

ByteIntegerAttribute is fine with me.

Hans Goudey (HooglyBoogly) set the repository for this revision to rB Blender.
  • Fix RNA set function
  • Use ByteIntAttribute name
  • Reuse old hair layer type index
  • A few small cleanups

Add missing change to last diff

Base diff on up-to-date master

Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenkernel/intern/type_conversions.cc
106

Doesn't take a.z into account.

source/blender/makesdna/DNA_meshdata_types.h
269

Guess this is unsigned because signed doesn't work for some reason? Should be mentioned in a comment.

source/blender/makesrna/RNA_access.h
327

remove newline

This revision is now accepted and ready to land.Feb 4 2022, 4:32 PM
Hans Goudey (HooglyBoogly) marked 3 inline comments as done.Feb 4 2022, 5:06 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/makesdna/DNA_meshdata_types.h
269

Hrmm, I thought I changed that. int8_t should work fine, it's used elsewhere in DNA.