Cleanup: use term 'filepath' for full file paths
This commit is contained in:
parent
77ddcc4717
commit
5c9ab3e003
|
@ -25,17 +25,17 @@ void cdf_free(CDataFile *cdf);
|
|||
|
||||
/* File read/write/remove */
|
||||
|
||||
bool cdf_read_open(CDataFile *cdf, const char *filename);
|
||||
bool cdf_read_open(CDataFile *cdf, const char *filepath);
|
||||
bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay);
|
||||
bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data);
|
||||
void cdf_read_close(CDataFile *cdf);
|
||||
|
||||
bool cdf_write_open(CDataFile *cdf, const char *filename);
|
||||
bool cdf_write_open(CDataFile *cdf, const char *filepath);
|
||||
bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay);
|
||||
bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data);
|
||||
void cdf_write_close(CDataFile *cdf);
|
||||
|
||||
void cdf_remove(const char *filename);
|
||||
void cdf_remove(const char *filepath);
|
||||
|
||||
/* Layers */
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ bool BKE_previewimg_id_supports_jobs(const struct ID *id);
|
|||
/**
|
||||
* Trigger deferred loading of a custom image file into the preview buffer.
|
||||
*/
|
||||
void BKE_previewimg_id_custom_set(struct ID *id, const char *path);
|
||||
void BKE_previewimg_id_custom_set(struct ID *id, const char *filepath);
|
||||
|
||||
/**
|
||||
* Free the preview image belonging to the id.
|
||||
|
@ -223,11 +223,12 @@ struct PreviewImage *BKE_previewimg_cached_get(const char *name);
|
|||
struct PreviewImage *BKE_previewimg_cached_ensure(const char *name);
|
||||
|
||||
/**
|
||||
* Generate a #PreviewImage from given file path, using thumbnails management, if not yet existing.
|
||||
* Does not actually generate the preview, #BKE_previewimg_ensure() must be called for that.
|
||||
* Generate a #PreviewImage from given `filepath`, using thumbnails management, if not yet
|
||||
* existing. Does not actually generate the preview, #BKE_previewimg_ensure() must be called for
|
||||
* that.
|
||||
*/
|
||||
struct PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name,
|
||||
const char *path,
|
||||
const char *filepath,
|
||||
int source,
|
||||
bool force_update);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ static CLG_LogRef LOG = {"bke.appdir"};
|
|||
|
||||
static struct {
|
||||
/** Full path to program executable. */
|
||||
char program_filename[FILE_MAX];
|
||||
char program_filepath[FILE_MAX];
|
||||
/** Full path to directory in which executable is located. */
|
||||
char program_dirname[FILE_MAX];
|
||||
/** Persistent temporary directory (defined by the preferences or OS). */
|
||||
|
@ -860,14 +860,14 @@ static void where_am_i(char *fullname, const size_t maxlen, const char *name)
|
|||
|
||||
void BKE_appdir_program_path_init(const char *argv0)
|
||||
{
|
||||
where_am_i(g_app.program_filename, sizeof(g_app.program_filename), argv0);
|
||||
BLI_split_dir_part(g_app.program_filename, g_app.program_dirname, sizeof(g_app.program_dirname));
|
||||
where_am_i(g_app.program_filepath, sizeof(g_app.program_filepath), argv0);
|
||||
BLI_split_dir_part(g_app.program_filepath, g_app.program_dirname, sizeof(g_app.program_dirname));
|
||||
}
|
||||
|
||||
const char *BKE_appdir_program_path(void)
|
||||
{
|
||||
BLI_assert(g_app.program_filename[0]);
|
||||
return g_app.program_filename;
|
||||
BLI_assert(g_app.program_filepath[0]);
|
||||
return g_app.program_filepath;
|
||||
}
|
||||
|
||||
const char *BKE_appdir_program_dir(void)
|
||||
|
|
|
@ -65,7 +65,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu,
|
|||
if (UNDO_DISK) {
|
||||
const struct BlendFileReadParams params = {0};
|
||||
BlendFileReadReport bf_reports = {.reports = NULL};
|
||||
struct BlendFileData *bfd = BKE_blendfile_read(mfu->filename, ¶ms, &bf_reports);
|
||||
struct BlendFileData *bfd = BKE_blendfile_read(mfu->filepath, ¶ms, &bf_reports);
|
||||
if (bfd != NULL) {
|
||||
BKE_blendfile_read_setup(C, bfd, ¶ms, &bf_reports);
|
||||
success = true;
|
||||
|
@ -108,20 +108,20 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev)
|
|||
/* disk save version */
|
||||
if (UNDO_DISK) {
|
||||
static int counter = 0;
|
||||
char filename[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
char numstr[32];
|
||||
|
||||
/* Calculate current filename. */
|
||||
/* Calculate current filepath. */
|
||||
counter++;
|
||||
counter = counter % U.undosteps;
|
||||
|
||||
BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
|
||||
BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), numstr);
|
||||
BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_session(), numstr);
|
||||
|
||||
/* success = */ /* UNUSED */ BLO_write_file(
|
||||
bmain, filename, fileflags, &(const struct BlendFileWriteParams){0}, NULL);
|
||||
bmain, filepath, fileflags, &(const struct BlendFileWriteParams){0}, NULL);
|
||||
|
||||
BLI_strncpy(mfu->filename, filename, sizeof(mfu->filename));
|
||||
BLI_strncpy(mfu->filepath, filepath, sizeof(mfu->filepath));
|
||||
}
|
||||
else {
|
||||
MemFile *prevfile = (mfu_prev) ? &(mfu_prev->memfile) : NULL;
|
||||
|
|
|
@ -268,11 +268,11 @@ static bool cdf_write_header(CDataFile *cdf)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool cdf_read_open(CDataFile *cdf, const char *filename)
|
||||
bool cdf_read_open(CDataFile *cdf, const char *filepath)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
f = BLI_fopen(filename, "rb");
|
||||
f = BLI_fopen(filepath, "rb");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
|
@ -333,14 +333,14 @@ void cdf_read_close(CDataFile *cdf)
|
|||
}
|
||||
}
|
||||
|
||||
bool cdf_write_open(CDataFile *cdf, const char *filename)
|
||||
bool cdf_write_open(CDataFile *cdf, const char *filepath)
|
||||
{
|
||||
CDataFileHeader *header;
|
||||
CDataFileImageHeader *image;
|
||||
CDataFileMeshHeader *mesh;
|
||||
FILE *f;
|
||||
|
||||
f = BLI_fopen(filename, "wb");
|
||||
f = BLI_fopen(filepath, "wb");
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
|
@ -402,9 +402,9 @@ void cdf_write_close(CDataFile *cdf)
|
|||
}
|
||||
}
|
||||
|
||||
void cdf_remove(const char *filename)
|
||||
void cdf_remove(const char *filepath)
|
||||
{
|
||||
BLI_delete(filename, false, false);
|
||||
BLI_delete(filepath, false, false);
|
||||
}
|
||||
|
||||
/********************************** Layers ***********************************/
|
||||
|
|
|
@ -241,16 +241,16 @@ static PreviewImage *previewimg_create_ex(size_t deferred_data_size)
|
|||
return prv_img;
|
||||
}
|
||||
|
||||
static PreviewImage *previewimg_deferred_create(const char *path, int source)
|
||||
static PreviewImage *previewimg_deferred_create(const char *filepath, int source)
|
||||
{
|
||||
/* We pack needed data for lazy loading (source type, in a single char, and path). */
|
||||
const size_t deferred_data_size = strlen(path) + 2;
|
||||
/* We pack needed data for lazy loading (source type, in a single char, and filepath). */
|
||||
const size_t deferred_data_size = strlen(filepath) + 2;
|
||||
char *deferred_data;
|
||||
|
||||
PreviewImage *prv = previewimg_create_ex(deferred_data_size);
|
||||
deferred_data = (char *)PRV_DEFERRED_DATA(prv);
|
||||
deferred_data[0] = source;
|
||||
memcpy(&deferred_data[1], path, deferred_data_size - 1);
|
||||
memcpy(&deferred_data[1], filepath, deferred_data_size - 1);
|
||||
|
||||
return prv;
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ PreviewImage *BKE_previewimg_id_ensure(ID *id)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void BKE_previewimg_id_custom_set(ID *id, const char *path)
|
||||
void BKE_previewimg_id_custom_set(ID *id, const char *filepath)
|
||||
{
|
||||
PreviewImage **prv = BKE_previewimg_id_get_p(id);
|
||||
|
||||
|
@ -403,7 +403,7 @@ void BKE_previewimg_id_custom_set(ID *id, const char *path)
|
|||
if (*prv) {
|
||||
BKE_previewimg_deferred_release(*prv);
|
||||
}
|
||||
*prv = previewimg_deferred_create(path, THB_SOURCE_IMAGE);
|
||||
*prv = previewimg_deferred_create(filepath, THB_SOURCE_IMAGE);
|
||||
|
||||
/* Can't lazy-render the preview on access. ID previews are saved to files and we want them to be
|
||||
* there in time. Not only if something happened to have accessed it meanwhile. */
|
||||
|
@ -458,7 +458,7 @@ PreviewImage *BKE_previewimg_cached_ensure(const char *name)
|
|||
}
|
||||
|
||||
PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name,
|
||||
const char *path,
|
||||
const char *filepath,
|
||||
const int source,
|
||||
bool force_update)
|
||||
{
|
||||
|
@ -476,8 +476,8 @@ PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name,
|
|||
|
||||
if (prv && force_update) {
|
||||
const char *prv_deferred_data = (char *)PRV_DEFERRED_DATA(prv);
|
||||
if (((int)prv_deferred_data[0] == source) && STREQ(&prv_deferred_data[1], path)) {
|
||||
/* If same path, no need to re-allocate preview, just clear it up. */
|
||||
if (((int)prv_deferred_data[0] == source) && STREQ(&prv_deferred_data[1], filepath)) {
|
||||
/* If same filepath, no need to re-allocate preview, just clear it up. */
|
||||
BKE_previewimg_clear(prv);
|
||||
}
|
||||
else {
|
||||
|
@ -486,7 +486,7 @@ PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name,
|
|||
}
|
||||
|
||||
if (!prv) {
|
||||
prv = previewimg_deferred_create(path, source);
|
||||
prv = previewimg_deferred_create(filepath, source);
|
||||
force_update = true;
|
||||
}
|
||||
|
||||
|
@ -521,10 +521,10 @@ void BKE_previewimg_ensure(PreviewImage *prv, const int size)
|
|||
ImBuf *thumb;
|
||||
char *prv_deferred_data = (char *)PRV_DEFERRED_DATA(prv);
|
||||
int source = prv_deferred_data[0];
|
||||
char *path = &prv_deferred_data[1];
|
||||
char *filepath = &prv_deferred_data[1];
|
||||
int icon_w, icon_h;
|
||||
|
||||
thumb = IMB_thumb_manage(path, THB_LARGE, (ThumbSource)source);
|
||||
thumb = IMB_thumb_manage(filepath, THB_LARGE, (ThumbSource)source);
|
||||
|
||||
if (thumb) {
|
||||
/* PreviewImage assumes premultiplied alhpa... */
|
||||
|
|
|
@ -1450,7 +1450,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
|
|||
{
|
||||
PTCacheFile *pf;
|
||||
FILE *fp = NULL;
|
||||
char filename[MAX_PTCACHE_FILE];
|
||||
char filepath[MAX_PTCACHE_FILE];
|
||||
|
||||
#ifndef DURIAN_POINTCACHE_LIB_OK
|
||||
/* don't allow writing for linked objects */
|
||||
|
@ -1465,20 +1465,20 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
|
|||
}
|
||||
}
|
||||
|
||||
ptcache_filename(pid, filename, cfra, true, true);
|
||||
ptcache_filename(pid, filepath, cfra, true, true);
|
||||
|
||||
if (mode == PTCACHE_FILE_READ) {
|
||||
fp = BLI_fopen(filename, "rb");
|
||||
fp = BLI_fopen(filepath, "rb");
|
||||
}
|
||||
else if (mode == PTCACHE_FILE_WRITE) {
|
||||
/* Will create the dir if needs be, same as "//textures" is created. */
|
||||
BLI_make_existing_file(filename);
|
||||
BLI_make_existing_file(filepath);
|
||||
|
||||
fp = BLI_fopen(filename, "wb");
|
||||
fp = BLI_fopen(filepath, "wb");
|
||||
}
|
||||
else if (mode == PTCACHE_FILE_UPDATE) {
|
||||
BLI_make_existing_file(filename);
|
||||
fp = BLI_fopen(filename, "rb+");
|
||||
BLI_make_existing_file(filepath);
|
||||
fp = BLI_fopen(filepath, "rb+");
|
||||
}
|
||||
|
||||
if (!fp) {
|
||||
|
|
|
@ -156,10 +156,11 @@ BlendFileData *BLO_read_from_memory(const void *mem,
|
|||
*
|
||||
* \param oldmain: old main,
|
||||
* from which we will keep libraries and other data-blocks that should not have changed.
|
||||
* \param filename: current file, only for retrieving library data.
|
||||
* \param filepath: current file, only for retrieving library data.
|
||||
* Typically `BKE_main_blendfile_path(oldmain)`.
|
||||
*/
|
||||
BlendFileData *BLO_read_from_memfile(struct Main *oldmain,
|
||||
const char *filename,
|
||||
const char *filepath,
|
||||
struct MemFile *memfile,
|
||||
const struct BlendFileReadParams *params,
|
||||
struct ReportList *reports);
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef struct MemFileWriteData {
|
|||
} MemFileWriteData;
|
||||
|
||||
typedef struct MemFileUndoData {
|
||||
char filename[1024]; /* FILE_MAX */
|
||||
char filepath[1024]; /* FILE_MAX */
|
||||
MemFile memfile;
|
||||
size_t undo_size;
|
||||
} MemFileUndoData;
|
||||
|
@ -98,6 +98,6 @@ extern struct Main *BLO_memfile_main_get(struct MemFile *memfile,
|
|||
*
|
||||
* \return success.
|
||||
*/
|
||||
extern bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename);
|
||||
extern bool BLO_memfile_write_file(struct MemFile *memfile, const char *filepath);
|
||||
|
||||
FileReader *BLO_memfile_new_filereader(MemFile *memfile, int undo_direction);
|
||||
|
|
|
@ -388,7 +388,7 @@ BlendFileData *BLO_read_from_memory(const void *mem,
|
|||
}
|
||||
|
||||
BlendFileData *BLO_read_from_memfile(Main *oldmain,
|
||||
const char *filename,
|
||||
const char *filepath,
|
||||
MemFile *memfile,
|
||||
const struct BlendFileReadParams *params,
|
||||
ReportList *reports)
|
||||
|
@ -401,7 +401,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
|
|||
fd = blo_filedata_from_memfile(memfile, params, &bf_reports);
|
||||
if (fd) {
|
||||
fd->skip_flags = params->skip_flags;
|
||||
BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase));
|
||||
BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase));
|
||||
|
||||
/* separate libraries from old main */
|
||||
blo_split_main(&old_mainlist, oldmain);
|
||||
|
@ -420,7 +420,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain,
|
|||
* read IDs whenever possible. */
|
||||
blo_cache_storage_init(fd, oldmain);
|
||||
|
||||
bfd = blo_read_file_internal(fd, filename);
|
||||
bfd = blo_read_file_internal(fd, filepath);
|
||||
|
||||
/* Ensure relinked caches are not freed together with their old IDs. */
|
||||
blo_cache_storage_old_bmain_clear(fd, oldmain);
|
||||
|
|
|
@ -195,7 +195,7 @@ struct Main *BLO_memfile_main_get(struct MemFile *memfile,
|
|||
return bmain_undo;
|
||||
}
|
||||
|
||||
bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename)
|
||||
bool BLO_memfile_write_file(struct MemFile *memfile, const char *filepath)
|
||||
{
|
||||
MemFileChunk *chunk;
|
||||
int file, oflags;
|
||||
|
@ -216,12 +216,12 @@ bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename)
|
|||
# warning "Symbolic links will be followed on undo save, possibly causing CVE-2008-1103"
|
||||
# endif
|
||||
#endif
|
||||
file = BLI_open(filename, oflags, 0666);
|
||||
file = BLI_open(filepath, oflags, 0666);
|
||||
|
||||
if (file == -1) {
|
||||
fprintf(stderr,
|
||||
"Unable to save '%s': %s\n",
|
||||
filename,
|
||||
filepath,
|
||||
errno ? strerror(errno) : "Unknown error opening file");
|
||||
return false;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename)
|
|||
if (chunk) {
|
||||
fprintf(stderr,
|
||||
"Unable to save '%s': %s\n",
|
||||
filename,
|
||||
filepath,
|
||||
errno ? strerror(errno) : "Unknown error writing file");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ void DebugInfo::graphviz(const ExecutionSystem *system, StringRefNull name)
|
|||
char *str = (char *)MEM_mallocN(max_textlength, __func__);
|
||||
if (graphviz_system(system, str, max_textlength - 1)) {
|
||||
char basename[FILE_MAX];
|
||||
char filename[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
if (name.is_empty()) {
|
||||
BLI_snprintf(basename, sizeof(basename), "compositor_%d.dot", file_index_);
|
||||
|
@ -428,12 +428,12 @@ void DebugInfo::graphviz(const ExecutionSystem *system, StringRefNull name)
|
|||
else {
|
||||
BLI_strncpy(basename, (name + ".dot").c_str(), sizeof(basename));
|
||||
}
|
||||
BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), basename);
|
||||
BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_session(), basename);
|
||||
file_index_++;
|
||||
|
||||
std::cout << "Writing compositor debug to: " << filename << "\n";
|
||||
std::cout << "Writing compositor debug to: " << filepath << "\n";
|
||||
|
||||
FILE *fp = BLI_fopen(filename, "wb");
|
||||
FILE *fp = BLI_fopen(filepath, "wb");
|
||||
fputs(str, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
|
|
@ -75,17 +75,17 @@ static void open_cancel(bContext *UNUSED(C), wmOperator *op)
|
|||
static int cachefile_open_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
BKE_report(op->reports, RPT_ERROR, "No filename given");
|
||||
BKE_report(op->reports, RPT_ERROR, "No filepath given");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
char filename[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filename);
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, BLI_path_basename(filename), 0);
|
||||
BLI_strncpy(cache_file->filepath, filename, FILE_MAX);
|
||||
CacheFile *cache_file = BKE_libblock_alloc(bmain, ID_CF, BLI_path_basename(filepath), 0);
|
||||
BLI_strncpy(cache_file->filepath, filepath, FILE_MAX);
|
||||
DEG_id_tag_update(&cache_file->id, ID_RECALC_COPY_ON_WRITE);
|
||||
|
||||
/* Will be set when running invoke, not exec directly. */
|
||||
|
@ -182,7 +182,7 @@ static int cachefile_layer_open_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
static int cachefile_layer_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
|
||||
BKE_report(op->reports, RPT_ERROR, "No filename given");
|
||||
BKE_report(op->reports, RPT_ERROR, "No filepath given");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -192,10 +192,10 @@ static int cachefile_layer_add_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
char filename[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filename);
|
||||
char filepath[FILE_MAX];
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
CacheFileLayer *layer = BKE_cachefile_add_layer(cache_file, filename);
|
||||
CacheFileLayer *layer = BKE_cachefile_add_layer(cache_file, filepath);
|
||||
|
||||
if (!layer) {
|
||||
WM_report(RPT_ERROR, "Could not add a layer to the cache file");
|
||||
|
|
|
@ -1306,7 +1306,7 @@ static ImBuf *icon_preview_imbuf_from_brush(Brush *brush)
|
|||
{
|
||||
static const int flags = IB_rect | IB_multilayer | IB_metadata;
|
||||
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
const char *folder;
|
||||
|
||||
if (!(brush->icon_imbuf)) {
|
||||
|
@ -1315,22 +1315,22 @@ static ImBuf *icon_preview_imbuf_from_brush(Brush *brush)
|
|||
if (brush->icon_filepath[0]) {
|
||||
/* First use the path directly to try and load the file. */
|
||||
|
||||
BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
|
||||
BLI_path_abs(path, ID_BLEND_PATH_FROM_GLOBAL(&brush->id));
|
||||
BLI_strncpy(filepath, brush->icon_filepath, sizeof(brush->icon_filepath));
|
||||
BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&brush->id));
|
||||
|
||||
/* Use default color-spaces for brushes. */
|
||||
brush->icon_imbuf = IMB_loadiffname(path, flags, nullptr);
|
||||
brush->icon_imbuf = IMB_loadiffname(filepath, flags, nullptr);
|
||||
|
||||
/* otherwise lets try to find it in other directories */
|
||||
if (!(brush->icon_imbuf)) {
|
||||
folder = BKE_appdir_folder_id(BLENDER_DATAFILES, "brushicons");
|
||||
|
||||
BLI_make_file_string(
|
||||
BKE_main_blendfile_path_from_global(), path, folder, brush->icon_filepath);
|
||||
BKE_main_blendfile_path_from_global(), filepath, folder, brush->icon_filepath);
|
||||
|
||||
if (path[0]) {
|
||||
if (filepath[0]) {
|
||||
/* Use default color spaces. */
|
||||
brush->icon_imbuf = IMB_loadiffname(path, flags, nullptr);
|
||||
brush->icon_imbuf = IMB_loadiffname(filepath, flags, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1821,13 +1821,13 @@ void PreviewLoadJob::run_fn(void *customdata,
|
|||
|
||||
const char *deferred_data = static_cast<char *>(PRV_DEFERRED_DATA(preview));
|
||||
const ThumbSource source = static_cast<ThumbSource>(deferred_data[0]);
|
||||
const char *path = &deferred_data[1];
|
||||
const char *filepath = &deferred_data[1];
|
||||
|
||||
// printf("loading deferred %d×%d preview for %s\n", request->sizex, request->sizey, path);
|
||||
// printf("loading deferred %d×%d preview for %s\n", request->sizex, request->sizey, filepath);
|
||||
|
||||
IMB_thumb_path_lock(path);
|
||||
ImBuf *thumb = IMB_thumb_manage(path, THB_LARGE, source);
|
||||
IMB_thumb_path_unlock(path);
|
||||
IMB_thumb_path_lock(filepath);
|
||||
ImBuf *thumb = IMB_thumb_manage(filepath, THB_LARGE, source);
|
||||
IMB_thumb_path_unlock(filepath);
|
||||
|
||||
if (thumb) {
|
||||
/* PreviewImage assumes premultiplied alpha... */
|
||||
|
|
|
@ -336,7 +336,7 @@ enum {
|
|||
};
|
||||
|
||||
typedef struct FileListEntryPreview {
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
uint flags;
|
||||
int index;
|
||||
int attributes; /* from FileDirEntry. */
|
||||
|
@ -1636,13 +1636,13 @@ static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdat
|
|||
source = THB_SOURCE_FONT;
|
||||
}
|
||||
|
||||
IMB_thumb_path_lock(preview->path);
|
||||
IMB_thumb_path_lock(preview->filepath);
|
||||
/* Always generate biggest preview size for now, it's simpler and avoids having to re-generate
|
||||
* in case user switch to a bigger preview size. Do not create preview when file is offline. */
|
||||
ImBuf *imbuf = (preview->attributes & FILE_ATTR_OFFLINE) ?
|
||||
IMB_thumb_read(preview->path, THB_LARGE) :
|
||||
IMB_thumb_manage(preview->path, THB_LARGE, source);
|
||||
IMB_thumb_path_unlock(preview->path);
|
||||
IMB_thumb_read(preview->filepath, THB_LARGE) :
|
||||
IMB_thumb_manage(preview->filepath, THB_LARGE, source);
|
||||
IMB_thumb_path_unlock(preview->filepath);
|
||||
if (imbuf) {
|
||||
preview->icon_id = BKE_icon_imbuf_create(imbuf);
|
||||
}
|
||||
|
@ -1753,7 +1753,7 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
|
|||
if (preview_in_memory) {
|
||||
/* TODO(mano-wii): No need to use the thread API here. */
|
||||
BLI_assert(BKE_previewimg_is_finished(preview_in_memory, ICON_SIZE_PREVIEW));
|
||||
preview->path[0] = '\0';
|
||||
preview->filepath[0] = '\0';
|
||||
ImBuf *imbuf = BKE_previewimg_to_imbuf(preview_in_memory, ICON_SIZE_PREVIEW);
|
||||
if (imbuf) {
|
||||
preview->icon_id = BKE_icon_imbuf_create(imbuf);
|
||||
|
@ -1762,13 +1762,13 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry
|
|||
}
|
||||
else {
|
||||
if (entry->redirection_path) {
|
||||
BLI_strncpy(preview->path, entry->redirection_path, FILE_MAXDIR);
|
||||
BLI_strncpy(preview->filepath, entry->redirection_path, FILE_MAXDIR);
|
||||
}
|
||||
else {
|
||||
BLI_join_dirfile(
|
||||
preview->path, sizeof(preview->path), filelist->filelist.root, entry->relpath);
|
||||
preview->filepath, sizeof(preview->filepath), filelist->filelist.root, entry->relpath);
|
||||
}
|
||||
// printf("%s: %d - %s\n", __func__, preview->index, preview->path);
|
||||
// printf("%s: %d - %s\n", __func__, preview->index, preview->filepath);
|
||||
|
||||
FileListEntryPreviewTaskData *preview_taskdata = MEM_mallocN(sizeof(*preview_taskdata),
|
||||
__func__);
|
||||
|
@ -2667,7 +2667,7 @@ bool filelist_cache_previews_update(FileList *filelist)
|
|||
* we do not want to cache it again here. */
|
||||
entry = filelist_file_ex(filelist, preview->index, false);
|
||||
|
||||
// printf("%s: %d - %s - %p\n", __func__, preview->index, preview->path, preview->img);
|
||||
// printf("%s: %d - %s - %p\n", __func__, preview->index, preview->filepath, preview->img);
|
||||
|
||||
if (entry) {
|
||||
if (preview->icon_id) {
|
||||
|
|
|
@ -519,13 +519,13 @@ void fsmenu_remove_entry(struct FSMenu *fsmenu, FSMenuCategory category, int idx
|
|||
}
|
||||
}
|
||||
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filename)
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
|
||||
{
|
||||
FSMenuEntry *fsm_iter = NULL;
|
||||
char fsm_name[FILE_MAX];
|
||||
int nwritten = 0;
|
||||
|
||||
FILE *fp = BLI_fopen(filename, "w");
|
||||
FILE *fp = BLI_fopen(filepath, "w");
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
|
@ -556,14 +556,14 @@ void fsmenu_write_file(struct FSMenu *fsmenu, const char *filename)
|
|||
fclose(fp);
|
||||
}
|
||||
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename)
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath)
|
||||
{
|
||||
char line[FILE_MAXDIR];
|
||||
char name[FILE_MAXFILE];
|
||||
FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
|
||||
FILE *fp;
|
||||
|
||||
fp = BLI_fopen(filename, "r");
|
||||
fp = BLI_fopen(filepath, "r");
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ short fsmenu_can_save(struct FSMenu *fsmenu, enum FSMenuCategory category, int i
|
|||
void fsmenu_remove_entry(struct FSMenu *fsmenu, enum FSMenuCategory category, int idx);
|
||||
|
||||
/** saves the 'bookmarks' to the specified file */
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filename);
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath);
|
||||
|
||||
/** reads the 'bookmarks' from the specified file */
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filename);
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath);
|
||||
|
||||
/** adds system specific directories */
|
||||
void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks);
|
||||
|
|
|
@ -67,19 +67,19 @@ static bool lib_id_preview_editing_poll(bContext *C)
|
|||
|
||||
static int lib_id_load_custom_preview_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
RNA_string_get(op->ptr, "filepath", path);
|
||||
RNA_string_get(op->ptr, "filepath", filepath);
|
||||
|
||||
if (!BLI_is_file(path)) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "File not found '%s'", path);
|
||||
if (!BLI_is_file(filepath)) {
|
||||
BKE_reportf(op->reports, RPT_ERROR, "File not found '%s'", filepath);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
PointerRNA idptr = CTX_data_pointer_get(C, "id");
|
||||
ID *id = (ID *)idptr.data;
|
||||
|
||||
BKE_previewimg_id_custom_set(id, path);
|
||||
BKE_previewimg_id_custom_set(id, filepath);
|
||||
|
||||
WM_event_add_notifier(C, NC_ASSET | NA_EDITED, nullptr);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef enum ThumbSource {
|
|||
/**
|
||||
* Create thumbnail for file and returns new imbuf for thumbnail.
|
||||
*/
|
||||
struct ImBuf *IMB_thumb_create(const char *path,
|
||||
struct ImBuf *IMB_thumb_create(const char *filepath,
|
||||
ThumbSize size,
|
||||
ThumbSource source,
|
||||
struct ImBuf *img);
|
||||
|
@ -58,17 +58,17 @@ struct ImBuf *IMB_thumb_create(const char *path,
|
|||
/**
|
||||
* Read thumbnail for file and returns new imbuf for thumbnail.
|
||||
*/
|
||||
struct ImBuf *IMB_thumb_read(const char *path, ThumbSize size);
|
||||
struct ImBuf *IMB_thumb_read(const char *filepath, ThumbSize size);
|
||||
|
||||
/**
|
||||
* Delete all thumbs for the file.
|
||||
*/
|
||||
void IMB_thumb_delete(const char *path, ThumbSize size);
|
||||
void IMB_thumb_delete(const char *filepath, ThumbSize size);
|
||||
|
||||
/**
|
||||
* Create the thumb if necessary and manage failed and old thumbs.
|
||||
*/
|
||||
struct ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source);
|
||||
struct ImBuf *IMB_thumb_manage(const char *filepath, ThumbSize size, ThumbSource source);
|
||||
|
||||
/**
|
||||
* Create the necessary directories to store the thumbnails.
|
||||
|
@ -85,7 +85,7 @@ struct ImBuf *IMB_thumb_load_blend(const char *blen_path,
|
|||
/**
|
||||
* Special function for previewing fonts.
|
||||
*/
|
||||
struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y);
|
||||
struct ImBuf *IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned int y);
|
||||
bool IMB_thumb_load_font_get_hash(char *r_hash);
|
||||
void IMB_thumb_clear_translations(void);
|
||||
void IMB_thumb_ensure_translations(void);
|
||||
|
|
|
@ -69,7 +69,7 @@ static struct ImBuf *imb_load_dpx_cineon(const unsigned char *mem,
|
|||
return ibuf;
|
||||
}
|
||||
|
||||
static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon, int flags)
|
||||
static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filepath, int use_cineon, int flags)
|
||||
{
|
||||
LogImageFile *logImage;
|
||||
float *fbuf;
|
||||
|
@ -86,7 +86,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
|
|||
|
||||
depth = (ibuf->planes + 7) >> 3;
|
||||
if (depth > 4 || depth < 3) {
|
||||
printf("DPX/Cineon: unsupported depth: %d for file: '%s'\n", depth, filename);
|
||||
printf("DPX/Cineon: unsupported depth: %d for file: '%s'\n", depth, filepath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
|
|||
bitspersample = 8;
|
||||
}
|
||||
|
||||
logImage = logImageCreate(filename,
|
||||
logImage = logImageCreate(filepath,
|
||||
use_cineon,
|
||||
ibuf->x,
|
||||
ibuf->y,
|
||||
|
|
|
@ -35,7 +35,7 @@ void cineonSetVerbose(int verbosity)
|
|||
|
||||
static void fillCineonMainHeader(LogImageFile *cineon,
|
||||
CineonMainHeader *header,
|
||||
const char *filename,
|
||||
const char *filepath,
|
||||
const char *creator)
|
||||
{
|
||||
time_t fileClock;
|
||||
|
@ -57,7 +57,7 @@ static void fillCineonMainHeader(LogImageFile *cineon,
|
|||
getRowLength(cineon->width, cineon->element[0]),
|
||||
cineon->isMSB);
|
||||
strcpy(header->fileHeader.version, "v4.5");
|
||||
strncpy(header->fileHeader.file_name, filename, 99);
|
||||
strncpy(header->fileHeader.file_name, filepath, 99);
|
||||
header->fileHeader.file_name[99] = 0;
|
||||
fileClock = time(NULL);
|
||||
fileTime = localtime(&fileClock);
|
||||
|
@ -126,7 +126,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
|
|||
{
|
||||
CineonMainHeader header;
|
||||
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
||||
const char *filename = (const char *)byteStuff;
|
||||
const char *filepath = (const char *)byteStuff;
|
||||
int i;
|
||||
unsigned int dataOffset;
|
||||
|
||||
|
@ -144,11 +144,11 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
|
|||
cineon->file = NULL;
|
||||
|
||||
if (fromMemory == 0) {
|
||||
/* byteStuff is then the filename */
|
||||
cineon->file = BLI_fopen(filename, "rb");
|
||||
/* byteStuff is then the filepath */
|
||||
cineon->file = BLI_fopen(filepath, "rb");
|
||||
if (cineon->file == NULL) {
|
||||
if (verbose) {
|
||||
printf("Cineon: Failed to open file \"%s\".\n", filename);
|
||||
printf("Cineon: Failed to open file \"%s\".\n", filepath);
|
||||
}
|
||||
logImageClose(cineon);
|
||||
return NULL;
|
||||
|
@ -350,7 +350,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
|
|||
}
|
||||
|
||||
LogImageFile *cineonCreate(
|
||||
const char *filename, int width, int height, int bitsPerSample, const char *creator)
|
||||
const char *filepath, int width, int height, int bitsPerSample, const char *creator)
|
||||
{
|
||||
CineonMainHeader header;
|
||||
const char *shortFilename = NULL;
|
||||
|
@ -393,18 +393,18 @@ LogImageFile *cineonCreate(
|
|||
cineon->referenceBlack = 95.0f;
|
||||
cineon->gamma = 1.7f;
|
||||
|
||||
shortFilename = strrchr(filename, '/');
|
||||
shortFilename = strrchr(filepath, '/');
|
||||
if (shortFilename == NULL) {
|
||||
shortFilename = filename;
|
||||
shortFilename = filepath;
|
||||
}
|
||||
else {
|
||||
shortFilename++;
|
||||
}
|
||||
|
||||
cineon->file = BLI_fopen(filename, "wb");
|
||||
cineon->file = BLI_fopen(filepath, "wb");
|
||||
if (cineon->file == NULL) {
|
||||
if (verbose) {
|
||||
printf("cineon: Couldn't open file %s\n", filename);
|
||||
printf("cineon: Couldn't open file %s\n", filepath);
|
||||
}
|
||||
logImageClose(cineon);
|
||||
return NULL;
|
||||
|
|
|
@ -114,7 +114,7 @@ typedef struct {
|
|||
void cineonSetVerbose(int);
|
||||
LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
|
||||
LogImageFile *cineonCreate(
|
||||
const char *filename, int width, int height, int bitsPerSample, const char *creator);
|
||||
const char *filepath, int width, int height, int bitsPerSample, const char *creator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
|
|||
{
|
||||
DpxMainHeader header;
|
||||
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
|
||||
const char *filename = (const char *)byteStuff;
|
||||
const char *filepath = (const char *)byteStuff;
|
||||
int i;
|
||||
|
||||
if (dpx == NULL) {
|
||||
|
@ -141,11 +141,11 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
|
|||
dpx->file = NULL;
|
||||
|
||||
if (fromMemory == 0) {
|
||||
/* byteStuff is then the filename */
|
||||
dpx->file = BLI_fopen(filename, "rb");
|
||||
/* byteStuff is then the filepath */
|
||||
dpx->file = BLI_fopen(filepath, "rb");
|
||||
if (dpx->file == NULL) {
|
||||
if (verbose) {
|
||||
printf("DPX: Failed to open file \"%s\".\n", filename);
|
||||
printf("DPX: Failed to open file \"%s\".\n", filepath);
|
||||
}
|
||||
logImageClose(dpx);
|
||||
return NULL;
|
||||
|
@ -406,7 +406,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
|
|||
return dpx;
|
||||
}
|
||||
|
||||
LogImageFile *dpxCreate(const char *filename,
|
||||
LogImageFile *dpxCreate(const char *filepath,
|
||||
int width,
|
||||
int height,
|
||||
int bitsPerSample,
|
||||
|
@ -502,19 +502,19 @@ LogImageFile *dpxCreate(const char *filename,
|
|||
dpx->gamma = 1.7f;
|
||||
}
|
||||
|
||||
shortFilename = strrchr(filename, '/');
|
||||
shortFilename = strrchr(filepath, '/');
|
||||
if (shortFilename == NULL) {
|
||||
shortFilename = filename;
|
||||
shortFilename = filepath;
|
||||
}
|
||||
else {
|
||||
shortFilename++;
|
||||
}
|
||||
|
||||
dpx->file = BLI_fopen(filename, "wb");
|
||||
dpx->file = BLI_fopen(filepath, "wb");
|
||||
|
||||
if (dpx->file == NULL) {
|
||||
if (verbose) {
|
||||
printf("DPX: Couldn't open file %s\n", filename);
|
||||
printf("DPX: Couldn't open file %s\n", filepath);
|
||||
}
|
||||
logImageClose(dpx);
|
||||
return NULL;
|
||||
|
|
|
@ -133,7 +133,7 @@ typedef struct {
|
|||
|
||||
void dpxSetVerbose(int verbosity);
|
||||
LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
|
||||
LogImageFile *dpxCreate(const char *filename,
|
||||
LogImageFile *dpxCreate(const char *filepath,
|
||||
int width,
|
||||
int height,
|
||||
int bitsPerSample,
|
||||
|
|
|
@ -101,10 +101,10 @@ int logImageIsCineon(const void *buffer, const unsigned int size)
|
|||
return (magicNum == CINEON_FILE_MAGIC || magicNum == swap_uint(CINEON_FILE_MAGIC, 1));
|
||||
}
|
||||
|
||||
LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
|
||||
LogImageFile *logImageOpenFromFile(const char *filepath, int cineon)
|
||||
{
|
||||
unsigned int magicNum;
|
||||
FILE *f = BLI_fopen(filename, "rb");
|
||||
FILE *f = BLI_fopen(filepath, "rb");
|
||||
|
||||
(void)cineon;
|
||||
|
||||
|
@ -120,10 +120,10 @@ LogImageFile *logImageOpenFromFile(const char *filename, int cineon)
|
|||
fclose(f);
|
||||
|
||||
if (logImageIsDpx(&magicNum, sizeof(magicNum))) {
|
||||
return dpxOpen((const unsigned char *)filename, 0, 0);
|
||||
return dpxOpen((const unsigned char *)filepath, 0, 0);
|
||||
}
|
||||
if (logImageIsCineon(&magicNum, sizeof(magicNum))) {
|
||||
return cineonOpen((const unsigned char *)filename, 0, 0);
|
||||
return cineonOpen((const unsigned char *)filepath, 0, 0);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -141,7 +141,7 @@ LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int s
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LogImageFile *logImageCreate(const char *filename,
|
||||
LogImageFile *logImageCreate(const char *filepath,
|
||||
int cineon,
|
||||
int width,
|
||||
int height,
|
||||
|
@ -155,10 +155,10 @@ LogImageFile *logImageCreate(const char *filename,
|
|||
{
|
||||
/* referenceWhite, referenceBlack and gamma values are only supported for DPX file */
|
||||
if (cineon) {
|
||||
return cineonCreate(filename, width, height, bitsPerSample, creator);
|
||||
return cineonCreate(filepath, width, height, bitsPerSample, creator);
|
||||
}
|
||||
|
||||
return dpxCreate(filename,
|
||||
return dpxCreate(filepath,
|
||||
width,
|
||||
height,
|
||||
bitsPerSample,
|
||||
|
|
|
@ -169,9 +169,9 @@ void logImageSetVerbose(int verbosity);
|
|||
int logImageIsDpx(const void *buffer, unsigned int size);
|
||||
int logImageIsCineon(const void *buffer, unsigned int size);
|
||||
LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int size);
|
||||
LogImageFile *logImageOpenFromFile(const char *filename, int cineon);
|
||||
LogImageFile *logImageOpenFromFile(const char *filepath, int cineon);
|
||||
void logImageGetSize(LogImageFile *logImage, int *width, int *height, int *depth);
|
||||
LogImageFile *logImageCreate(const char *filename,
|
||||
LogImageFile *logImageCreate(const char *filepath,
|
||||
int cineon,
|
||||
int width,
|
||||
int height,
|
||||
|
|
|
@ -376,10 +376,10 @@ int IMB_timecode_to_array_index(IMB_Timecode_Type tc)
|
|||
static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_len)
|
||||
{
|
||||
if (!anim->index_dir[0]) {
|
||||
char fname[FILE_MAXFILE];
|
||||
BLI_split_dirfile(anim->name, index_dir, fname, index_dir_len, sizeof(fname));
|
||||
char filename[FILE_MAXFILE];
|
||||
BLI_split_dirfile(anim->name, index_dir, filename, index_dir_len, sizeof(filename));
|
||||
BLI_path_append(index_dir, index_dir_len, "BL_proxy");
|
||||
BLI_path_append(index_dir, index_dir_len, fname);
|
||||
BLI_path_append(index_dir, index_dir_len, filename);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(index_dir, anim->index_dir, index_dir_len);
|
||||
|
@ -388,14 +388,14 @@ static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_l
|
|||
|
||||
void IMB_anim_get_fname(struct anim *anim, char *file, int size)
|
||||
{
|
||||
char fname[FILE_MAXFILE];
|
||||
BLI_split_dirfile(anim->name, file, fname, size, sizeof(fname));
|
||||
BLI_strncpy(file, fname, size);
|
||||
char filename[FILE_MAXFILE];
|
||||
BLI_split_dirfile(anim->name, file, filename, size, sizeof(filename));
|
||||
BLI_strncpy(file, filename, size);
|
||||
}
|
||||
|
||||
static bool get_proxy_filename(struct anim *anim,
|
||||
static bool get_proxy_filepath(struct anim *anim,
|
||||
IMB_Proxy_Size preview_size,
|
||||
char *fname,
|
||||
char *filepath,
|
||||
bool temp)
|
||||
{
|
||||
char index_dir[FILE_MAXDIR];
|
||||
|
@ -426,11 +426,11 @@ static bool get_proxy_filename(struct anim *anim,
|
|||
return false;
|
||||
}
|
||||
|
||||
BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name);
|
||||
BLI_join_dirfile(filepath, 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 *filepath)
|
||||
{
|
||||
char index_dir[FILE_MAXDIR];
|
||||
int i = IMB_timecode_to_array_index(tc);
|
||||
|
@ -457,7 +457,7 @@ static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname
|
|||
|
||||
get_index_dir(anim, index_dir, sizeof(index_dir));
|
||||
|
||||
BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name);
|
||||
BLI_join_dirfile(filepath, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -492,18 +492,18 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
|
|||
{
|
||||
struct proxy_output_ctx *rv = MEM_callocN(sizeof(struct proxy_output_ctx), "alloc_proxy_output");
|
||||
|
||||
char fname[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
rv->proxy_size = proxy_size;
|
||||
rv->anim = anim;
|
||||
|
||||
get_proxy_filename(rv->anim, rv->proxy_size, fname, true);
|
||||
BLI_make_existing_file(fname);
|
||||
get_proxy_filepath(rv->anim, rv->proxy_size, filepath, true);
|
||||
BLI_make_existing_file(filepath);
|
||||
|
||||
rv->of = avformat_alloc_context();
|
||||
rv->of->oformat = av_guess_format("avi", NULL, NULL);
|
||||
|
||||
rv->of->url = av_strdup(fname);
|
||||
rv->of->url = av_strdup(filepath);
|
||||
|
||||
fprintf(stderr, "Starting work on proxy: %s\n", rv->of->url);
|
||||
|
||||
|
@ -577,7 +577,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
|
|||
|
||||
avcodec_parameters_from_context(rv->st->codecpar, rv->c);
|
||||
|
||||
int ret = avio_open(&rv->of->pb, fname, AVIO_FLAG_WRITE);
|
||||
int ret = avio_open(&rv->of->pb, filepath, AVIO_FLAG_WRITE);
|
||||
|
||||
if (ret < 0) {
|
||||
fprintf(stderr,
|
||||
|
@ -723,8 +723,8 @@ static void add_to_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, AVFrame *fr
|
|||
|
||||
static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, int rollback)
|
||||
{
|
||||
char fname[FILE_MAX];
|
||||
char fname_tmp[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
char filepath_tmp[FILE_MAX];
|
||||
|
||||
if (!ctx) {
|
||||
return;
|
||||
|
@ -755,15 +755,15 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, int rollback)
|
|||
av_free(ctx->frame);
|
||||
}
|
||||
|
||||
get_proxy_filename(ctx->anim, ctx->proxy_size, fname_tmp, true);
|
||||
get_proxy_filepath(ctx->anim, ctx->proxy_size, filepath_tmp, true);
|
||||
|
||||
if (rollback) {
|
||||
unlink(fname_tmp);
|
||||
unlink(filepath_tmp);
|
||||
}
|
||||
else {
|
||||
get_proxy_filename(ctx->anim, ctx->proxy_size, fname, false);
|
||||
unlink(fname);
|
||||
BLI_rename(fname_tmp, fname);
|
||||
get_proxy_filepath(ctx->anim, ctx->proxy_size, filepath, false);
|
||||
unlink(filepath);
|
||||
BLI_rename(filepath_tmp, filepath);
|
||||
}
|
||||
|
||||
MEM_freeN(ctx);
|
||||
|
@ -907,11 +907,11 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim,
|
|||
|
||||
for (i = 0; i < num_indexers; i++) {
|
||||
if (tcs_in_use & tc_types[i]) {
|
||||
char fname[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
get_tc_filename(anim, tc_types[i], fname);
|
||||
get_tc_filename(anim, tc_types[i], filepath);
|
||||
|
||||
context->indexer[i] = IMB_index_builder_create(fname);
|
||||
context->indexer[i] = IMB_index_builder_create(filepath);
|
||||
if (!context->indexer[i]) {
|
||||
tcs_in_use &= ~tc_types[i];
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ typedef struct FallbackIndexBuilderContext {
|
|||
} FallbackIndexBuilderContext;
|
||||
|
||||
static AviMovie *alloc_proxy_output_avi(
|
||||
struct anim *anim, char *filename, int width, int height, int quality)
|
||||
struct anim *anim, char *filepath, int width, int height, int quality)
|
||||
{
|
||||
int x, y;
|
||||
AviFormat format;
|
||||
|
@ -1233,7 +1233,7 @@ static AviMovie *alloc_proxy_output_avi(
|
|||
|
||||
format = AVI_FORMAT_MJPEG;
|
||||
|
||||
if (AVI_open_compress(filename, avi, 1, format) != AVI_ERROR_NONE) {
|
||||
if (AVI_open_compress(filepath, avi, 1, format) != AVI_ERROR_NONE) {
|
||||
MEM_freeN(avi);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1275,13 +1275,13 @@ static IndexBuildContext *index_fallback_create_context(struct anim *anim,
|
|||
|
||||
for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
|
||||
if (context->proxy_sizes_in_use & proxy_sizes[i]) {
|
||||
char fname[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
get_proxy_filename(anim, proxy_sizes[i], fname, true);
|
||||
BLI_make_existing_file(fname);
|
||||
get_proxy_filepath(anim, proxy_sizes[i], filepath, true);
|
||||
BLI_make_existing_file(filepath);
|
||||
|
||||
context->proxy_ctx[i] = alloc_proxy_output_avi(
|
||||
anim, fname, anim->x * proxy_fac[i], anim->y * proxy_fac[i], quality);
|
||||
anim, filepath, anim->x * proxy_fac[i], anim->y * proxy_fac[i], quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1291,8 +1291,8 @@ static IndexBuildContext *index_fallback_create_context(struct anim *anim,
|
|||
static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, int stop)
|
||||
{
|
||||
struct anim *anim = context->anim;
|
||||
char fname[FILE_MAX];
|
||||
char fname_tmp[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
char filepath_tmp[FILE_MAX];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
|
||||
|
@ -1300,15 +1300,15 @@ static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context,
|
|||
AVI_close_compress(context->proxy_ctx[i]);
|
||||
MEM_freeN(context->proxy_ctx[i]);
|
||||
|
||||
get_proxy_filename(anim, proxy_sizes[i], fname_tmp, true);
|
||||
get_proxy_filename(anim, proxy_sizes[i], fname, false);
|
||||
get_proxy_filepath(anim, proxy_sizes[i], filepath_tmp, true);
|
||||
get_proxy_filepath(anim, proxy_sizes[i], filepath, false);
|
||||
|
||||
if (stop) {
|
||||
unlink(fname_tmp);
|
||||
unlink(filepath_tmp);
|
||||
}
|
||||
else {
|
||||
unlink(fname);
|
||||
rename(fname_tmp, fname);
|
||||
unlink(filepath);
|
||||
rename(filepath_tmp, filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1388,7 +1388,7 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
|
|||
IMB_Proxy_Size proxy_size = proxy_sizes[i];
|
||||
if (proxy_size & proxy_sizes_to_build) {
|
||||
char filename[FILE_MAX];
|
||||
if (get_proxy_filename(anim, proxy_size, filename, false) == false) {
|
||||
if (get_proxy_filepath(anim, proxy_size, filename, false) == false) {
|
||||
return NULL;
|
||||
}
|
||||
void **filename_key_p;
|
||||
|
@ -1411,7 +1411,7 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
|
|||
IMB_Proxy_Size proxy_size = proxy_sizes[i];
|
||||
if (proxy_size & built_proxies) {
|
||||
char filename[FILE_MAX];
|
||||
if (get_proxy_filename(anim, proxy_size, filename, false) == false) {
|
||||
if (get_proxy_filepath(anim, proxy_size, filename, false) == false) {
|
||||
return NULL;
|
||||
}
|
||||
printf("Skipping proxy: %s\n", filename);
|
||||
|
@ -1532,7 +1532,7 @@ void IMB_anim_set_index_dir(struct anim *anim, const char *dir)
|
|||
|
||||
struct anim *IMB_anim_open_proxy(struct anim *anim, IMB_Proxy_Size preview_size)
|
||||
{
|
||||
char fname[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
int i = IMB_proxy_size_to_array_index(preview_size);
|
||||
|
||||
if (i < 0) {
|
||||
|
@ -1547,10 +1547,10 @@ struct anim *IMB_anim_open_proxy(struct anim *anim, IMB_Proxy_Size preview_size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
get_proxy_filename(anim, preview_size, fname, false);
|
||||
get_proxy_filepath(anim, preview_size, filepath, false);
|
||||
|
||||
/* proxies are generated in the same color space as animation itself */
|
||||
anim->proxy_anim[i] = IMB_open_anim(fname, 0, 0, anim->colorspace);
|
||||
anim->proxy_anim[i] = IMB_open_anim(filepath, 0, 0, anim->colorspace);
|
||||
|
||||
anim->proxies_tried |= preview_size;
|
||||
|
||||
|
@ -1559,7 +1559,7 @@ struct anim *IMB_anim_open_proxy(struct anim *anim, IMB_Proxy_Size preview_size)
|
|||
|
||||
struct anim_index *IMB_anim_open_index(struct anim *anim, IMB_Timecode_Type tc)
|
||||
{
|
||||
char fname[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
int i = IMB_timecode_to_array_index(tc);
|
||||
|
||||
if (i < 0) {
|
||||
|
@ -1574,9 +1574,9 @@ struct anim_index *IMB_anim_open_index(struct anim *anim, IMB_Timecode_Type tc)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
get_tc_filename(anim, tc, fname);
|
||||
get_tc_filename(anim, tc, filepath);
|
||||
|
||||
anim->curr_idx[i] = IMB_indexer_open(fname);
|
||||
anim->curr_idx[i] = IMB_indexer_open(filepath);
|
||||
|
||||
anim->indices_tried |= tc;
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ IMB_Proxy_Size IMB_anim_proxy_get_existing(struct anim *anim)
|
|||
for (i = 0; i < num_proxy_sizes; i++) {
|
||||
IMB_Proxy_Size proxy_size = proxy_sizes[i];
|
||||
char filename[FILE_MAX];
|
||||
get_proxy_filename(anim, proxy_size, filename, false);
|
||||
get_proxy_filepath(anim, proxy_size, filename, false);
|
||||
if (BLI_exists(filename)) {
|
||||
existing |= proxy_size;
|
||||
}
|
||||
|
|
|
@ -189,21 +189,21 @@ ImBuf *IMB_loadifffile(
|
|||
return ibuf;
|
||||
}
|
||||
|
||||
static void imb_cache_filename(char *filename, const char *name, int flags)
|
||||
static void imb_cache_filename(char *filepath, const char *name, int flags)
|
||||
{
|
||||
/* read .tx instead if it exists and is not older */
|
||||
if (flags & IB_tilecache) {
|
||||
BLI_strncpy(filename, name, IMB_FILENAME_SIZE);
|
||||
if (!BLI_path_extension_replace(filename, IMB_FILENAME_SIZE, ".tx")) {
|
||||
BLI_strncpy(filepath, name, IMB_FILENAME_SIZE);
|
||||
if (!BLI_path_extension_replace(filepath, IMB_FILENAME_SIZE, ".tx")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (BLI_file_older(name, filename)) {
|
||||
if (BLI_file_older(name, filepath)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_strncpy(filename, name, IMB_FILENAME_SIZE);
|
||||
BLI_strncpy(filepath, name, IMB_FILENAME_SIZE);
|
||||
}
|
||||
|
||||
ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
|
||||
|
|
|
@ -466,27 +466,27 @@ static ImBuf *thumb_create_or_fail(const char *file_path,
|
|||
return img;
|
||||
}
|
||||
|
||||
ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, ImBuf *img)
|
||||
ImBuf *IMB_thumb_create(const char *filepath, ThumbSize size, ThumbSource source, ImBuf *img)
|
||||
{
|
||||
char uri[URI_MAX] = "";
|
||||
char thumb_name[40];
|
||||
|
||||
if (!uri_from_filename(path, uri)) {
|
||||
if (!uri_from_filename(filepath, uri)) {
|
||||
return NULL;
|
||||
}
|
||||
thumbname_from_uri(uri, thumb_name, sizeof(thumb_name));
|
||||
|
||||
return thumb_create_ex(
|
||||
path, uri, thumb_name, false, THUMB_DEFAULT_HASH, NULL, NULL, size, source, img);
|
||||
filepath, uri, thumb_name, false, THUMB_DEFAULT_HASH, NULL, NULL, size, source, img);
|
||||
}
|
||||
|
||||
ImBuf *IMB_thumb_read(const char *path, ThumbSize size)
|
||||
ImBuf *IMB_thumb_read(const char *filepath, ThumbSize size)
|
||||
{
|
||||
char thumb[FILE_MAX];
|
||||
char uri[URI_MAX];
|
||||
ImBuf *img = NULL;
|
||||
|
||||
if (!uri_from_filename(path, uri)) {
|
||||
if (!uri_from_filename(filepath, uri)) {
|
||||
return NULL;
|
||||
}
|
||||
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
|
||||
|
@ -496,16 +496,16 @@ ImBuf *IMB_thumb_read(const char *path, ThumbSize size)
|
|||
return img;
|
||||
}
|
||||
|
||||
void IMB_thumb_delete(const char *path, ThumbSize size)
|
||||
void IMB_thumb_delete(const char *filepath, ThumbSize size)
|
||||
{
|
||||
char thumb[FILE_MAX];
|
||||
char uri[URI_MAX];
|
||||
|
||||
if (!uri_from_filename(path, uri)) {
|
||||
if (!uri_from_filename(filepath, uri)) {
|
||||
return;
|
||||
}
|
||||
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
|
||||
if (BLI_path_ncmp(path, thumb, sizeof(thumb)) == 0) {
|
||||
if (BLI_path_ncmp(filepath, thumb, sizeof(thumb)) == 0) {
|
||||
return;
|
||||
}
|
||||
if (BLI_exists(thumb)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ void IMB_thumb_ensure_translations(void)
|
|||
}
|
||||
}
|
||||
|
||||
struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y)
|
||||
struct ImBuf *IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned int y)
|
||||
{
|
||||
const int font_size = y / 4;
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned
|
|||
/* draw with full alpha */
|
||||
font_color[3] = 1.0f;
|
||||
|
||||
BLF_thumb_preview(filename,
|
||||
BLF_thumb_preview(filepath,
|
||||
thumb_str,
|
||||
i18n_thumb_str,
|
||||
ARRAY_SIZE(thumb_str),
|
||||
|
|
|
@ -38,7 +38,7 @@ struct ExportJobData {
|
|||
Depsgraph *depsgraph;
|
||||
wmWindowManager *wm;
|
||||
|
||||
char filename[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
USDExportParams params;
|
||||
|
||||
bool export_ok;
|
||||
|
@ -74,13 +74,13 @@ static void export_startjob(void *customdata,
|
|||
/* For restoring the current frame after exporting animation is done. */
|
||||
const int orig_frame = CFRA;
|
||||
|
||||
pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(data->filename);
|
||||
pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(data->filepath);
|
||||
if (!usd_stage) {
|
||||
/* This happens when the USD JSON files cannot be found. When that happens,
|
||||
* the USD library doesn't know it has the functionality to write USDA and
|
||||
* USDC files, and creating a new UsdStage fails. */
|
||||
WM_reportf(
|
||||
RPT_ERROR, "USD Export: unable to find suitable USD plugin to write %s", data->filename);
|
||||
RPT_ERROR, "USD Export: unable to find suitable USD plugin to write %s", data->filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -145,8 +145,8 @@ static void export_endjob(void *customdata)
|
|||
|
||||
DEG_graph_free(data->depsgraph);
|
||||
|
||||
if (!data->export_ok && BLI_exists(data->filename)) {
|
||||
BLI_delete(data->filename, false, false);
|
||||
if (!data->export_ok && BLI_exists(data->filepath)) {
|
||||
BLI_delete(data->filepath, false, false);
|
||||
}
|
||||
|
||||
G.is_rendering = false;
|
||||
|
@ -171,7 +171,7 @@ bool USD_export(bContext *C,
|
|||
job->bmain = CTX_data_main(C);
|
||||
job->wm = CTX_wm_manager(C);
|
||||
job->export_ok = false;
|
||||
BLI_strncpy(job->filename, filepath, sizeof(job->filename));
|
||||
BLI_strncpy(job->filepath, filepath, sizeof(job->filepath));
|
||||
|
||||
job->depsgraph = DEG_graph_new(job->bmain, scene, view_layer, params->evaluation_mode);
|
||||
job->params = *params;
|
||||
|
|
|
@ -119,7 +119,7 @@ struct ImportJobData {
|
|||
ViewLayer *view_layer;
|
||||
wmWindowManager *wm;
|
||||
|
||||
char filename[1024];
|
||||
char filepath[1024];
|
||||
USDImportParams params;
|
||||
ImportSettings settings;
|
||||
|
||||
|
@ -150,7 +150,7 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
if (data->params.create_collection) {
|
||||
char display_name[1024];
|
||||
BLI_path_to_display_name(
|
||||
display_name, strlen(data->filename), BLI_path_basename(data->filename));
|
||||
display_name, strlen(data->filepath), BLI_path_basename(data->filepath));
|
||||
Collection *import_collection = BKE_collection_add(
|
||||
data->bmain, data->scene->master_collection, display_name);
|
||||
id_fake_user_set(&import_collection->id);
|
||||
|
@ -164,10 +164,10 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
data->view_layer, import_collection);
|
||||
}
|
||||
|
||||
BLI_path_abs(data->filename, BKE_main_blendfile_path_from_global());
|
||||
BLI_path_abs(data->filepath, BKE_main_blendfile_path_from_global());
|
||||
|
||||
CacheFile *cache_file = static_cast<CacheFile *>(
|
||||
BKE_cachefile_add(data->bmain, BLI_path_basename(data->filename)));
|
||||
BKE_cachefile_add(data->bmain, BLI_path_basename(data->filepath)));
|
||||
|
||||
/* Decrement the ID ref-count because it is going to be incremented for each
|
||||
* modifier and constraint that it will be attached to, so since currently
|
||||
|
@ -176,7 +176,7 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
|
||||
cache_file->is_sequence = data->params.is_sequence;
|
||||
cache_file->scale = data->params.scale;
|
||||
STRNCPY(cache_file->filepath, data->filename);
|
||||
STRNCPY(cache_file->filepath, data->filepath);
|
||||
|
||||
data->settings.cache_file = cache_file;
|
||||
|
||||
|
@ -191,10 +191,10 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
*data->do_update = true;
|
||||
*data->progress = 0.1f;
|
||||
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(data->filename);
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(data->filepath);
|
||||
|
||||
if (!stage) {
|
||||
WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", data->filename);
|
||||
WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", data->filepath);
|
||||
data->import_ok = false;
|
||||
return;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ bool USD_import(struct bContext *C,
|
|||
job->view_layer = CTX_data_view_layer(C);
|
||||
job->wm = CTX_wm_manager(C);
|
||||
job->import_ok = false;
|
||||
BLI_strncpy(job->filename, filepath, 1024);
|
||||
BLI_strncpy(job->filepath, filepath, 1024);
|
||||
|
||||
job->settings.scale = params->scale;
|
||||
job->settings.sequence_offset = params->offset;
|
||||
|
@ -499,13 +499,13 @@ void USD_CacheReader_free(CacheReader *reader)
|
|||
}
|
||||
|
||||
CacheArchiveHandle *USD_create_handle(struct Main * /*bmain*/,
|
||||
const char *filename,
|
||||
const char *filepath,
|
||||
ListBase *object_paths)
|
||||
{
|
||||
/* Must call this so that USD file format plugins are loaded. */
|
||||
ensure_usd_plugin_path_registered();
|
||||
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(filename);
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(filepath);
|
||||
|
||||
if (!stage) {
|
||||
return nullptr;
|
||||
|
|
|
@ -83,7 +83,7 @@ int USD_get_version(void);
|
|||
/* USD Import and Mesh Cache interface. */
|
||||
|
||||
struct CacheArchiveHandle *USD_create_handle(struct Main *bmain,
|
||||
const char *filename,
|
||||
const char *filepath,
|
||||
struct ListBase *object_paths);
|
||||
|
||||
void USD_free_handle(struct CacheArchiveHandle *handle);
|
||||
|
|
|
@ -235,7 +235,7 @@ static int preprocess_include(char *maindata, const int maindata_len);
|
|||
/**
|
||||
* Scan this file for serializable types.
|
||||
*/
|
||||
static int convert_include(const char *filename);
|
||||
static int convert_include(const char *filepath);
|
||||
|
||||
/**
|
||||
* Determine how many bytes are needed for each struct.
|
||||
|
@ -670,12 +670,12 @@ static int preprocess_include(char *maindata, const int maindata_len)
|
|||
return newlen;
|
||||
}
|
||||
|
||||
static void *read_file_data(const char *filename, int *r_len)
|
||||
static void *read_file_data(const char *filepath, int *r_len)
|
||||
{
|
||||
#ifdef WIN32
|
||||
FILE *fp = fopen(filename, "rb");
|
||||
FILE *fp = fopen(filepath, "rb");
|
||||
#else
|
||||
FILE *fp = fopen(filename, "r");
|
||||
FILE *fp = fopen(filepath, "r");
|
||||
#endif
|
||||
void *data;
|
||||
|
||||
|
@ -711,17 +711,17 @@ static void *read_file_data(const char *filename, int *r_len)
|
|||
return data;
|
||||
}
|
||||
|
||||
static int convert_include(const char *filename)
|
||||
static int convert_include(const char *filepath)
|
||||
{
|
||||
/* read include file, skip structs with a '#' before it.
|
||||
* store all data in temporal arrays.
|
||||
*/
|
||||
|
||||
int maindata_len;
|
||||
char *maindata = read_file_data(filename, &maindata_len);
|
||||
char *maindata = read_file_data(filepath, &maindata_len);
|
||||
char *md = maindata;
|
||||
if (maindata_len == -1) {
|
||||
fprintf(stderr, "Can't read file %s\n", filename);
|
||||
fprintf(stderr, "Can't read file %s\n", filepath);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,7 @@ static int convert_include(const char *filename)
|
|||
|
||||
const int strct = add_type(md1, 0);
|
||||
if (strct == -1) {
|
||||
fprintf(stderr, "File '%s' contains struct we can't parse \"%s\"\n", filename, md1);
|
||||
fprintf(stderr, "File '%s' contains struct we can't parse \"%s\"\n", filepath, md1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ static int convert_include(const char *filename)
|
|||
fprintf(stderr,
|
||||
"File '%s' contains non white space character "
|
||||
"\"%c\" after identifier \"%s\"\n",
|
||||
filename,
|
||||
filepath,
|
||||
*md1,
|
||||
md1_prev);
|
||||
return 1;
|
||||
|
@ -812,7 +812,7 @@ static int convert_include(const char *filename)
|
|||
const int type = add_type(md1, 0);
|
||||
if (type == -1) {
|
||||
fprintf(
|
||||
stderr, "File '%s' contains struct we can't parse \"%s\"\n", filename, md1);
|
||||
stderr, "File '%s' contains struct we can't parse \"%s\"\n", filepath, md1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ static int convert_include(const char *filename)
|
|||
if (name == -1) {
|
||||
fprintf(stderr,
|
||||
"File '%s' contains struct with name that can't be added \"%s\"\n",
|
||||
filename,
|
||||
filepath,
|
||||
md1);
|
||||
return 1;
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ static int convert_include(const char *filename)
|
|||
if (name == -1) {
|
||||
fprintf(stderr,
|
||||
"File '%s' contains struct with name that can't be added \"%s\"\n",
|
||||
filename,
|
||||
filepath,
|
||||
md1);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -579,9 +579,9 @@ void BPY_python_backtrace(FILE *fp)
|
|||
PyFrameObject *frame = tstate->frame;
|
||||
do {
|
||||
const int line = PyCode_Addr2Line(frame->f_code, frame->f_lasti);
|
||||
const char *filename = PyUnicode_AsUTF8(frame->f_code->co_filename);
|
||||
const char *filepath = PyUnicode_AsUTF8(frame->f_code->co_filename);
|
||||
const char *funcname = PyUnicode_AsUTF8(frame->f_code->co_name);
|
||||
fprintf(fp, " File \"%s\", line %d in %s\n", filename, line, funcname);
|
||||
fprintf(fp, " File \"%s\", line %d in %s\n", filepath, line, funcname);
|
||||
} while ((frame = frame->f_back));
|
||||
}
|
||||
}
|
||||
|
@ -770,16 +770,16 @@ static void bpy_module_delay_init(PyObject *bpy_proxy)
|
|||
const char *argv[2];
|
||||
|
||||
/* updating the module dict below will lose the reference to __file__ */
|
||||
PyObject *filename_obj = PyModule_GetFilenameObject(bpy_proxy);
|
||||
PyObject *filepath_obj = PyModule_GetFilenameObject(bpy_proxy);
|
||||
|
||||
const char *filename_rel = PyUnicode_AsUTF8(filename_obj); /* can be relative */
|
||||
char filename_abs[1024];
|
||||
const char *filepath_rel = PyUnicode_AsUTF8(filepath_obj); /* can be relative */
|
||||
char filepath_abs[1024];
|
||||
|
||||
BLI_strncpy(filename_abs, filename_rel, sizeof(filename_abs));
|
||||
BLI_path_abs_from_cwd(filename_abs, sizeof(filename_abs));
|
||||
Py_DECREF(filename_obj);
|
||||
BLI_strncpy(filepath_abs, filepath_rel, sizeof(filepath_abs));
|
||||
BLI_path_abs_from_cwd(filepath_abs, sizeof(filepath_abs));
|
||||
Py_DECREF(filepath_obj);
|
||||
|
||||
argv[0] = filename_abs;
|
||||
argv[0] = filepath_abs;
|
||||
argv[1] = NULL;
|
||||
|
||||
// printf("module found %s\n", argv[0]);
|
||||
|
@ -810,16 +810,16 @@ PyMODINIT_FUNC PyInit_bpy(void)
|
|||
PyObject *bpy_proxy = PyModule_Create(&bpy_proxy_def);
|
||||
|
||||
/* Problem:
|
||||
* 1) this init function is expected to have a private member defined - 'md_def'
|
||||
* 1) this init function is expected to have a private member defined - `md_def`
|
||||
* but this is only set for C defined modules (not py packages)
|
||||
* so we can't return 'bpy_package_py' as is.
|
||||
*
|
||||
* 2) there is a 'bpy' C module for python to load which is basically all of blender,
|
||||
* and there is scripts/bpy/__init__.py,
|
||||
* and there is `scripts/bpy/__init__.py`,
|
||||
* we may end up having to rename this module so there is no naming conflict here eg:
|
||||
* 'from blender import bpy'
|
||||
*
|
||||
* 3) we don't know the filename at this point, workaround by assigning a dummy value
|
||||
* 3) we don't know the filepath at this point, workaround by assigning a dummy value
|
||||
* which calls back when its freed so the real loading can take place.
|
||||
*/
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
|
|||
Main *bmain_base = CTX_data_main(BPY_context_get());
|
||||
Main *bmain = self->ptr.data; /* Typically #G_MAIN */
|
||||
BPy_Library *ret;
|
||||
const char *filename = NULL;
|
||||
const char *filepath = NULL;
|
||||
bool is_rel = false, is_link = false, use_assets_only = false;
|
||||
|
||||
static const char *_keywords[] = {"filepath", "link", "relative", "assets_only", NULL};
|
||||
|
@ -200,7 +200,7 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
|
|||
if (!_PyArg_ParseTupleAndKeywordsFast(args,
|
||||
kw,
|
||||
&_parser,
|
||||
&filename,
|
||||
&filepath,
|
||||
PyC_ParseBool,
|
||||
&is_link,
|
||||
PyC_ParseBool,
|
||||
|
@ -212,8 +212,8 @@ static PyObject *bpy_lib_load(BPy_PropertyRNA *self, PyObject *args, PyObject *k
|
|||
|
||||
ret = PyObject_New(BPy_Library, &bpy_lib_Type);
|
||||
|
||||
BLI_strncpy(ret->relpath, filename, sizeof(ret->relpath));
|
||||
BLI_strncpy(ret->abspath, filename, sizeof(ret->abspath));
|
||||
BLI_strncpy(ret->relpath, filepath, sizeof(ret->relpath));
|
||||
BLI_strncpy(ret->abspath, filepath, sizeof(ret->abspath));
|
||||
BLI_path_abs(ret->abspath, BKE_main_blendfile_path(bmain));
|
||||
|
||||
ret->bmain = bmain;
|
||||
|
|
|
@ -344,15 +344,15 @@ static void seq_disk_cache_create_version_file(char *path)
|
|||
|
||||
static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache)
|
||||
{
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
char path_version_file[FILE_MAX];
|
||||
int version = 0;
|
||||
|
||||
seq_disk_cache_get_project_dir(disk_cache, path, sizeof(path));
|
||||
BLI_strncpy(path_version_file, path, sizeof(path_version_file));
|
||||
seq_disk_cache_get_project_dir(disk_cache, filepath, sizeof(filepath));
|
||||
BLI_strncpy(path_version_file, filepath, sizeof(path_version_file));
|
||||
BLI_path_append(path_version_file, sizeof(path_version_file), "cache_version");
|
||||
|
||||
if (BLI_exists(path) && BLI_is_dir(path)) {
|
||||
if (BLI_exists(filepath) && BLI_is_dir(filepath)) {
|
||||
FILE *file = BLI_fopen(path_version_file, "r");
|
||||
|
||||
if (file) {
|
||||
|
@ -364,7 +364,7 @@ static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache)
|
|||
}
|
||||
|
||||
if (version != DCACHE_CURRENT_VERSION) {
|
||||
BLI_delete(path, false, true);
|
||||
BLI_delete(filepath, false, true);
|
||||
seq_disk_cache_create_version_file(path_version_file);
|
||||
}
|
||||
}
|
||||
|
@ -548,22 +548,22 @@ bool seq_disk_cache_write_file(SeqDiskCache *disk_cache, SeqCacheKey *key, ImBuf
|
|||
{
|
||||
BLI_mutex_lock(&disk_cache->read_write_mutex);
|
||||
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
seq_disk_cache_get_file_path(disk_cache, key, path, sizeof(path));
|
||||
BLI_make_existing_file(path);
|
||||
seq_disk_cache_get_file_path(disk_cache, key, filepath, sizeof(filepath));
|
||||
BLI_make_existing_file(filepath);
|
||||
|
||||
FILE *file = BLI_fopen(path, "rb+");
|
||||
FILE *file = BLI_fopen(filepath, "rb+");
|
||||
if (!file) {
|
||||
file = BLI_fopen(path, "wb+");
|
||||
file = BLI_fopen(filepath, "wb+");
|
||||
if (!file) {
|
||||
BLI_mutex_unlock(&disk_cache->read_write_mutex);
|
||||
return false;
|
||||
}
|
||||
seq_disk_cache_add_file_to_list(disk_cache, path);
|
||||
seq_disk_cache_add_file_to_list(disk_cache, filepath);
|
||||
}
|
||||
|
||||
DiskCacheFile *cache_file = seq_disk_cache_get_file_entry_by_path(disk_cache, path);
|
||||
DiskCacheFile *cache_file = seq_disk_cache_get_file_entry_by_path(disk_cache, filepath);
|
||||
DiskCacheHeader header;
|
||||
memset(&header, 0, sizeof(header));
|
||||
/* #BLI_make_existing_file() above may create an empty file. This is fine, don't attempt reading
|
||||
|
@ -585,7 +585,7 @@ bool seq_disk_cache_write_file(SeqDiskCache *disk_cache, SeqCacheKey *key, ImBuf
|
|||
*/
|
||||
header.entry[entry_index].size_compressed = bytes_written;
|
||||
seq_disk_cache_write_header(file, &header);
|
||||
seq_disk_cache_update_file(disk_cache, path);
|
||||
seq_disk_cache_update_file(disk_cache, filepath);
|
||||
fclose(file);
|
||||
|
||||
BLI_mutex_unlock(&disk_cache->read_write_mutex);
|
||||
|
@ -600,13 +600,13 @@ ImBuf *seq_disk_cache_read_file(SeqDiskCache *disk_cache, SeqCacheKey *key)
|
|||
{
|
||||
BLI_mutex_lock(&disk_cache->read_write_mutex);
|
||||
|
||||
char path[FILE_MAX];
|
||||
char filepath[FILE_MAX];
|
||||
DiskCacheHeader header;
|
||||
|
||||
seq_disk_cache_get_file_path(disk_cache, key, path, sizeof(path));
|
||||
BLI_make_existing_file(path);
|
||||
seq_disk_cache_get_file_path(disk_cache, key, filepath, sizeof(filepath));
|
||||
BLI_make_existing_file(filepath);
|
||||
|
||||
FILE *file = BLI_fopen(path, "rb");
|
||||
FILE *file = BLI_fopen(filepath, "rb");
|
||||
if (!file) {
|
||||
BLI_mutex_unlock(&disk_cache->read_write_mutex);
|
||||
return NULL;
|
||||
|
@ -656,8 +656,8 @@ ImBuf *seq_disk_cache_read_file(SeqDiskCache *disk_cache, SeqCacheKey *key)
|
|||
BLI_mutex_unlock(&disk_cache->read_write_mutex);
|
||||
return NULL;
|
||||
}
|
||||
BLI_file_touch(path);
|
||||
seq_disk_cache_update_file(disk_cache, path);
|
||||
BLI_file_touch(filepath);
|
||||
seq_disk_cache_update_file(disk_cache, filepath);
|
||||
fclose(file);
|
||||
|
||||
BLI_mutex_unlock(&disk_cache->read_write_mutex);
|
||||
|
|
Loading…
Reference in New Issue