diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-08-13 19:45:20 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-08-14 13:38:23 +0300 |
commit | 55c38f476e6d599eb5377334976ab71b97fe359a (patch) | |
tree | 9fc465afd00645852fa292d7c6287dd7edf73431 /source/blender/editors | |
parent | c47c7a44b202dd6abd635d8809fbbcce7994b7fd (diff) |
Custom Properties: allow changing the property UI to color picker.
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; also, don't use
the custom subtype during RNA path parsing.
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
buffer overruns if the array size is wrong, check the size in
the UI layout code to be safe.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D5475
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 530689f2d27..78eed98eb77 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -648,7 +648,7 @@ static void ui_item_array(uiLayout *layout, * to work with common cases, but may need to be re-worked */ /* special case, boolean array in a menu, this could be used in a more generic way too */ - if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) { + if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand && ELEM(len, 3, 4)) { uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); } else { |