56 CacheFile *cache_file = id_cast<CacheFile *>(
id);
58 cache_file->
scale = 1.0f;
64 std::optional<Library *> ,
69 CacheFile *cache_file_dst = id_cast<CacheFile *>(id_dst);
70 const CacheFile *cache_file_src = id_cast<const CacheFile *>(id_src);
72 cache_file_dst->
handle =
nullptr;
80 CacheFile *cache_file = id_cast<CacheFile *>(
id);
83 cache_file->
layers.free_no_destruct();
88 CacheFile *cache_file = id_cast<CacheFile *>(
id);
95 CacheFile *cache_file = id_cast<CacheFile *>(
id);
99 cache_file->
handle =
nullptr;
114 CacheFile *cache_file = id_cast<CacheFile *>(
id);
116 cache_file->
handle =
nullptr;
125 .id_code = CacheFile::id_type,
127 .dependencies_id_types = 0,
131 .name_plural =
N_(
"cache_files"),
134 .asset_type_info =
nullptr,
139 .make_local =
nullptr,
140 .foreach_id =
nullptr,
141 .foreach_cache =
nullptr,
143 .foreach_working_space_color =
nullptr,
144 .foreach_asset_weak_reference =
nullptr,
145 .owner_pointer_get =
nullptr,
149 .blend_read_after_liblink =
nullptr,
151 .blend_read_undo_preserve =
nullptr,
153 .lib_override_apply_post =
nullptr,
156#if defined(WITH_ALEMBIC) || defined(WITH_USD)
158static Mutex cache_mutex;
164 const char *object_path)
166#if defined(WITH_ALEMBIC) || defined(WITH_USD)
170 if (cache_file->
handle ==
nullptr) {
174 switch (cache_file->
type) {
186 cache_file->
handle, *reader,
object, object_path);
194 std::lock_guard
lock(cache_mutex);
198 cache_file->
handle_readers = MEM_new<CacheFileHandleReaderSet>(
"CacheFile.handle_readers");
207 UNUSED_VARS(cache_file, reader,
object, object_path);
213#if defined(WITH_ALEMBIC) || defined(WITH_USD)
216 std::lock_guard
lock(cache_mutex);
217 if (*reader !=
nullptr) {
221 switch (cache_file->
type) {
250#if defined(WITH_ALEMBIC) || defined(WITH_USD)
255 std::lock_guard
lock(cache_mutex);
258 if (*reader !=
nullptr) {
259 switch (cache_file->
type) {
286 switch (cache_file->
type) {
301 cache_file->
handle =
nullptr;
321 if (cache_file_eval) {
371 const Depsgraph *depsgraph,
401 const double time_offset = double(cache_file->
frame_offset) / fps;
403 return cache_file->
is_sequence ? frame : frame / fps - time_offset;
408 const double time_offset = double(cache_file->
frame_offset);
410 return cache_file->
is_sequence ? frame : frame - time_offset;
421 const int num_layers = cache_file->
layers.count();
File and directory operations.
#define BLO_read_struct_list(reader, struct_name, list)
#define BLT_I18NCONTEXT_ID_CACHEFILE
#define ID_BLEND_PATH(_bmain, _id)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
bool remove(const Key &key)
CacheReader * CacheReader_open_usd_object(CacheArchiveHandle *handle, CacheReader *reader, Object *object, const char *object_path)
void USD_free_handle(CacheArchiveHandle *handle)
void USD_CacheReader_free(CacheReader *reader)
CacheArchiveHandle * USD_create_handle(Main *, const char *filepath, ListBaseT< CacheObjectPath > *object_paths)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
CacheFileLayer * BKE_cachefile_get_active_layer(CacheFile *cache_file)
double BKE_cachefile_frame_offset(const CacheFile *cache_file, double time)
static void cache_file_foreach_path(ID *id, BPathForeachPathData *bpath_data)
static void cachefile_handle_free(CacheFile *cache_file)
void * BKE_cachefile_add(Main *bmain, const char *name)
char * STRNCPY(char(&dst)[N], const char *src)
bool BKE_cachefile_filepath_get(const Main *bmain, const Depsgraph *depsgraph, const CacheFile *cache_file, char r_filepath[1024])
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
bool DEG_is_active(const Depsgraph *depsgraph)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_path_frame(char *path, size_t path_maxncpy, int frame, int digits) ATTR_NONNULL(1)
struct CacheArchiveHandle * ABC_create_handle(const struct Main *bmain, const char *filepath, const struct CacheFileLayer *layers, ListBaseT< CacheObjectPath > *object_paths)
void ABC_free_handle(struct CacheArchiveHandle *handle)
void ABC_CacheReader_free(struct CacheReader *reader)
@ CACHE_FILE_TYPE_INVALID
bool BLI_path_frame_get(const char *path, int *r_frame, int *r_digits_len) ATTR_NONNULL(1
void BKE_id_blend_write(BlendWriter *writer, ID *id)
void BKE_cachefile_remove_layer(CacheFile *cache_file, CacheFileLayer *layer)
static void cache_file_free_data(ID *id)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
static void cache_file_init_data(ID *id)
static void cache_file_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
@ CACHEFILE_VELOCITY_UNIT_SECOND
T * DEG_get_original(T *id)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy)
float BKE_scene_ctime_get(const Scene *scene)
double BKE_cachefile_time_offset(const CacheFile *cache_file, double time, double fps)
struct CacheReader * CacheReader_open_alembic_object(struct CacheArchiveHandle *handle, struct CacheReader *reader, struct Object *object, const char *object_path, bool is_sequence)
bool BLI_path_extension_check_glob(const char *path, const char *ext_fnmatch) ATTR_NONNULL(1
bool void BLI_path_frame_strip(char *path, char *r_ext, size_t ext_maxncpy) ATTR_NONNULL(1
static void cache_file_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static void cache_file_blend_read_data(BlendDataReader *reader, ID *id)
CacheFileLayer * BKE_cachefile_add_layer(CacheFile *cache_file, const char filepath[1024])
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_cachefile_reader_free(CacheFile *cache_file, CacheReader **reader)
void BKE_cachefile_eval(Main *bmain, Depsgraph *depsgraph, CacheFile *cache_file)
void BKE_cachefile_reader_open(CacheFile *cache_file, CacheReader **reader, Object *object, const char *object_path)
void BKE_cachefile_reload(Depsgraph *depsgraph, CacheFile *cache_file)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
CacheFileHandleReaderSet * handle_readers
struct CacheArchiveHandle * handle
char handle_filepath[1024]
ListBaseT< CacheObjectPath > object_paths
ListBaseT< CacheFileLayer > layers
eCacheFile_VelocityUnit velocity_unit