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:
authorCampbell Barton <ideasman42@gmail.com>2021-04-23 10:05:41 +0300
committerJeroen Bakker <jeroen@blender.org>2021-05-07 08:50:32 +0300
commit42089fcde087b3738312e52820a57504795c69f1 (patch)
tree2e298c733e656995c202ccaa3c9ef70d4c27bb55
parentc5c35e9b476ff6e0bcbe19e65a17964c65042a3e (diff)
Fix T86765: Custom properties are included in `__dir__`
Remove custom properties from `__dir__` method result since these can't be accessed using `__getattr__`. Introduced in the 2.5x Python API update.
-rw-r--r--source/blender/python/intern/bpy_rna.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 39485f322d4..c570e3f8d7a 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -4178,6 +4178,10 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
iterprop = RNA_struct_iterator_property(ptr->type);
RNA_PROP_BEGIN (ptr, itemptr, iterprop) {
+ /* Custom-properties are exposed using `__getitem__`, exclude from `__dir__`. */
+ if (RNA_property_is_idprop(itemptr.data)) {
+ continue;
+ }
nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {