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:
authorBastien Montagne <b.mont29@gmail.com>2020-03-19 21:37:00 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-19 21:39:23 +0300
commit12b621059a6f1337e8ae8fdd9533e7808225e71e (patch)
treed04a2fddc28152235191e2d93884f4d143410d85 /source/blender/python/intern/bpy_rna.c
parent0b7854323d41f3a1a55a40ddf76a90e2017a0784 (diff)
Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Mpving utils from idcode to idtype proved to be somewhat painful for some reasons, but now all looks good. Had to add a fake/empty shell for the special snowflake too, `ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r--source/blender/python/intern/bpy_rna.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 8ec62c24c5f..e80c972e8bc 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -62,8 +62,8 @@
#include "BKE_context.h"
#include "BKE_global.h" /* evil G.* */
-#include "BKE_idcode.h"
#include "BKE_idprop.h"
+#include "BKE_idtype.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -315,7 +315,7 @@ static bool rna_id_write_error(PointerRNA *ptr, PyObject *key)
const short idcode = GS(id->name);
/* May need more ID types added here. */
if (!ELEM(idcode, ID_WM, ID_SCR, ID_WS)) {
- const char *idtype = BKE_idcode_to_name(idcode);
+ const char *idtype = BKE_idtype_idcode_to_name(idcode);
const char *pyname;
if (key && PyUnicode_Check(key)) {
pyname = _PyUnicode_AsString(key);
@@ -921,11 +921,12 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
tmp_str = PyUnicode_FromString(id->name + 2);
if (DEG_get_original_id(id) != id) {
- ret = PyUnicode_FromFormat("Evaluated %s %R", BKE_idcode_to_name(GS(id->name)), tmp_str);
+ ret = PyUnicode_FromFormat(
+ "Evaluated %s %R", BKE_idtype_idcode_to_name(GS(id->name)), tmp_str);
}
else if (RNA_struct_is_ID(self->ptr.type) && (id->flag & LIB_EMBEDDED_DATA) == 0) {
ret = PyUnicode_FromFormat(
- "bpy.data.%s[%R]", BKE_idcode_to_name_plural(GS(id->name)), tmp_str);
+ "bpy.data.%s[%R]", BKE_idtype_idcode_to_name_plural(GS(id->name)), tmp_str);
}
else {
const char *path;
@@ -940,13 +941,15 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
if (real_id != NULL) {
Py_DECREF(tmp_str);
tmp_str = PyUnicode_FromString(real_id->name + 2);
- ret = PyUnicode_FromFormat(
- "bpy.data.%s[%R].%s", BKE_idcode_to_name_plural(GS(real_id->name)), tmp_str, path);
+ ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+ BKE_idtype_idcode_to_name_plural(GS(real_id->name)),
+ tmp_str,
+ path);
}
else {
/* Can't find the path, print something useful as a fallback. */
ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
- BKE_idcode_to_name_plural(GS(id->name)),
+ BKE_idtype_idcode_to_name_plural(GS(id->name)),
tmp_str,
RNA_struct_identifier(self->ptr.type));
}
@@ -955,7 +958,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
else {
/* Can't find the path, print something useful as a fallback. */
ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
- BKE_idcode_to_name_plural(GS(id->name)),
+ BKE_idtype_idcode_to_name_plural(GS(id->name)),
tmp_str,
RNA_struct_identifier(self->ptr.type));
}
@@ -1062,7 +1065,7 @@ static PyObject *pyrna_prop_repr_ex(BPy_PropertyRNA *self, const int index_dim,
}
const char *data_delim = (path[0] == '[') ? "" : ".";
ret = PyUnicode_FromFormat("bpy.data.%s[%R]%s%s",
- BKE_idcode_to_name_plural(GS(real_id->name)),
+ BKE_idtype_idcode_to_name_plural(GS(real_id->name)),
tmp_str,
data_delim,
path);
@@ -1072,7 +1075,7 @@ static PyObject *pyrna_prop_repr_ex(BPy_PropertyRNA *self, const int index_dim,
else {
/* Can't find the path, print something useful as a fallback. */
ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
- BKE_idcode_to_name_plural(GS(id->name)),
+ BKE_idtype_idcode_to_name_plural(GS(id->name)),
tmp_str,
RNA_property_identifier(self->prop));
}