forked from blender/blender
Fix review comments #51
@ -21,16 +21,15 @@ static std::string cache_image_file(Image *image,
|
|||||||
ImageUser *iuser,
|
ImageUser *iuser,
|
||||||
bool check_exist)
|
bool check_exist)
|
||||||
{
|
{
|
||||||
std::string file_path(FILE_MAX, 0);
|
char file_path[FILE_MAX];
|
||||||
char file_name[32];
|
char file_name[32];
|
||||||
snprintf(file_name, 32, "img_%016llx.hdr", (uintptr_t)image);
|
snprintf(file_name, sizeof(file_name), "img_%016llx.hdr", (uintptr_t)image);
|
||||||
DagerD marked this conversation as resolved
|
|||||||
BLI_path_join(file_path.data(),
|
BLI_path_join(file_path, sizeof(file_path),
|
||||||
file_path.capacity(),
|
|
||||||
BKE_tempdir_session(),
|
BKE_tempdir_session(),
|
||||||
"hydra_image_cache",
|
"hydra_image_cache",
|
||||||
file_name);
|
file_name);
|
||||||
|
|
||||||
if (check_exist && BLI_exists(file_path.c_str())) {
|
if (check_exist && BLI_exists(file_path)) {
|
||||||
return file_path;
|
return file_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,16 +37,16 @@ static std::string cache_image_file(Image *image,
|
|||||||
ImageSaveOptions opts;
|
ImageSaveOptions opts;
|
||||||
opts.im_format.imtype = R_IMF_IMTYPE_RADHDR;
|
opts.im_format.imtype = R_IMF_IMTYPE_RADHDR;
|
||||||
|
|
||||||
if (BKE_image_save_options_init(&opts, main, scene_delegate->scene, image, iuser, true, false)) {
|
if (BKE_image_save_options_init(&opts, main, scene_delegate->scene, image, iuser, false, false))
|
||||||
STRNCPY(opts.filepath, file_path.c_str());
|
{
|
||||||
ReportList reports;
|
STRNCPY(opts.filepath, file_path);
|
||||||
if (!BKE_image_save(&reports, main, image, iuser, &opts)) {
|
if (!BKE_image_save(nullptr, main, image, iuser, &opts)) {
|
||||||
file_path = "";
|
memset(file_path, 0, sizeof(file_path));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
BKE_image_save_options_free(&opts);
|
BKE_image_save_options_free(&opts);
|
||||||
|
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s -> %s", image->id.name, file_path.c_str());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 2, "%s -> %s", image->id.name, file_path);
|
||||||
return file_path;
|
return file_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ bool InstancerData::update_visibility()
|
|||||||
char name[16];
|
char name[16];
|
||||||
for (auto &l_inst : light_instances_.values()) {
|
for (auto &l_inst : light_instances_.values()) {
|
||||||
for (int i = 0; i < l_inst.count; ++i) {
|
for (int i = 0; i < l_inst.count; ++i) {
|
||||||
snprintf(name, 16, "L_%08x", i);
|
snprintf(name, sizeof(name), "L_%08x", i);
|
||||||
change_tracker.MarkRprimDirty(l_inst.data->prim_id.AppendElementString(name),
|
change_tracker.MarkRprimDirty(l_inst.data->prim_id.AppendElementString(name),
|
||||||
pxr::HdChangeTracker::DirtyVisibility);
|
pxr::HdChangeTracker::DirtyVisibility);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
add same
sizeof(...)
to other places withsnprintf()