[Bf-blender-cvs] [40e3841939e] refactor-idprop-ui-data: Small cleanup

Hans Goudey noreply at git.blender.org
Mon Aug 2 06:17:18 CEST 2021


Commit: 40e3841939eab6b1f0fd5aaed62152d5b724c815
Author: Hans Goudey
Date:   Mon Aug 2 00:15:47 2021 -0400
Branches: refactor-idprop-ui-data
https://developer.blender.org/rB40e3841939eab6b1f0fd5aaed62152d5b724c815

Small cleanup

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

M	release/scripts/startup/bl_operators/wm.py
M	source/blender/python/generic/idprop_py_api.c
M	source/blender/python/generic/idprop_py_ui_api.cc
M	source/blender/python/generic/idprop_py_ui_api.h
M	source/blender/python/intern/bpy_rna.c

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

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 96e9421a917..989c067efec 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1434,7 +1434,7 @@ class WM_OT_properties_edit(Operator):
 
         if prop_type == int:
             if type(default_eval) == str:
-                self.report({'WARNING'}, "Could not evaluate number from default")
+                self.report({'WARNING'}, "Could not evaluate number from default value")
                 default_eval = None
             elif hasattr(default_eval, "__len__"):
                 default_eval = [int(round(value)) for value in default_eval]
@@ -1447,7 +1447,7 @@ class WM_OT_properties_edit(Operator):
             )
         elif prop_type == float:
             if type(default_eval) == str:
-                self.report({'WARNING'}, "Could not evaluate number from default")
+                self.report({'WARNING'}, "Could not evaluate number from default value")
                 default_eval = None
             ui_data.update(
                 min=self.min,
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index c93cbdb146a..58a947943b1 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -22,7 +22,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 #include "idprop_py_api.h"
@@ -32,9 +31,6 @@
 
 #include "DNA_ID.h" /* ID property definitions. */
 
-#include "RNA_access.h"
-#include "RNA_enum_types.h"
-
 #define USE_STRING_COERCE
 
 #ifdef USE_STRING_COERCE
diff --git a/source/blender/python/generic/idprop_py_ui_api.cc b/source/blender/python/generic/idprop_py_ui_api.cc
index 58773d2ec11..506fe83cff5 100644
--- a/source/blender/python/generic/idprop_py_ui_api.cc
+++ b/source/blender/python/generic/idprop_py_ui_api.cc
@@ -82,10 +82,8 @@ static bool idprop_ui_data_update_base(IDProperty *idprop,
  */
 static bool idprop_ui_data_update_int(IDProperty *idprop, PyObject *args, PyObject *kwargs)
 {
-  /* Base class data included here to allow parsing all arguments at once. */
   const char *rna_subtype = nullptr;
   const char *description = nullptr;
-
   int min, max, soft_min, soft_max, step;
   PyObject *default_value = nullptr;
   const char *kwlist[] = {
@@ -178,10 +176,8 @@ static bool idprop_ui_data_update_int(IDProperty *idprop, PyObject *args, PyObje
  */
 static bool idprop_ui_data_update_float(IDProperty *idprop, PyObject *args, PyObject *kwargs)
 {
-  /* Base class data included here to allow parsing all arguments at once. */
   const char *rna_subtype = nullptr;
   const char *description = nullptr;
-
   int precision;
   double min, max, soft_min, soft_max, step;
   PyObject *default_value = nullptr;
@@ -287,10 +283,8 @@ static bool idprop_ui_data_update_float(IDProperty *idprop, PyObject *args, PyOb
  */
 static bool idprop_ui_data_update_string(IDProperty *idprop, PyObject *args, PyObject *kwargs)
 {
-  /* Base class data included here to allow parsing all arguments at once. */
   const char *rna_subtype = nullptr;
   const char *description = nullptr;
-
   const char *default_value;
   const char *kwlist[] = {"default", "subtype", "description", nullptr};
   if (!PyArg_ParseTupleAndKeywords(args,
@@ -322,10 +316,8 @@ static bool idprop_ui_data_update_string(IDProperty *idprop, PyObject *args, PyO
  */
 static bool idprop_ui_data_update_id(IDProperty *idprop, PyObject *args, PyObject *kwargs)
 {
-  /* Base class data included here to allow parsing all arguments at once. */
   const char *rna_subtype = nullptr;
   const char *description = nullptr;
-
   const char *kwlist[] = {"subtype", "description", nullptr};
   if (!PyArg_ParseTupleAndKeywords(
           args, kwargs, "|$zz:update", (char **)kwlist, &rna_subtype, &description)) {
@@ -617,10 +609,8 @@ static struct PyMethodDef BPy_IDPropertyUIManager_methods[] = {
 
 static PyObject *BPy_IDPropertyUIManager_repr(BPy_IDPropertyUIManager *self)
 {
-  return PyUnicode_FromFormat("<bpy id prop ui manager: owner=\"%s\", name=\"%s\", address=%p>",
-                              self->owner_id ? self->owner_id->name : "<NONE>",
-                              self->property->name,
-                              self->property);
+  return PyUnicode_FromFormat(
+      "<bpy id prop ui manager: name=\"%s\", address=%p>", self->property->name, self->property);
 }
 
 static Py_hash_t BPy_IDPropertyUIManager_hash(BPy_IDPropertyUIManager *self)
diff --git a/source/blender/python/generic/idprop_py_ui_api.h b/source/blender/python/generic/idprop_py_ui_api.h
index 9064e6c8efa..416278a8ebc 100644
--- a/source/blender/python/generic/idprop_py_ui_api.h
+++ b/source/blender/python/generic/idprop_py_ui_api.h
@@ -31,9 +31,7 @@ extern PyTypeObject BPy_IDPropertyUIManager_Type;
 
 typedef struct BPy_IDPropertyUIManager {
   PyObject_VAR_HEAD
-  struct ID *owner_id;
   struct IDProperty *property;
-  struct IDProperty *parent;
 } BPy_IDPropertyUIManager;
 
 void IDPropertyUIData_Init_Types(void);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 74eccb8703f..7b37ccaa148 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -4325,7 +4325,7 @@ static PyObject *pyrna_struct_id_properties_ensure(BPy_StructRNA *self)
 
 PyDoc_STRVAR(pyrna_struct_id_properties_ui_doc,
              ".. method:: id_properties_ui()\n\n"
-             "   :return: Return an object used to manage a property's UI data.\n"
+             "   :return: Return an object used to manage an IDProperty's UI data.\n"
              "   :rtype: :class:`bpy.types.IDPropertyUIManager`\n");
 static PyObject *pyrna_struct_id_properties_ui(BPy_StructRNA *self, PyObject *args)
 {
@@ -4362,9 +4362,7 @@ static PyObject *pyrna_struct_id_properties_ui(BPy_StructRNA *self, PyObject *ar
 
   BPy_IDPropertyUIManager *ui_manager = PyObject_New(BPy_IDPropertyUIManager,
                                                      &BPy_IDPropertyUIManager_Type);
-  ui_manager->owner_id = self->ptr.owner_id;
   ui_manager->property = property;
-  ui_manager->parent = parent_group;
   return (PyObject *)ui_manager;
 }



More information about the Bf-blender-cvs mailing list