Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_files_link.c
| Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | BLI_bitmap | ||||
| *libraries; /* All libs (from WMLinkAppendData.libraries) to try to load this ID from. */ | *libraries; /* All libs (from WMLinkAppendData.libraries) to try to load this ID from. */ | ||||
| short idcode; | short idcode; | ||||
| /** Type of action to do to append this item, and other append-specific information. */ | /** Type of action to do to append this item, and other append-specific information. */ | ||||
| char append_action; | char append_action; | ||||
| char append_tag; | char append_tag; | ||||
| ID *new_id; | ID *new_id; | ||||
| Library *source_library; | |||||
| void *customdata; | void *customdata; | ||||
| } WMLinkAppendDataItem; | } WMLinkAppendDataItem; | ||||
| typedef struct WMLinkAppendData { | typedef struct WMLinkAppendData { | ||||
| LinkNodePair libraries; | LinkNodePair libraries; | ||||
| LinkNodePair items; | LinkNodePair items; | ||||
| int num_libraries; | int num_libraries; | ||||
| int num_items; | int num_items; | ||||
| ▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Lines | BKE_library_foreach_ID_link( | ||||
| cb_data->bmain, id, foreach_libblock_append_callback, data, IDWALK_NOP); | cb_data->bmain, id, foreach_libblock_append_callback, data, IDWALK_NOP); | ||||
| return IDWALK_RET_NOP; | return IDWALK_RET_NOP; | ||||
| } | } | ||||
| WMLinkAppendDataItem *item = BLI_ghash_lookup(data->lapp_data->new_id_to_item, id); | WMLinkAppendDataItem *item = BLI_ghash_lookup(data->lapp_data->new_id_to_item, id); | ||||
| if (item == NULL) { | if (item == NULL) { | ||||
| item = wm_link_append_data_item_add(data->lapp_data, id->name, GS(id->name), NULL); | item = wm_link_append_data_item_add(data->lapp_data, id->name, GS(id->name), NULL); | ||||
| item->new_id = id; | item->new_id = id; | ||||
| item->source_library = id->lib; | |||||
| /* Since we did not have an item for that ID yet, we now user did not selected it explicitly, | /* Since we did not have an item for that ID yet, we now user did not selected it explicitly, | ||||
| * it was rather linked indirectly. This info is important for instantiation of collections. */ | * it was rather linked indirectly. This info is important for instantiation of collections. */ | ||||
| item->append_tag |= WM_APPEND_TAG_INDIRECT; | item->append_tag |= WM_APPEND_TAG_INDIRECT; | ||||
| BLI_ghash_insert(data->lapp_data->new_id_to_item, id, item); | BLI_ghash_insert(data->lapp_data->new_id_to_item, id, item); | ||||
| } | } | ||||
| /* NOTE: currently there is no need to do anything else here, but in the future this would be | /* NOTE: currently there is no need to do anything else here, but in the future this would be | ||||
| * the place to add specific per-usage decisions on how to append an ID. */ | * the place to add specific per-usage decisions on how to append an ID. */ | ||||
| ▲ Show 20 Lines • Show All 366 Lines • ▼ Show 20 Lines | for (item_idx = 0, itemlink = lapp_data->items.list; itemlink; | ||||
| new_id = BLO_library_link_named_part(mainl, &bh, item->idcode, item->name, &liblink_params); | new_id = BLO_library_link_named_part(mainl, &bh, item->idcode, item->name, &liblink_params); | ||||
| if (new_id) { | if (new_id) { | ||||
| /* If the link is successful, clear item's libs 'todo' flags. | /* If the link is successful, clear item's libs 'todo' flags. | ||||
| * This avoids trying to link same item with other libraries to come. */ | * This avoids trying to link same item with other libraries to come. */ | ||||
| BLI_bitmap_set_all(item->libraries, false, lapp_data->num_libraries); | BLI_bitmap_set_all(item->libraries, false, lapp_data->num_libraries); | ||||
| item->new_id = new_id; | item->new_id = new_id; | ||||
| item->source_library = new_id->lib; | |||||
| } | } | ||||
| } | } | ||||
| BLO_library_link_end(mainl, &bh, &liblink_params); | BLO_library_link_end(mainl, &bh, &liblink_params); | ||||
| BLO_blendhandle_close(bh); | BLO_blendhandle_close(bh); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 940 Lines • Show Last 20 Lines | |||||