Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-04-12 14:02:05 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-04-12 14:26:21 +0300
commit19539c50c9481bd3b9436f8e1c5c753ae7d4ccee (patch)
tree05113dca8d14acb3f0db35a19ade8ac0c15be969 /intern/cycles/blender/blender_session.cpp
parentf636b8bfc09cf740d481dbd8c8d2aa1c75f5ea04 (diff)
Cycles: Avoid crash when accessing non-existing volume attribute
Diffstat (limited to 'intern/cycles/blender/blender_session.cpp')
-rw-r--r--intern/cycles/blender/blender_session.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 3e7fba01137..aac2ffb7474 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -1077,8 +1077,8 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
{
/* empty image */
is_float = false;
- width = 0;
- height = 0;
+ width = 1;
+ height = 1;
depth = 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::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob);
+ is_float = true;
+ depth = 1;
+ channels = 1;
+
if(!b_domain)
return;
@@ -1122,8 +1126,6 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
width = resolution.x * amplify;
height = resolution.y * amplify;
depth = resolution.z * amplify;
-
- is_float = true;
}
else {
/* 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;
}
}
+ 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");
}