Fix review comments #27

Merged
Bogdan Nagirniak merged 14 commits from BLEN-392 into hydra-render 2023-04-21 15:02:44 +02:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 51473dd21b - Show all commits

View File

@ -109,7 +109,7 @@ def export_mtlx(material):
if not doc: if not doc:
return "" return ""
mtlx_file = mx_utils.get_temp_file(".mtlx", str(material.as_pointer())) mtlx_file = mx_utils.get_temp_file(".mtlx", f"mat_{material.as_pointer():016x}")

Use hex format for mtlx name like:
f"mat_{material.as_pointer():016x}"

Use hex format for mtlx name like: `f"mat_{material.as_pointer():016x}"`
mx_utils.export_to_file(doc, mtlx_file, export_deps=True, copy_deps=False) mx_utils.export_to_file(doc, mtlx_file, export_deps=True, copy_deps=False)
return str(mtlx_file) return str(mtlx_file)

View File

@ -34,8 +34,7 @@ std::string cache_image(Main *bmain,
ImageSaveOptions *opts, ImageSaveOptions *opts,
ReportList *reports) ReportList *reports)
{ {
const std::string default_format = ".png"; const char *default_format = ".png";
char tempfile[FILE_MAX]; char tempfile[FILE_MAX];
if (!BKE_image_save_options_init(opts, bmain, scene, image, iuser, true, false)) { if (!BKE_image_save_options_init(opts, bmain, scene, image, iuser, true, false)) {
@ -43,12 +42,13 @@ std::string cache_image(Main *bmain,
return ""; return "";
} }
std::string image_name(std::to_string((uintptr_t)image)); char image_name[32];
snprintf(image_name, 32, "img_%016llx", (uint64_t)image);

Use hex format for image name like:

char str[32];
snprintf(str, 32, "img_%016llx", (uint64_t)image);
Use hex format for image name like: ``` char str[32]; snprintf(str, 32, "img_%016llx", (uint64_t)image); ```
image_name.append(default_format); strcat(image_name, default_format);
BLI_path_join( BLI_path_join(
tempfile, sizeof(tempfile), BKE_tempdir_session(), "hydra_image_cache", image_name.c_str()); tempfile, sizeof(tempfile), BKE_tempdir_session(), "hydra_image_cache", image_name);
STRNCPY(opts->filepath, tempfile); STRNCPY(opts->filepath, tempfile);
if (!BKE_image_save(reports, bmain, image, iuser, opts)) { if (!BKE_image_save(reports, bmain, image, iuser, opts)) {