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
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')
-rw-r--r--source/blender/python/intern/bpy_library_load.c20
-rw-r--r--source/blender/python/intern/bpy_rna.c23
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c4
3 files changed, 25 insertions, 22 deletions
diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c
index 14a4482f570..989b7931444 100644
--- a/source/blender/python/intern/bpy_library_load.c
+++ b/source/blender/python/intern/bpy_library_load.c
@@ -35,7 +35,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_idcode.h"
+#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_report.h"
@@ -246,9 +246,9 @@ static PyObject *bpy_lib_enter(BPy_Library *self)
}
else {
int i = 0, code;
- while ((code = BKE_idcode_iter_step(&i))) {
- if (BKE_idcode_is_linkable(code)) {
- const char *name_plural = BKE_idcode_to_name_plural(code);
+ while ((code = BKE_idtype_idcode_iter_step(&i))) {
+ if (BKE_idtype_idcode_is_linkable(code)) {
+ const char *name_plural = BKE_idtype_idcode_to_name_plural(code);
PyObject *str = PyUnicode_FromString(name_plural);
PyObject *item;
@@ -332,9 +332,9 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
{
int idcode_step = 0, idcode;
- while ((idcode = BKE_idcode_iter_step(&idcode_step))) {
- if (BKE_idcode_is_linkable(idcode) && (idcode != ID_WS || do_append)) {
- const char *name_plural = BKE_idcode_to_name_plural(idcode);
+ while ((idcode = BKE_idtype_idcode_iter_step(&idcode_step))) {
+ if (BKE_idtype_idcode_is_linkable(idcode) && (idcode != ID_WS || do_append)) {
+ const char *name_plural = BKE_idtype_idcode_to_name_plural(idcode);
PyObject *ls = PyDict_GetItemString(self->dict, name_plural);
// printf("lib: %s\n", name_plural);
if (ls && PyList_Check(ls)) {
@@ -419,9 +419,9 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
#ifdef USE_RNA_DATABLOCKS
{
int idcode_step = 0, idcode;
- while ((idcode = BKE_idcode_iter_step(&idcode_step))) {
- if (BKE_idcode_is_linkable(idcode) && (idcode != ID_WS || do_append)) {
- const char *name_plural = BKE_idcode_to_name_plural(idcode);
+ while ((idcode = BKE_idtype_idcode_iter_step(&idcode_step))) {
+ if (BKE_idtype_idcode_is_linkable(idcode) && (idcode != ID_WS || do_append)) {
+ const char *name_plural = BKE_idtype_idcode_to_name_plural(idcode);
PyObject *ls = PyDict_GetItemString(self->dict, name_plural);
if (ls && PyList_Check(ls)) {
Py_ssize_t size = PyList_GET_SIZE(ls);
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));
}
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 0c640329efa..c8af6377d59 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -39,7 +39,7 @@
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
-#include "BKE_idcode.h"
+#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_report.h"
@@ -473,7 +473,7 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
RPT_WARNING,
"Not deleting keyframe for locked F-Curve for NLA Strip influence on %s - %s '%s'",
strip->name,
- BKE_idcode_to_name(GS(id->name)),
+ BKE_idtype_idcode_to_name(GS(id->name)),
id->name + 2);
}
else {