Cycles: Avoid crash when accessing non-existing volume attribute
This commit is contained in:
@@ -1077,8 +1077,8 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
|
|||||||
{
|
{
|
||||||
/* empty image */
|
/* empty image */
|
||||||
is_float = false;
|
is_float = false;
|
||||||
width = 0;
|
width = 1;
|
||||||
height = 0;
|
height = 1;
|
||||||
depth = 0;
|
depth = 0;
|
||||||
channels = 0;
|
channels = 0;
|
||||||
|
|
||||||
@@ -1105,6 +1105,10 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
|
|||||||
BL::Object b_ob(b_id);
|
BL::Object b_ob(b_id);
|
||||||
BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob);
|
BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob);
|
||||||
|
|
||||||
|
is_float = true;
|
||||||
|
depth = 1;
|
||||||
|
channels = 1;
|
||||||
|
|
||||||
if(!b_domain)
|
if(!b_domain)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1122,8 +1126,6 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
|
|||||||
width = resolution.x * amplify;
|
width = resolution.x * amplify;
|
||||||
height = resolution.y * amplify;
|
height = resolution.y * amplify;
|
||||||
depth = resolution.z * amplify;
|
depth = resolution.z * amplify;
|
||||||
|
|
||||||
is_float = true;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO(sergey): Check we're indeed in shader node tree. */
|
/* TODO(sergey): Check we're indeed in shader node tree. */
|
||||||
@@ -1276,6 +1278,11 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "Cycles error: unknown volume attribute, skipping\n");
|
||||||
|
pixels[0] = 0.0f;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
|
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user