Page MenuHome

Custom Properties: allow changing the property UI to color picker.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Aug 13 2019, 6:45 PM.

Details

Summary

To fully support storing colors as a custom property, it is necessary
to allow switching the property UI to the standard color picker button.
That means in effect supporting custom property subtype values.

Change RNA_property_subtype to look for a 'subtype' string field
in _RNA_UI and parse it as an enum value; to minimize performance
impact, only do it if the property is an array.

On the python side, allow setting some most useful seeming values
from the custom property settings editor.

Also, since some color picker code seems to run into a risk of a
buffer overruns if the array size is wrong, check the size in the
UI layout code to be safe.

Diff Detail

Repository
rB Blender

Event Timeline

Overall seems fine, although it's a bit odd only to expose vector subtypes, I can see why you've done it.

As long as is this patch allows for exposing non-vector subtypes in the future, I don't have any issues with this.

Although it wouuld be good to include this in code-comments that this can be supported later on if we need.

release/scripts/startup/bl_operators/wm.py
1088–1094

Would rather call this sub-type since internally this is used for other kinds of sub-types too.

source/blender/makesrna/intern/rna_access.c
1137–1138

This should be added to RNA_enum_types.h, following the naming convention used there.

eg: rna_enum_property_subtype_array_items.

This revision is now accepted and ready to land.Aug 14 2019, 11:10 AM
release/scripts/startup/bl_operators/wm.py
1088–1094

This can be a tuple, and it should reference the C enum it duplicates.