Note that this fully replaces the 'PyCapsule' storage of linked/appended items
in the python API code by the generic storage of items in the
BlendfileLinkAppendContext data.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Running into an assert when doing nothing, I expect this can just be removed:
import bpy
with bpy.data.libraries.load("/path/to/untitled_simple.blend", link=True) as (data_from, data_to):
print(data_from, data_to)Asserts with:
BLI_assert(lapp_context->num_items && lapp_context->num_libraries);
... commenting for now as it seems harmless.
Previously there was a warning if the ID block couldn't be found.
Could the warning be added back? load: '/path/to/untitled_simple.blend' does not contain objects["Missing"]
While it would be good to support detecting ID's that fail to load as part of the API in a way the script author can inspect, unless this is supported - warning seems reasonable as part of a patch that updates the API usage.
| source/blender/python/intern/bpy_library_load.c | ||
|---|---|---|
| 361–363 | There should be a comment explaining why the ID-codes might not match. This reads as if it might leave the list index unset which creates a bad/corrupt list which will likely crash on access). If the list item at py_list_index is guaranteed to be set they should be a comment explaining the conditions under which this would happen. | |
Changed code in BKE_blendfile_link to better deal with empty items case.
| source/blender/python/intern/bpy_library_load.c | ||
|---|---|---|
| 361–363 | Since the py code loops over ID types and then items in each ID type, the whole list of items in lapp_context is looped over for each ID type, so there will be a lot of items that do not match the current id_code, therefore the early return. Will add a comment about this. And unless bpy_lib_exit or BKE_blendfile_ code is buggy, there should be no way to get an unset item in py_list_index - worst case it would just keep the id name set by user in python code, right? But even this should not happen. | |
*Edit* had note about the assert but this was resolved in rB6f460b76fec18da63d5e7ed8f7ee94a08d0f4719
| source/blender/python/intern/bpy_library_load.c | ||
|---|---|---|
| 363 | typo being | |