Fix Cycles crash after recent bugfix for image saving

This commit is contained in:
Brecht Van Lommel 2022-08-08 16:58:34 +02:00
parent b72eddac61
commit 2e6fcd9aad
2 changed files with 9 additions and 5 deletions

View File

@ -794,7 +794,7 @@ static ShaderNode *add_node(Scene *scene,
}
else {
ustring filename = ustring(
image_user_file_path(b_image_user, b_image, b_scene.frame_current()));
image_user_file_path(b_data, b_image_user, b_image, b_scene.frame_current()));
image->set_filename(filename);
}
}
@ -831,7 +831,7 @@ static ShaderNode *add_node(Scene *scene,
}
else {
env->set_filename(
ustring(image_user_file_path(b_image_user, b_image, b_scene.frame_current())));
ustring(image_user_file_path(b_data, b_image_user, b_image, b_scene.frame_current())));
}
}
node = env;

View File

@ -21,7 +21,8 @@
extern "C" {
void BKE_image_user_frame_calc(void *ima, void *iuser, int cfra);
void BKE_image_user_file_path_ex(void *iuser, void *ima, char *path, bool resolve_udim);
void BKE_image_user_file_path_ex(
void *bmain, void *iuser, void *ima, char *path, bool resolve_udim, bool resolve_multiview);
unsigned char *BKE_image_get_pixels_for_frame(void *image, int frame, int tile);
float *BKE_image_get_float_pixels_for_frame(void *image, int frame, int tile);
}
@ -281,12 +282,15 @@ static inline int render_resolution_y(BL::RenderSettings &b_render)
return b_render.resolution_y() * b_render.resolution_percentage() / 100;
}
static inline string image_user_file_path(BL::ImageUser &iuser, BL::Image &ima, int cfra)
static inline string image_user_file_path(BL::BlendData &data,
BL::ImageUser &iuser,
BL::Image &ima,
int cfra)
{
char filepath[1024];
iuser.tile(0);
BKE_image_user_frame_calc(ima.ptr.data, iuser.ptr.data, cfra);
BKE_image_user_file_path_ex(iuser.ptr.data, ima.ptr.data, filepath, false);
BKE_image_user_file_path_ex(data.ptr.data, iuser.ptr.data, ima.ptr.data, filepath, false, true);
return string(filepath);
}