Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-08-13 19:45:20 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-08-14 13:38:23 +0300
commit55c38f476e6d599eb5377334976ab71b97fe359a (patch)
tree9fc465afd00645852fa292d7c6287dd7edf73431 /release/scripts/modules/rna_prop_ui.py
parentc47c7a44b202dd6abd635d8809fbbcce7994b7fd (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 'release/scripts/modules/rna_prop_ui.py')
-rw-r--r--release/scripts/modules/rna_prop_ui.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index b568f9835a0..2ff6c3fc1b0 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -159,6 +159,7 @@ def rna_idprop_ui_create(
soft_min=None, soft_max=None,
description=None,
overridable=False,
+ subtype=None,
):
"""Create and initialize a custom property with limits, defaults and other settings."""
@@ -195,6 +196,9 @@ def rna_idprop_ui_create(
if default and (not is_array or any(default)):
rna_ui["default"] = default
+ if is_array and subtype and subtype != 'NONE':
+ rna_ui["subtype"] = subtype
+
# Assign other settings
if description is not None:
rna_ui["description"] = description