Cleanup: avoid copy & unnecessary allocation creating temporary path
This commit is contained in:
@@ -364,17 +364,18 @@ static void export_endjob(void *customdata)
|
|||||||
static void create_temp_path_for_usdz_export(const char *filepath,
|
static void create_temp_path_for_usdz_export(const char *filepath,
|
||||||
blender::io::usd::ExportJobData *job)
|
blender::io::usd::ExportJobData *job)
|
||||||
{
|
{
|
||||||
char file[FILE_MAX];
|
char usdc_file[FILE_MAX];
|
||||||
BLI_path_split_file_part(filepath, file, FILE_MAX);
|
STRNCPY(usdc_file, BLI_path_basename(filepath));
|
||||||
char *usdc_file = BLI_str_replaceN(file, ".usdz", ".usdc");
|
|
||||||
|
if (BLI_path_extension_check(usdc_file, ".usdz")) {
|
||||||
|
BLI_path_extension_replace(usdc_file, sizeof(usdc_file), ".usdc");
|
||||||
|
}
|
||||||
|
|
||||||
char usdc_temp_filepath[FILE_MAX];
|
char usdc_temp_filepath[FILE_MAX];
|
||||||
BLI_path_join(usdc_temp_filepath, FILE_MAX, BKE_tempdir_session(), "USDZ", usdc_file);
|
BLI_path_join(usdc_temp_filepath, FILE_MAX, BKE_tempdir_session(), "USDZ", usdc_file);
|
||||||
|
|
||||||
STRNCPY(job->unarchived_filepath, usdc_temp_filepath);
|
STRNCPY(job->unarchived_filepath, usdc_temp_filepath);
|
||||||
STRNCPY(job->usdz_filepath, filepath);
|
STRNCPY(job->usdz_filepath, filepath);
|
||||||
|
|
||||||
MEM_freeN(usdc_file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_job_filepath(blender::io::usd::ExportJobData *job, const char *filepath)
|
static void set_job_filepath(blender::io::usd::ExportJobData *job, const char *filepath)
|
||||||
|
|||||||
Reference in New Issue
Block a user