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/bpy_rna.c')
-rw-r--r--source/blender/python/intern/bpy_rna.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index e74eaefc2b0..5414c4e4204 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -988,15 +988,16 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
path = RNA_path_from_ID_to_property(&self->ptr, self->prop);
if (path) {
+ const char *data_delim = (path[0] == '[') ? "" : ".";
if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
ret = PyUnicode_FromFormat("bpy.data...%s",
path);
}
else {
- ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R]%s%s",
BKE_idcode_to_name_plural(GS(id->name)),
tmp_str,
- path);
+ data_delim, path);
}
MEM_freeN((void *)path);
@@ -3357,7 +3358,7 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
PyDoc_STRVAR(pyrna_prop_as_bytes_doc,
".. method:: as_bytes()\n"
"\n"
-" Returns this string property as a byte rather then a python string.\n"
+" Returns this string property as a byte rather than a python string.\n"
"\n"
" :return: The string as bytes.\n"
" :rtype: bytes\n"
@@ -3388,6 +3389,21 @@ static PyObject *pyrna_prop_as_bytes(BPy_PropertyRNA *self)
}
}
+PyDoc_STRVAR(pyrna_prop_update_doc,
+".. method:: update()\n"
+"\n"
+" Execute the properties update callback.\n"
+"\n"
+" .. note::\n"
+" This is called when assigning a property,\n"
+" however in rare cases its useful to call explicitly.\n"
+);
+static PyObject *pyrna_prop_update(BPy_PropertyRNA *self)
+{
+ RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
+ Py_RETURN_NONE;
+}
+
PyDoc_STRVAR(pyrna_struct_type_recast_doc,
".. method:: type_recast()\n"
"\n"
@@ -4721,6 +4737,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
static struct PyMethodDef pyrna_prop_methods[] = {
{"path_from_id", (PyCFunction)pyrna_prop_path_from_id, METH_NOARGS, pyrna_prop_path_from_id_doc},
{"as_bytes", (PyCFunction)pyrna_prop_as_bytes, METH_NOARGS, pyrna_prop_as_bytes_doc},
+ {"update", (PyCFunction)pyrna_prop_update, METH_NOARGS, pyrna_prop_update_doc},
{"__dir__", (PyCFunction)pyrna_prop_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}
};