Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/lib_id.c
| Show First 20 Lines • Show All 1,295 Lines • ▼ Show 20 Lines | void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int orig_flag) | ||||
| /* We do not want any handling of usercount in code duplicating the data here, we do that all | /* We do not want any handling of usercount in code duplicating the data here, we do that all | ||||
| * at once in id_copy_libmanagement_cb() at the end. */ | * at once in id_copy_libmanagement_cb() at the end. */ | ||||
| const int copy_data_flag = orig_flag | LIB_ID_CREATE_NO_USER_REFCOUNT; | const int copy_data_flag = orig_flag | LIB_ID_CREATE_NO_USER_REFCOUNT; | ||||
| if (id->properties) { | if (id->properties) { | ||||
| new_id->properties = IDP_CopyProperty_ex(id->properties, copy_data_flag); | new_id->properties = IDP_CopyProperty_ex(id->properties, copy_data_flag); | ||||
| } | } | ||||
| /* This is never duplicated, only one existing ID should have a given weak ref to library/ID. */ | |||||
| new_id->library_weak_reference = NULL; | |||||
| if ((orig_flag & LIB_ID_COPY_NO_LIB_OVERRIDE) == 0) { | if ((orig_flag & LIB_ID_COPY_NO_LIB_OVERRIDE) == 0) { | ||||
| if (ID_IS_OVERRIDE_LIBRARY_REAL(id)) { | if (ID_IS_OVERRIDE_LIBRARY_REAL(id)) { | ||||
| /* We do not want to copy existing override rules here, as they would break the proper | /* We do not want to copy existing override rules here, as they would break the proper | ||||
| * remapping between IDs. Proper overrides rules will be re-generated anyway. */ | * remapping between IDs. Proper overrides rules will be re-generated anyway. */ | ||||
| BKE_lib_override_library_copy(new_id, id, false); | BKE_lib_override_library_copy(new_id, id, false); | ||||
| } | } | ||||
| else if (ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id)) { | else if (ID_IS_OVERRIDE_LIBRARY_VIRTUAL(id)) { | ||||
| /* Just ensure virtual overrides do get properly tagged, there is not actual override data to | /* Just ensure virtual overrides do get properly tagged, there is not actual override data to | ||||
| ▲ Show 20 Lines • Show All 1,123 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void BKE_id_blend_write(BlendWriter *writer, ID *id) | void BKE_id_blend_write(BlendWriter *writer, ID *id) | ||||
| { | { | ||||
| if (id->asset_data) { | if (id->asset_data) { | ||||
| BKE_asset_metadata_write(writer, id->asset_data); | BKE_asset_metadata_write(writer, id->asset_data); | ||||
| } | } | ||||
| if (id->library_weak_reference != NULL) { | |||||
| BLO_write_struct(writer, LibraryWeakReference, id->library_weak_reference); | |||||
| } | |||||
| /* ID_WM's id->properties are considered runtime only, and never written in .blend file. */ | /* ID_WM's id->properties are considered runtime only, and never written in .blend file. */ | ||||
| if (id->properties && !ELEM(GS(id->name), ID_WM)) { | if (id->properties && !ELEM(GS(id->name), ID_WM)) { | ||||
| IDP_BlendWrite(writer, id->properties); | IDP_BlendWrite(writer, id->properties); | ||||
| } | } | ||||
| if (id->override_library) { | if (id->override_library) { | ||||
| BLO_write_struct(writer, IDOverrideLibrary, id->override_library); | BLO_write_struct(writer, IDOverrideLibrary, id->override_library); | ||||
| Show All 16 Lines | |||||