[Bf-blender-cvs] [f1aa55b6e9c] master: Cleanup: rename BPy_GetContext -> BPY_context_get

Campbell Barton noreply at git.blender.org
Thu Oct 15 10:01:49 CEST 2020


Commit: f1aa55b6e9cd8ec4d7eb7fead853a4436b35d4cd
Author: Campbell Barton
Date:   Thu Oct 15 18:20:15 2020 +1100
Branches: master
https://developer.blender.org/rBf1aa55b6e9cd8ec4d7eb7fead853a4436b35d4cd

Cleanup: rename BPy_GetContext -> BPY_context_get

Matching BPY_context_set.

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

M	source/blender/python/intern/bpy_interface.c
M	source/blender/python/intern/bpy_interface_atexit.c
M	source/blender/python/intern/bpy_library_load.c
M	source/blender/python/intern/bpy_msgbus.c
M	source/blender/python/intern/bpy_operator.c
M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_rna_anim.c
M	source/blender/python/intern/bpy_rna_gizmo.c

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

diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 468abd7b575..49a17bbf1bf 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -239,7 +239,7 @@ void BPY_modules_update(void)
   BPY_update_rna_module();
 }
 
-bContext *BPy_GetContext(void)
+bContext *BPY_context_get(void)
 {
   return bpy_context_module->ptr.data;
 }
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index e69914671dd..8e5a6dc530b 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -34,7 +34,7 @@
 static PyObject *bpy_atexit(PyObject *UNUSED(self), PyObject *UNUSED(args), PyObject *UNUSED(kw))
 {
   /* close down enough of blender at least not to crash */
-  struct bContext *C = BPy_GetContext();
+  struct bContext *C = BPY_context_get();
 
   WM_exit_ex(C, false);
 
diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c
index a3750d348f5..061595a6c5d 100644
--- a/source/blender/python/intern/bpy_library_load.c
+++ b/source/blender/python/intern/bpy_library_load.c
@@ -180,7 +180,7 @@ PyDoc_STRVAR(
     "   :type relative: bool\n");
 static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
 {
-  Main *bmain = CTX_data_main(BPy_GetContext());
+  Main *bmain = CTX_data_main(BPY_context_get());
   BPy_Library *ret;
   const char *filename = NULL;
   bool is_rel = false, is_link = false;
@@ -319,7 +319,7 @@ static void bpy_lib_exit_warn_type(BPy_Library *self, PyObject *item)
 
 static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
 {
-  Main *bmain = CTX_data_main(BPy_GetContext());
+  Main *bmain = CTX_data_main(BPY_context_get());
   Main *mainl = NULL;
   const int err = 0;
   const bool do_append = ((self->flag & FILE_LINK) == 0);
diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c
index 3739f56dc79..df45007b68f 100644
--- a/source/blender/python/intern/bpy_msgbus.c
+++ b/source/blender/python/intern/bpy_msgbus.c
@@ -265,7 +265,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject *UNUSED(self), PyObject *args
   }
 
   /* Note: we may want to have a way to pass this in. */
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
   struct wmMsgBus *mbus = CTX_wm_message_bus(C);
   wmMsgParams_RNA msg_key_params = {{0}};
 
@@ -340,7 +340,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject *UNUSED(self), PyObject *args,
   }
 
   /* Note: we may want to have a way to pass this in. */
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
   struct wmMsgBus *mbus = CTX_wm_message_bus(C);
   wmMsgParams_RNA msg_key_params = {{0}};
 
@@ -359,7 +359,7 @@ PyDoc_STRVAR(bpy_msgbus_clear_by_owner_doc,
              "   Clear all subscribers using this owner.\n");
 static PyObject *bpy_msgbus_clear_by_owner(PyObject *UNUSED(self), PyObject *py_owner)
 {
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
   struct wmMsgBus *mbus = CTX_wm_message_bus(C);
   WM_msgbus_clear_by_owner(mbus, py_owner);
   Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index f263fd549da..8b65bb22889 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -84,7 +84,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 
   /* XXX Todo, work out a better solution for passing on context,
    * could make a tuple from self and pack the name and Context into it... */
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
 
   if (C == NULL) {
     PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
@@ -171,7 +171,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
 
   /* XXX Todo, work out a better solution for passing on context,
    * could make a tuple from self and pack the name and Context into it... */
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
 
   if (C == NULL) {
     PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators");
@@ -359,7 +359,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
   char *buf = NULL;
   PyObject *pybuf;
 
-  bContext *C = (bContext *)BPy_GetContext();
+  bContext *C = BPY_context_get();
 
   if (C == NULL) {
     PyErr_SetString(PyExc_RuntimeError,
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 0ff7893a6e9..8ad7d84ca2d 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -462,7 +462,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
 
   RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
   if (RNA_property_update_check(self->prop)) {
-    RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+    RNA_property_update(BPY_context_get(), &self->ptr, self->prop);
   }
 
   /* Euler order exception. */
@@ -473,7 +473,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
     if (order != eul->order) {
       RNA_property_enum_set(&self->ptr, prop_eul_order, eul->order);
       if (RNA_property_update_check(prop_eul_order)) {
-        RNA_property_update(BPy_GetContext(), &self->ptr, prop_eul_order);
+        RNA_property_update(BPY_context_get(), &self->ptr, prop_eul_order);
       }
     }
   }
@@ -522,7 +522,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
   RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
 
   if (RNA_property_update_check(self->prop)) {
-    RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+    RNA_property_update(BPY_context_get(), &self->ptr, self->prop);
   }
 
   return 0;
@@ -581,7 +581,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype))
   RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
 
   if (RNA_property_update_check(self->prop)) {
-    RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+    RNA_property_update(BPY_context_get(), &self->ptr, self->prop);
   }
   return 0;
 }
@@ -1234,7 +1234,7 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop)
   const char *result;
   bool free = false;
 
-  RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
+  RNA_property_enum_items(BPY_context_get(), ptr, prop, &item, NULL, &free);
   if (item) {
     result = BPy_enum_as_string(item);
   }
@@ -1262,7 +1262,7 @@ static int pyrna_string_to_enum(
     return -1;
   }
 
-  if (!RNA_property_enum_value(BPy_GetContext(), ptr, prop, param, r_value)) {
+  if (!RNA_property_enum_value(BPY_context_get(), ptr, prop, param, r_value)) {
     const char *enum_str = pyrna_enum_as_string(ptr, prop);
     PyErr_Format(PyExc_TypeError,
                  "%.200s enum \"%.200s\" not found in (%s)",
@@ -1404,7 +1404,7 @@ static int pyrna_prop_to_enum_bitfield(
     return -1;
   }
 
-  RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free);
+  RNA_property_enum_items(BPY_context_get(), ptr, prop, &item, NULL, &free);
 
   if (item) {
     ret = pyrna_set_to_enum_bitfield(item, value, r_value, error_prefix);
@@ -1456,7 +1456,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 
     ret = PySet_New(NULL);
 
-    if (RNA_property_enum_bitflag_identifiers(BPy_GetContext(), ptr, prop, val, identifier)) {
+    if (RNA_property_enum_bitflag_identifiers(BPY_context_get(), ptr, prop, val, identifier)) {
       int index;
 
       for (index = 0; identifier[index]; index++) {
@@ -1468,7 +1468,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
   }
   else {
     const char *identifier;
-    if (RNA_property_enum_identifier(BPy_GetContext(), ptr, prop, val, &identifier)) {
+    if (RNA_property_enum_identifier(BPY_context_get(), ptr, prop, val, &identifier)) {
       ret = PyUnicode_FromString(identifier);
     }
     else {
@@ -2217,7 +2217,7 @@ static int pyrna_py_to_prop(
 
   /* Run RNA property functions. */
   if (RNA_property_update_check(prop)) {
-    RNA_property_update(BPy_GetContext(), ptr, prop);
+    RNA_property_update(BPY_context_get(), ptr, prop);
   }
 
   return 0;
@@ -2293,7 +2293,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 
   /* Run RNA property functions. */
   if (RNA_property_update_check(prop)) {
-    RNA_property_update(BPy_GetContext(), ptr, prop);
+    RNA_property_update(BPY_context_get(), ptr, prop);
   }
 
   return ret;
@@ -3297,7 +3297,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self,
 
   if (ret != -1) {
     if (RNA_property_update_check(self->prop)) {
-      RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+      RNA_property_update(BPY_context_get(), &self->ptr, self->prop);
     }
   }
 
@@ -3967,7 +3967,7 @@ PyDoc_STRVAR(pyrna_prop_update_doc,
              "      however in rare cases it's useful to call explicitly.\n");
 static PyObject *pyrna_prop_update(BPy_PropertyRNA *self)
 {
-  RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+  RNA_property_update(BPY_context_get(), &self->ptr, self->prop);
   Py_RETURN_NONE;
 }
 
@@ -6299,7 +6299,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
   if (err == 0) {
     /* Call function. */
     ReportList reports;
-    bContext *C = BPy_GetContext();
+    bContext *C = BPY_context_get();
 
     BKE_reports_init(&reports, RPT_STORE);
     RNA_function_call(C, &reports, self_ptr, self_func, &parms);
@@ -8320,7 +8320,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
   /* XXX, this is needed because render engine calls without a context
    * this should be supported at some point, but at the moment it's not! */
   if (C 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list