BKE_library: id_copy: More general usage of LIB_ID_COPY_LOCALIZE.

Turns out most of our 'local working copy' cases can use same set of
flags.

Note that this commit adds LIB_ID_COPY_CACHES to all our local meshes
copying, however this is no-op since that flag is unused during mesh
copying... We may want to add another set of flags without that one at
some point, but for now it would not be useful imho.
This commit is contained in:
2019-02-04 17:51:15 +01:00
parent 72724211df
commit b6771ccaf6
17 changed files with 22 additions and 113 deletions

View File

@@ -717,12 +717,7 @@ static bool remap_hair_emitter(
return false;
}
/* don't modify the original vertices */
BKE_id_copy_ex(
NULL, &mesh->id, (ID **)&mesh,
LIB_ID_CREATE_NO_MAIN |
LIB_ID_CREATE_NO_USER_REFCOUNT |
LIB_ID_CREATE_NO_DEG_TAG |
LIB_ID_COPY_NO_PREVIEW);
BKE_id_copy_ex(NULL, &mesh->id, (ID **)&mesh, LIB_ID_COPY_LOCALIZE);
/* BMESH_ONLY, deform dm may not have tessface */
BKE_mesh_tessface_ensure(mesh);
@@ -1098,12 +1093,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
modifier_unique_name(&ob_to->modifiers, (ModifierData *)psmd);
psmd->psys = psys;
BKE_id_copy_ex(
NULL, &final_mesh->id, (ID **)&psmd->mesh_final,
LIB_ID_CREATE_NO_MAIN |
LIB_ID_CREATE_NO_USER_REFCOUNT |
LIB_ID_CREATE_NO_DEG_TAG |
LIB_ID_COPY_NO_PREVIEW);
BKE_id_copy_ex(NULL, &final_mesh->id, (ID **)&psmd->mesh_final, LIB_ID_COPY_LOCALIZE);
BKE_mesh_calc_normals(psmd->mesh_final);
BKE_mesh_tessface_ensure(psmd->mesh_final);