From f1aa55b6e9cd8ec4d7eb7fead853a4436b35d4cd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 15 Oct 2020 18:20:15 +1100 Subject: Cleanup: rename BPy_GetContext -> BPY_context_get Matching BPY_context_set. --- source/blender/python/intern/bpy_interface.c | 2 +- .../blender/python/intern/bpy_interface_atexit.c | 2 +- source/blender/python/intern/bpy_library_load.c | 4 +-- source/blender/python/intern/bpy_msgbus.c | 6 ++-- source/blender/python/intern/bpy_operator.c | 6 ++-- source/blender/python/intern/bpy_rna.c | 34 +++++++++++----------- source/blender/python/intern/bpy_rna_anim.c | 10 +++---- source/blender/python/intern/bpy_rna_gizmo.c | 4 +-- 8 files changed, 34 insertions(+), 34 deletions(-) (limited to 'source/blender/python') 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 == NULL) { - C = BPy_GetContext(); + C = BPY_context_get(); } /* Annoying! We need to check if the screen gets set to NULL which is a @@ -8789,7 +8789,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class } /* Get the context, so register callback can do necessary refreshes. */ - C = BPy_GetContext(); + C = BPY_context_get(); /* Call the register callback with reports & identifier. */ BKE_reports_init(&reports, RPT_STORE); @@ -9000,7 +9000,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla } /* Get the context, so register callback can do necessary refreshes. */ - C = BPy_GetContext(); + C = BPY_context_get(); /* Call unregister. */ unreg(CTX_data_main(C), srna); /* Calls bpy_class_free, this decref's py_class. */ diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c index 8e85ff2e1cd..b7648ee830f 100644 --- a/source/blender/python/intern/bpy_rna_anim.c +++ b/source/blender/python/intern/bpy_rna_anim.c @@ -259,7 +259,7 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr, } if (*r_cfra == FLT_MAX) { - *r_cfra = CTX_data_scene(BPy_GetContext())->r.cfra; + *r_cfra = CTX_data_scene(BPY_context_get())->r.cfra; } /* flag may be null (no option currently for remove keyframes e.g.). */ @@ -341,7 +341,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb * It is unlikely that driver code (which is the reason this depsgraph pointer is obtained) will * be executed from this function call, as this only happens when `options` has * `INSERTKEY_DRIVER`, which is not exposed to Python. */ - bContext *C = BPy_GetContext(); + bContext *C = BPY_context_get(); struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, cfra); @@ -600,8 +600,8 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args) ret = pyrna_struct_CreatePyObject(&tptr); } - bContext *context = BPy_GetContext(); - WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); + bContext *context = BPY_context_get(); + WM_event_add_notifier(BPY_context_get(), NC_ANIMATION | ND_FCURVES_ORDER, NULL); DEG_relations_tag_update(CTX_data_main(context)); } else { @@ -659,7 +659,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args) return NULL; } - bContext *context = BPy_GetContext(); + bContext *context = BPY_context_get(); WM_event_add_notifier(context, NC_ANIMATION | ND_FCURVES_ORDER, NULL); DEG_relations_tag_update(CTX_data_main(context)); diff --git a/source/blender/python/intern/bpy_rna_gizmo.c b/source/blender/python/intern/bpy_rna_gizmo.c index 542d014f8b2..1f27e4bcca8 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.c +++ b/source/blender/python/intern/bpy_rna_gizmo.c @@ -433,14 +433,14 @@ static PyObject *bpy_gizmo_target_set_value(PyObject *UNUSED(self), PyObject *ar "Gizmo target property array") == -1) { goto fail; } - WM_gizmo_target_property_float_set_array(BPy_GetContext(), gz, gz_prop, value); + WM_gizmo_target_property_float_set_array(BPY_context_get(), gz, gz_prop, value); } else { float value; if ((value = PyFloat_AsDouble(params.value)) == -1.0f && PyErr_Occurred()) { goto fail; } - WM_gizmo_target_property_float_set(BPy_GetContext(), gz, gz_prop, value); + WM_gizmo_target_property_float_set(BPY_context_get(), gz, gz_prop, value); } Py_RETURN_NONE; } -- cgit v1.2.3