Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image.c
| Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | static void image_foreach_cache(ID *id, | ||||
| LISTBASE_FOREACH (RenderSlot *, slot, &image->renderslots) { | LISTBASE_FOREACH (RenderSlot *, slot, &image->renderslots) { | ||||
| key.offset_in_ID = (size_t)BLI_ghashutil_strhash_p(slot->name); | key.offset_in_ID = (size_t)BLI_ghashutil_strhash_p(slot->name); | ||||
| key.cache_v = slot->render; | key.cache_v = slot->render; | ||||
| function_callback(id, &key, (void **)&slot->render, 0, user_data); | function_callback(id, &key, (void **)&slot->render, 0, user_data); | ||||
| } | } | ||||
| } | } | ||||
| static void image_foreach_external_file( | |||||
| ID *id, IDTypeForeachExternalFileFunctionCallback function_callback, void *user_data) | |||||
| { | |||||
| if (BKE_packedfile_id_check(id)) { | |||||
| return; | |||||
| } | |||||
| Image *ima = (Image *)id; | |||||
| char *file_path = NULL; | |||||
| switch (ima->source) { | |||||
| case IMA_SRC_FILE: | |||||
| /* Store pointer `ima->filepath` as a local variable to suppress compilation warning. */ | |||||
| file_path = ima->filepath; | |||||
| function_callback(id, &file_path, sizeof(ima->filepath), false, user_data); | |||||
| break; | |||||
| case IMA_SRC_SEQUENCE: | |||||
| /* TODO(jbakker): add support for image sequences. */ | |||||
| break; | |||||
| case IMA_SRC_MOVIE: | |||||
| /* Store pointer `ima->filepath` as a local variable to suppress compilation warning. */ | |||||
| file_path = ima->filepath; | |||||
| function_callback(id, &file_path, sizeof(ima->filepath), false, user_data); | |||||
| break; | |||||
| case IMA_SRC_GENERATED: | |||||
| break; | |||||
| case IMA_SRC_VIEWER: | |||||
| break; | |||||
| case IMA_SRC_TILED: | |||||
| /* TODO(jbakker): add support for tiled images. */ | |||||
| break; | |||||
| } | |||||
| } | |||||
| static void image_blend_write(BlendWriter *writer, ID *id, const void *id_address) | static void image_blend_write(BlendWriter *writer, ID *id, const void *id_address) | ||||
| { | { | ||||
| Image *ima = (Image *)id; | Image *ima = (Image *)id; | ||||
| const bool is_undo = BLO_write_is_undo(writer); | const bool is_undo = BLO_write_is_undo(writer); | ||||
| /* Clear all data that isn't read to reduce false detection of changed image during memfile undo. | /* Clear all data that isn't read to reduce false detection of changed image during memfile undo. | ||||
| */ | */ | ||||
| ima->lastused = 0; | ima->lastused = 0; | ||||
| ▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | IDTypeInfo IDType_ID_IM = { | ||||
| .flags = IDTYPE_FLAGS_NO_ANIMDATA | IDTYPE_FLAGS_APPEND_IS_REUSABLE, | .flags = IDTYPE_FLAGS_NO_ANIMDATA | IDTYPE_FLAGS_APPEND_IS_REUSABLE, | ||||
| .init_data = image_init_data, | .init_data = image_init_data, | ||||
| .copy_data = image_copy_data, | .copy_data = image_copy_data, | ||||
| .free_data = image_free_data, | .free_data = image_free_data, | ||||
| .make_local = NULL, | .make_local = NULL, | ||||
| .foreach_id = NULL, | .foreach_id = NULL, | ||||
| .foreach_cache = image_foreach_cache, | .foreach_cache = image_foreach_cache, | ||||
| .foreach_external_file = image_foreach_external_file, | |||||
| .owner_get = NULL, | .owner_get = NULL, | ||||
| .blend_write = image_blend_write, | .blend_write = image_blend_write, | ||||
| .blend_read_data = image_blend_read_data, | .blend_read_data = image_blend_read_data, | ||||
| .blend_read_lib = image_blend_read_lib, | .blend_read_lib = image_blend_read_lib, | ||||
| .blend_read_expand = NULL, | .blend_read_expand = NULL, | ||||
| .blend_read_undo_preserve = NULL, | .blend_read_undo_preserve = NULL, | ||||
| ▲ Show 20 Lines • Show All 5,742 Lines • Show Last 20 Lines | |||||