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:25:20 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-04-12 14:26:21 +0300
commit951fad2baa592b4dc5201d8630517e6a92a510d2 (patch)
treeea1f0338a63ae84156f97ccae151e65ce7d6f7f2 /intern/cycles
parent19539c50c9481bd3b9436f8e1c5c753ae7d4ccee (diff)
Cycles: Add missing velocity attribute to builtin image loader
For some reason other parts of blender importer were assuming velocity is supported, but actual loader was not aware of that. Fixes T48064: Adding velocity attribute crashes render
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/blender/blender_session.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index aac2ffb7474..7dfe94127e9 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -1117,6 +1117,8 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
channels = 1;
else if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_COLOR))
channels = 4;
+ else if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY))
+ channels = 3;
else
return;
@@ -1246,6 +1248,11 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
int3 resolution = get_int3(b_domain.domain_resolution());
int length, amplify = (b_domain.use_high_resolution())? b_domain.amplify() + 1: 1;
+ /* Velocity data is always low-resolution. */
+ if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY)) {
+ amplify = 1;
+ }
+
int width = resolution.x * amplify;
int height = resolution.y * amplify;
int depth = resolution.z * amplify;
@@ -1278,6 +1285,14 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
return true;
}
}
+ else if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY)) {
+ SmokeDomainSettings_velocity_grid_get_length(&b_domain.ptr, &length);
+
+ if(length == num_pixels*3) {
+ SmokeDomainSettings_velocity_grid_get(&b_domain.ptr, pixels);
+ return true;
+ }
+ }
else {
fprintf(stderr, "Cycles error: unknown volume attribute, skipping\n");
pixels[0] = 0.0f;