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:
authorHans Goudey <h.goudey@me.com>2021-09-23 05:56:54 +0300
committerHans Goudey <h.goudey@me.com>2021-09-23 05:57:33 +0300
commitbf948b2cef3ba340a6bba5e7bd7f4911c9a9275a (patch)
treee9b09f812e28bb287a00a66a913ef8e140dda561 /release/scripts/modules/rna_prop_ui.py
parent6e77afe6ec7b6a73f218f1fef264758abcbc778a (diff)
Custom Properties: Rewrite edit operator, improve UX
This commit changes the custom property edit operator to make editing different properties types more obvious and expose more of the data, made more easily possible by the recent UI data refactor. Previously, the operator guessed the type you wanted based on what you wrote in a text box. That was problematic, you couldn't make a string property with a value of `1234`, and you had to know about the Python syntax for lists in order to create an array property. It was also slow and error prone; it was too easy to make a typo. Improvements compared to the old operator: - A type drop-down to choose between the property types. - Step and precision values are exposed. - Buttons that have the correct type based on the property. - String properties no longer display min, max, etc. buttons. - Generally works in more cases. The old operator tended to break. - Choose array length with a slider. - Easy to choose to use python evaluation when necessary. - Code is commented, split up, and much easier to understand. The custom property's value is purposefully not exposed, since the Edit operator is for changing the property's metadata now, rather than the value itself. Though in the "Python" mode the value is still available. More improvements are possible in the future, like exposing different subtypes, and improving the UI of the custom properties panel. Differential Revision: https://developer.blender.org/D12435
Diffstat (limited to 'release/scripts/modules/rna_prop_ui.py')
-rw-r--r--release/scripts/modules/rna_prop_ui.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index 26a2f9ad89b..6d92c94a85c 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -21,9 +21,10 @@
import bpy
from mathutils import Vector
+from bpy.types import bpy_prop_array
from idprop.types import IDPropertyArray, IDPropertyGroup
-ARRAY_TYPES = (list, tuple, IDPropertyArray, Vector)
+ARRAY_TYPES = (list, tuple, IDPropertyArray, Vector, bpy_prop_array)
# Maximum length of an array property for which a multi-line
# edit field will be displayed in the Custom Properties panel.
@@ -136,7 +137,7 @@ def draw(layout, context, context_member, property_type, *, use_edit=True):
def assign_props(prop, val, key):
prop.data_path = context_member
- prop.property = key
+ prop.property_name = key
try:
prop.value = str(val)