Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image.c
| Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | for (imapf_src = lb_src->first; imapf_src; imapf_src = imapf_src->next) { | ||||
| if (imapf_src->packedfile) | if (imapf_src->packedfile) | ||||
| imapf_dst->packedfile = dupPackedFile(imapf_src->packedfile); | imapf_dst->packedfile = dupPackedFile(imapf_src->packedfile); | ||||
| BLI_addtail(lb_dst, imapf_dst); | BLI_addtail(lb_dst, imapf_dst); | ||||
| } | } | ||||
| } | } | ||||
| /* empty image block, of similar type and filename */ | /** | ||||
| Image *BKE_image_copy(Main *bmain, const Image *ima) | * Only copy internal data of Image ID from source to already allocated/initialized destination. | ||||
| * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs. | |||||
| * | |||||
| * WARNING! This function will not handle ID user count! | |||||
| * | |||||
| * \param flag Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more). | |||||
| */ | |||||
| void BKE_image_copy_data(Main *UNUSED(bmain), Image *ima_dst, const Image *ima_src, const int flag) | |||||
| { | { | ||||
| Image *nima = image_alloc(bmain, ima->id.name + 2, ima->source, ima->type); | BKE_color_managed_colorspace_settings_copy(&ima_dst->colorspace_settings, &ima_src->colorspace_settings); | ||||
| BLI_strncpy(nima->name, ima->name, sizeof(ima->name)); | |||||
| nima->flag = ima->flag; | |||||
| nima->tpageflag = ima->tpageflag; | |||||
| nima->gen_x = ima->gen_x; | |||||
| nima->gen_y = ima->gen_y; | |||||
| nima->gen_type = ima->gen_type; | |||||
| copy_v4_v4(nima->gen_color, ima->gen_color); | |||||
| nima->animspeed = ima->animspeed; | |||||
| nima->aspx = ima->aspx; | copy_image_packedfiles(&ima_dst->packedfiles, &ima_src->packedfiles); | ||||
| nima->aspy = ima->aspy; | |||||
| BKE_color_managed_colorspace_settings_copy(&nima->colorspace_settings, &ima->colorspace_settings); | ima_dst->stereo3d_format = MEM_dupallocN(ima_src->stereo3d_format); | ||||
| BLI_duplicatelist(&ima_dst->views, &ima_src->views); | |||||
| copy_image_packedfiles(&nima->packedfiles, &ima->packedfiles); | /* Cleanup stuff that cannot be copied. */ | ||||
| ima_dst->cache = NULL; | |||||
| ima_dst->rr = NULL; | |||||
| for (int i = 0; i < IMA_MAX_RENDER_SLOT; i++) { | |||||
| ima_dst->renders[i] = NULL; | |||||
| } | |||||
| /* nima->stere3d_format is already allocated by image_alloc... */ | BLI_listbase_clear(&ima_dst->anims); | ||||
| *nima->stereo3d_format = *ima->stereo3d_format; | |||||
| BLI_duplicatelist(&nima->views, &ima->views); | |||||
| BKE_previewimg_id_copy(&nima->id, &ima->id); | ima_dst->totbind = 0; | ||||
| for (int i = 0; i < TEXTARGET_COUNT; i++) { | |||||
| ima_dst->bindcode[i] = 0; | |||||
| ima_dst->gputexture[i] = NULL; | |||||
| } | |||||
| ima_dst->repbind = NULL; | |||||
| BKE_id_copy_ensure_local(bmain, &ima->id, &nima->id); | if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { | ||||
| BKE_previewimg_id_copy(&ima_dst->id, &ima_src->id); | |||||
| } | |||||
| else { | |||||
| ima_dst->preview = NULL; | |||||
| } | |||||
| } | |||||
| return nima; | /* empty image block, of similar type and filename */ | ||||
| Image *BKE_image_copy(Main *bmain, const Image *ima) | |||||
| { | |||||
| Image *ima_copy; | |||||
| BKE_id_copy_ex(bmain, &ima->id, (ID **)&ima_copy, 0, false); | |||||
| return ima_copy; | |||||
| } | } | ||||
| void BKE_image_make_local(Main *bmain, Image *ima, const bool lib_local) | void BKE_image_make_local(Main *bmain, Image *ima, const bool lib_local) | ||||
| { | { | ||||
| BKE_id_make_local_generic(bmain, &ima->id, true, lib_local); | BKE_id_make_local_generic(bmain, &ima->id, true, lib_local); | ||||
| } | } | ||||
| void BKE_image_merge(Image *dest, Image *source) | void BKE_image_merge(Image *dest, Image *source) | ||||
| ▲ Show 20 Lines • Show All 4,236 Lines • Show Last 20 Lines | |||||