Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_library_load.c
| Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | if (BPy_reports_to_error(&reports, PyExc_IOError, true) != -1) { | ||||
| "load: %s failed to open blend file", | "load: %s failed to open blend file", | ||||
| self->abspath); | self->abspath); | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| else { | else { | ||||
| int i = 0, code; | int i = 0, code; | ||||
| while ((code = BKE_idcode_iter_step(&i))) { | while ((code = BKE_idcode_iter_step(&i))) { | ||||
| if (BKE_idcode_is_linkable(code)) { | if (BKE_idcode_is_linkable(code) || BKE_idcode_is_appendable(code)) { | ||||
| const char *name_plural = BKE_idcode_to_name_plural(code); | const char *name_plural = BKE_idcode_to_name_plural(code); | ||||
| PyObject *str = PyUnicode_FromString(name_plural); | PyObject *str = PyUnicode_FromString(name_plural); | ||||
| PyObject *item; | PyObject *item; | ||||
| PyDict_SetItem(self->dict, str, item = PyList_New(0)); | PyDict_SetItem(self->dict, str, item = PyList_New(0)); | ||||
| Py_DECREF(item); | Py_DECREF(item); | ||||
| PyDict_SetItem(from_dict, str, item = _bpy_names(self, code)); | PyDict_SetItem(from_dict, str, item = _bpy_names(self, code)); | ||||
| Py_DECREF(item); | Py_DECREF(item); | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) | ||||
| BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true); | BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true); | ||||
| /* here appending/linking starts */ | /* here appending/linking starts */ | ||||
| mainl = BLO_library_link_begin(bmain, &(self->blo_handle), self->relpath); | mainl = BLO_library_link_begin(bmain, &(self->blo_handle), self->relpath); | ||||
| { | { | ||||
| int idcode_step = 0, idcode; | int idcode_step = 0, idcode; | ||||
| while ((idcode = BKE_idcode_iter_step(&idcode_step))) { | while ((idcode = BKE_idcode_iter_step(&idcode_step))) { | ||||
| if (BKE_idcode_is_linkable(idcode)) { | if (BKE_idcode_is_linkable(idcode) || BKE_idcode_is_appendable(idcode)) { | ||||
| const char *name_plural = BKE_idcode_to_name_plural(idcode); | const char *name_plural = BKE_idcode_to_name_plural(idcode); | ||||
| PyObject *ls = PyDict_GetItemString(self->dict, name_plural); | PyObject *ls = PyDict_GetItemString(self->dict, name_plural); | ||||
| // printf("lib: %s\n", name_plural); | // printf("lib: %s\n", name_plural); | ||||
| if (ls && PyList_Check(ls)) { | if (ls && PyList_Check(ls)) { | ||||
| /* loop */ | /* loop */ | ||||
| Py_ssize_t size = PyList_GET_SIZE(ls); | Py_ssize_t size = PyList_GET_SIZE(ls); | ||||
| Py_ssize_t i; | Py_ssize_t i; | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | else { | ||||
| BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); | BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); | ||||
| /* finally swap the capsules for real bpy objects | /* finally swap the capsules for real bpy objects | ||||
| * important since BLO_library_append_end initializes NodeTree types used by srna->refine */ | * important since BLO_library_append_end initializes NodeTree types used by srna->refine */ | ||||
| #ifdef USE_RNA_DATABLOCKS | #ifdef USE_RNA_DATABLOCKS | ||||
| { | { | ||||
| int idcode_step = 0, idcode; | int idcode_step = 0, idcode; | ||||
| while ((idcode = BKE_idcode_iter_step(&idcode_step))) { | while ((idcode = BKE_idcode_iter_step(&idcode_step))) { | ||||
| if (BKE_idcode_is_linkable(idcode)) { | if (BKE_idcode_is_linkable(idcode) || BKE_idcode_is_appendable(idcode)) { | ||||
| const char *name_plural = BKE_idcode_to_name_plural(idcode); | const char *name_plural = BKE_idcode_to_name_plural(idcode); | ||||
| PyObject *ls = PyDict_GetItemString(self->dict, name_plural); | PyObject *ls = PyDict_GetItemString(self->dict, name_plural); | ||||
| if (ls && PyList_Check(ls)) { | if (ls && PyList_Check(ls)) { | ||||
| Py_ssize_t size = PyList_GET_SIZE(ls); | Py_ssize_t size = PyList_GET_SIZE(ls); | ||||
| Py_ssize_t i; | Py_ssize_t i; | ||||
| PyObject *item; | PyObject *item; | ||||
| for (i = 0; i < size; i++) { | for (i = 0; i < size; i++) { | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||