forked from blender/blender
Implement Viewport render with material preview #56
@ -67,19 +67,21 @@ static std::string cache_image_file(Image *image,
|
||||
|
||||
std::string cache_or_get_image_file(Image *image, bContext *context, ImageUser *iuser)
|
||||
{
|
||||
char file_path[FILE_MAX];
|
||||
std::string file_path;
|
||||
if (image->source == IMA_SRC_GENERATED) {
|
||||
strcpy(file_path, cache_image_file(image, context, iuser, false).c_str());
|
||||
file_path = cache_image_file(image, context, iuser, false);
|
||||
}
|
||||
else if (BKE_image_has_packedfile(image)) {
|
||||
strcpy(file_path, cache_image_file(image, context, iuser, true).c_str());
|
||||
file_path = cache_image_file(image, context, iuser, true);
|
||||
}
|
||||
else {
|
||||
char str[FILE_MAX];
|
||||
Main *main = CTX_data_main(context);
|
||||
BKE_image_user_file_path_ex(main, iuser, image, file_path, false, true);
|
||||
BKE_image_user_file_path_ex(main, iuser, image, str, false, true);
|
||||
file_path = str;
|
||||
|
||||
if (!pxr::HioImageRegistry::GetInstance().IsSupportedImageFile(file_path)) {
|
||||
strcpy(file_path, cache_image_file(image, context, iuser, true).c_str());
|
||||
file_path = cache_image_file(image, context, iuser, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user