Commit: 71164a826d715eeea9485949e8fe861669f2e667
Author: Hans Goudey
Date:   Thu Aug 5 11:44:41 2021 -0500
Branches: refactor-idprop-ui-data
https://developer.blender.org/rB71164a826d715eeea9485949e8fe861669f2e667

Use pyrna_enum_value_from_id to parse enum items (fix bug creating custom 
property)

===================================================================

M       source/blender/python/generic/idprop_py_ui_api.c

===================================================================

diff --git a/source/blender/python/generic/idprop_py_ui_api.c 
b/source/blender/python/generic/idprop_py_ui_api.c
index 4563abd5daa..c9852ec1a38 100644
--- a/source/blender/python/generic/idprop_py_ui_api.c
+++ b/source/blender/python/generic/idprop_py_ui_api.c
@@ -34,6 +34,8 @@
 #include "RNA_access.h"
 #include "RNA_enum_types.h"
 
+#include "../intern/bpy_rna.h"
+
 #define USE_STRING_COERCE
 
 #ifdef USE_STRING_COERCE
@@ -62,12 +64,12 @@ static bool idprop_ui_data_update_base(IDProperty *idprop,
                                        const char *description)
 {
   if (rna_subtype != NULL) {
-    int result = PROP_NONE;
-    if (!RNA_enum_value_from_id(rna_enum_property_subtype_items, rna_subtype, 
&result)) {
-      PyErr_SetString(PyExc_KeyError, "RNA subtype not found");
+    if (pyrna_enum_value_from_id(rna_enum_property_subtype_items,
+                                 rna_subtype,
+                                 &idprop->ui_data->rna_subtype,
+                                 "IDPropertyUIManager.update") == -1) {
       return false;
     }
-    idprop->ui_data->rna_subtype = result;
   }
 
   if (description != NULL) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to