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:
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r--source/blender/python/intern/CMakeLists.txt4
-rw-r--r--source/blender/python/intern/bpy_app.c9
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c4
-rw-r--r--source/blender/python/intern/bpy_app_translations.c28
-rw-r--r--source/blender/python/intern/bpy_interface.c21
-rw-r--r--source/blender/python/intern/bpy_path.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c8
7 files changed, 45 insertions, 31 deletions
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index ae16bd4a145..357cb175769 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -165,6 +165,10 @@ if(WITH_CYCLES_OSL)
add_definitions(-DWITH_CYCLES_OSL)
endif()
+if(WITH_CYCLES_EMBREE)
+ add_definitions(-DWITH_CYCLES_EMBREE)
+endif()
+
if(WITH_FREESTYLE)
list(APPEND INC
../../freestyle/intern/python
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 66c64b580f3..928e14c09bf 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -230,13 +230,13 @@ PyDoc_STRVAR(bpy_app_debug_doc,
);
static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
return PyBool_FromLong(G.debug & flag);
}
static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
const int param = PyObject_IsTrue(value);
if (param == -1) {
@@ -307,7 +307,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
static PyObject *bpy_app_global_flag_get(PyObject *UNUSED(self), void *closure)
{
- const int flag = GET_INT_FROM_POINTER(closure);
+ const int flag = POINTER_AS_INT(closure);
return PyBool_FromLong(G.f & flag);
}
@@ -339,7 +339,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc,
);
static PyObject *bpy_app_preview_render_size_get(PyObject *UNUSED(self), void *closure)
{
- return PyLong_FromLong((long)UI_preview_render_size(GET_INT_FROM_POINTER(closure)));
+ return PyLong_FromLong((long)UI_preview_render_size(POINTER_AS_INT(closure)));
}
static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void *UNUSED(closure))
@@ -364,6 +364,7 @@ static PyGetSetDef bpy_app_getsets[] = {
{(char *)"debug_depsgraph_pretty", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_PRETTY},
{(char *)"debug_simdata", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA},
{(char *)"debug_gpumem", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_GPU_MEM},
+ {(char *)"debug_io", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_IO},
{(char *)"binary_path_python", bpy_app_binary_path_python_get, NULL, (char *)bpy_app_binary_path_python_doc, NULL},
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index ded5ead93aa..8453808d6ec 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -241,7 +241,7 @@ PyObject *BPY_app_handlers_struct(void)
funcstore = &funcstore_array[pos];
funcstore->func = bpy_app_generic_callback;
funcstore->alloc = 0;
- funcstore->arg = SET_INT_IN_POINTER(pos);
+ funcstore->arg = POINTER_FROM_INT(pos);
BLI_callback_add(funcstore, pos);
}
}
@@ -300,7 +300,7 @@ void BPY_app_handlers_reset(const short do_all)
/* the actual callback - not necessarily called from py */
void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
{
- PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
+ PyObject *cb_list = py_cb_array[POINTER_AS_INT(arg)];
if (PyList_GET_SIZE(cb_list) > 0) {
PyGILState_STATE gilstate = PyGILState_Ensure();
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index ffc54969d8c..2a5efc15b87 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -289,12 +289,12 @@ PyDoc_STRVAR(app_translations_py_messages_register_doc,
" Registers an addon's UI translations.\n"
"\n"
" .. note::\n"
-" Does nothing when Blender is built without internationalization support.\n"
+" Does nothing when Blender is built without internationalization support.\n"
"\n"
" :arg module_name: The name identifying the addon.\n"
" :type module_name: string\n"
" :arg translations_dict: A dictionary built like that:\n"
-" ``{locale: {msg_key: msg_translation, ...}, ...}``\n"
+" ``{locale: {msg_key: msg_translation, ...}, ...}``\n"
" :type translations_dict: dict\n"
"\n"
);
@@ -337,7 +337,7 @@ PyDoc_STRVAR(app_translations_py_messages_unregister_doc,
" Unregisters an addon's UI translations.\n"
"\n"
" .. note::\n"
-" Does nothing when Blender is built without internationalization support.\n"
+" Does nothing when Blender is built without internationalization support.\n"
"\n"
" :arg module_name: The name identifying the addon.\n"
" :type module_name: string\n"
@@ -425,8 +425,8 @@ PyDoc_STRVAR(app_translations_contexts_doc,
"A named tuple containing all pre-defined translation contexts.\n"
"\n"
".. warning::\n"
-" Never use a (new) context starting with \"" BLT_I18NCONTEXT_DEFAULT_BPYRNA "\", it would be internally \n"
-" assimilated as the default one!\n"
+" Never use a (new) context starting with \"" BLT_I18NCONTEXT_DEFAULT_BPYRNA "\", it would be internally\n"
+" assimilated as the default one!\n"
);
PyDoc_STRVAR(app_translations_contexts_C_to_py_doc,
@@ -522,16 +522,16 @@ PyDoc_STRVAR(app_translations_pgettext_doc,
" Try to translate the given msgid (with optional msgctxt).\n"
"\n"
" .. note::\n"
-" The ``(msgid, msgctxt)`` parameters order has been switched compared to gettext function, to allow\n"
-" single-parameter calls (context then defaults to BLT_I18NCONTEXT_DEFAULT).\n"
+" The ``(msgid, msgctxt)`` parameters order has been switched compared to gettext function, to allow\n"
+" single-parameter calls (context then defaults to BLT_I18NCONTEXT_DEFAULT).\n"
"\n"
" .. note::\n"
-" You should really rarely need to use this function in regular addon code, as all translation should be\n"
-" handled by Blender internal code. The only exception are string containing formatting (like \"File: %r\"),\n"
-" but you should rather use :func:`pgettext_iface`/:func:`pgettext_tip` in those cases!\n"
+" You should really rarely need to use this function in regular addon code, as all translation should be\n"
+" handled by Blender internal code. The only exception are string containing formatting (like \"File: %r\"),\n"
+" but you should rather use :func:`pgettext_iface`/:func:`pgettext_tip` in those cases!\n"
"\n"
" .. note::\n"
-" Does nothing when Blender is built without internationalization support (hence always returns ``msgid``).\n"
+" Does nothing when Blender is built without internationalization support (hence always returns ``msgid``).\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
@@ -551,7 +551,7 @@ PyDoc_STRVAR(app_translations_pgettext_iface_doc,
" Try to translate the given msgid (with optional msgctxt), if labels' translation is enabled.\n"
"\n"
" .. note::\n"
-" See :func:`pgettext` notes.\n"
+" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
@@ -571,7 +571,7 @@ PyDoc_STRVAR(app_translations_pgettext_tip_doc,
" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
"\n"
" .. note::\n"
-" See :func:`pgettext` notes.\n"
+" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
@@ -591,7 +591,7 @@ PyDoc_STRVAR(app_translations_pgettext_data_doc,
" Try to translate the given msgid (with optional msgctxt), if new data name's translation is enabled.\n"
"\n"
" .. note::\n"
-" See :func:`pgettext` notes.\n"
+" See :func:`pgettext` notes.\n"
"\n"
" :arg msgid: The string to translate.\n"
" :type msgid: string\n"
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 123c938b921..1ae3106aa76 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -692,7 +692,9 @@ bool BPY_execute_string_as_intptr(
return ok;
}
-bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
+bool BPY_execute_string_ex(
+ bContext *C, const char *imports[],
+ const char *expr, bool use_eval)
{
BLI_assert(expr);
PyGILState_STATE gilstate;
@@ -714,13 +716,18 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
bmain_back = bpy_import_main_get();
bpy_import_main_set(CTX_data_main(C));
- retval = PyRun_String(expr, use_eval ? Py_eval_input : Py_file_input, py_dict, py_dict);
+ if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) {
+ Py_DECREF(py_dict);
+ retval = NULL;
+ }
+ else {
+ retval = PyRun_String(expr, use_eval ? Py_eval_input : Py_file_input, py_dict, py_dict);
+ }
bpy_import_main_set(bmain_back);
if (retval == NULL) {
ok = false;
-
BPy_errors_to_report(CTX_wm_reports(C));
}
else {
@@ -734,9 +741,11 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
return ok;
}
-bool BPY_execute_string(bContext *C, const char *expr)
+bool BPY_execute_string(
+ bContext *C, const char *imports[],
+ const char *expr)
{
- return BPY_execute_string_ex(C, expr, true);
+ return BPY_execute_string_ex(C, imports, expr, true);
}
void BPY_modules_load_user(bContext *C)
@@ -994,7 +1003,7 @@ bool BPY_string_is_keyword(const char *str)
*/
const char *kwlist[] = {
"False", "None", "True",
- "and", "as", "assert", "break",
+ "and", "as", "assert", "async", "await", "break",
"class", "continue", "def", "del", "elif", "else", "except",
"finally", "for", "from", "global", "if", "import", "in",
"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
diff --git a/source/blender/python/intern/bpy_path.c b/source/blender/python/intern/bpy_path.c
index f182972ba9c..53d8f8ea954 100644
--- a/source/blender/python/intern/bpy_path.c
+++ b/source/blender/python/intern/bpy_path.c
@@ -23,7 +23,7 @@
/** \file blender/python/intern/bpy_path.c
* \ingroup pythonintern
*
- * This file defines '_bpy_path' module, Some 'C' funtionality used by 'bpy.path'
+ * This file defines '_bpy_path' module, Some 'C' functionality used by 'bpy.path'
*/
#include <Python.h>
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 28a6a4f7fb0..9837017b8b1 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -90,7 +90,7 @@ static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
#define BPY_DOC_ID_PROP_TYPE_NOTE \
" .. note::\n" \
"\n" \
-" Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \
+" Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and\n" \
" :class:`bpy.types.PoseBone` classes support custom properties.\n"
@@ -2351,7 +2351,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(
}
else {
PyErr_Format(PyExc_KeyError,
- "%s: lib must be a sting or None, not %.200s",
+ "%s: lib must be a string or None, not %.200s",
err_prefix, Py_TYPE(keylib)->tp_name);
return -1;
}
@@ -4091,7 +4091,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr
* <bpy_struct, BoolProperty("foo")>
* ...rather than returning the deferred class register tuple as checked by pyrna_is_deferred_prop()
*
- * Disable for now, this is faking internal behavior in a way thats too tricky to maintain well. */
+ * Disable for now, this is faking internal behavior in a way that's too tricky to maintain well. */
#if 0
if (ret == NULL) { // || pyrna_is_deferred_prop(ret)
StructRNA *srna = srna_from_self(cls, "StructRNA.__getattr__");
@@ -7309,7 +7309,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
RNA_struct_idprops_contains_datablock(type_srna))
{
PyErr_Format(PyExc_ValueError,
- "bpy_struct \"%.200s\" doesn't support datablock properties \n",
+ "bpy_struct \"%.200s\" doesn't support datablock properties\n",
RNA_struct_identifier(srna));
return -1;
}