Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/indexer.c
| Show First 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | |||||
| void IMB_anim_get_fname(struct anim *anim, char *file, int size) | void IMB_anim_get_fname(struct anim *anim, char *file, int size) | ||||
| { | { | ||||
| char fname[FILE_MAXFILE]; | char fname[FILE_MAXFILE]; | ||||
| BLI_split_dirfile(anim->name, file, fname, size, sizeof(fname)); | BLI_split_dirfile(anim->name, file, fname, size, sizeof(fname)); | ||||
| BLI_strncpy(file, fname, size); | BLI_strncpy(file, fname, size); | ||||
| } | } | ||||
| static void get_proxy_filename(struct anim *anim, | static bool get_proxy_filename(struct anim *anim, | ||||
| IMB_Proxy_Size preview_size, | IMB_Proxy_Size preview_size, | ||||
| char *fname, | char *fname, | ||||
| bool temp) | bool temp) | ||||
| { | { | ||||
| char index_dir[FILE_MAXDIR]; | char index_dir[FILE_MAXDIR]; | ||||
| int i = IMB_proxy_size_to_array_index(preview_size); | int i = IMB_proxy_size_to_array_index(preview_size); | ||||
| char proxy_name[256]; | char proxy_name[256]; | ||||
| Show All 10 Lines | BLI_snprintf(proxy_name, | ||||
| sizeof(proxy_name), | sizeof(proxy_name), | ||||
| name, | name, | ||||
| (int)(proxy_fac[i] * 100), | (int)(proxy_fac[i] * 100), | ||||
| stream_suffix, | stream_suffix, | ||||
| anim->suffix); | anim->suffix); | ||||
| get_index_dir(anim, index_dir, sizeof(index_dir)); | get_index_dir(anim, index_dir, sizeof(index_dir)); | ||||
| if (BLI_path_ncmp(anim->name, index_dir, FILE_MAXDIR) == 0) { | |||||
| return false; | |||||
| } | |||||
| BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); | BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); | ||||
| return true; | |||||
| } | } | ||||
| static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname) | static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname) | ||||
| { | { | ||||
| char index_dir[FILE_MAXDIR]; | char index_dir[FILE_MAXDIR]; | ||||
| int i = IMB_timecode_to_array_index(tc); | int i = IMB_timecode_to_array_index(tc); | ||||
| const char *index_names[] = { | const char *index_names[] = { | ||||
| "record_run%s%s.blen_tc", | "record_run%s%s.blen_tc", | ||||
| ▲ Show 20 Lines • Show All 744 Lines • ▼ Show 20 Lines | IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, | ||||
| int i; | int i; | ||||
| /* Don't generate the same file twice! */ | /* Don't generate the same file twice! */ | ||||
| if (file_list) { | if (file_list) { | ||||
| for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { | for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { | ||||
| IMB_Proxy_Size proxy_size = proxy_sizes[i]; | IMB_Proxy_Size proxy_size = proxy_sizes[i]; | ||||
| if (proxy_size & proxy_sizes_to_build) { | if (proxy_size & proxy_sizes_to_build) { | ||||
| char filename[FILE_MAX]; | char filename[FILE_MAX]; | ||||
| get_proxy_filename(anim, proxy_size, filename, false); | if (get_proxy_filename(anim, proxy_size, filename, false) == false) { | ||||
| return NULL; | |||||
| } | |||||
| void **filename_key_p; | void **filename_key_p; | ||||
| if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) { | if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) { | ||||
| *filename_key_p = BLI_strdup(filename); | *filename_key_p = BLI_strdup(filename); | ||||
| } | } | ||||
| else { | else { | ||||
| proxy_sizes_to_build &= ~proxy_size; | proxy_sizes_to_build &= ~proxy_size; | ||||
| printf("Proxy: %s already registered for generation, skipping\n", filename); | printf("Proxy: %s already registered for generation, skipping\n", filename); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!overwrite) { | if (!overwrite) { | ||||
| IMB_Proxy_Size built_proxies = IMB_anim_proxy_get_existing(anim); | IMB_Proxy_Size built_proxies = IMB_anim_proxy_get_existing(anim); | ||||
| if (built_proxies != 0) { | if (built_proxies != 0) { | ||||
| for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { | for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { | ||||
| IMB_Proxy_Size proxy_size = proxy_sizes[i]; | IMB_Proxy_Size proxy_size = proxy_sizes[i]; | ||||
| if (proxy_size & built_proxies) { | if (proxy_size & built_proxies) { | ||||
| char filename[FILE_MAX]; | char filename[FILE_MAX]; | ||||
| get_proxy_filename(anim, proxy_size, filename, false); | if (get_proxy_filename(anim, proxy_size, filename, false) == false) { | ||||
| return NULL; | |||||
| } | |||||
| printf("Skipping proxy: %s\n", filename); | printf("Skipping proxy: %s\n", filename); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| proxy_sizes_to_build &= ~built_proxies; | proxy_sizes_to_build &= ~built_proxies; | ||||
| } | } | ||||
| fflush(stdout); | fflush(stdout); | ||||
| ▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines | |||||