diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-11-17 15:30:11 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-11-17 15:30:11 +0300 |
commit | 4877e0efc978f01a4062379474763bf669705498 (patch) | |
tree | 187df8ccbb78332efe918509f82738a75ab6ce68 | |
parent | 9b598ebc4701b53fc990409989f4bb4580b5838f (diff) |
Move registration of volumes from attributes out of the smoke sim logic.
This bit of code will be the same for every potential source of volumetric
data.
-rw-r--r-- | intern/cycles/blender/blender_volume.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp index e68f2efc6d7..2e5beff138d 100644 --- a/intern/cycles/blender/blender_volume.cpp +++ b/intern/cycles/blender/blender_volume.cpp @@ -60,29 +60,20 @@ static Attribute *create_openvdb_attribute(Volume *volume, static Attribute *create_smoke_attribute(BL::Object& b_ob, Volume *volume, - VolumeManager *volume_manager, const ustring& name, - float /*frame*/) + float /*frame*/, + string *filename) { - Attribute *attr = NULL; - BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob); if(b_domain) { - char filename[1024]; - SmokeDomainSettings_cache_filename_get(&b_domain.ptr, filename); + char filename_buf[1024]; + SmokeDomainSettings_cache_filename_get(&b_domain.ptr, filename_buf); + *filename = string(filename_buf); - attr = create_openvdb_attribute(volume, filename, name); - if (attr) { - VoxelAttribute *volume_data = attr->data_voxel(); - assert(volume_data && "Failed to create volume data!\n"); - - // TODO(kevin): add volume fields to the Volume* - //volume_data->manager = volume_manager; - volume_data->slot = volume_manager->add_volume(volume, filename, name.string()); - } + return create_openvdb_attribute(volume, *filename, name); } - return attr; + return NULL; } static bool is_volume_attribute(AttributeStandard std) { @@ -109,7 +100,17 @@ static void create_volume_attributes(Scene *scene, } if (!name.empty()) { - /*Attribute *attr =*/ create_smoke_attribute(b_ob, volume, scene->volume_manager, name, frame); + string filename; + Attribute *attr = create_smoke_attribute(b_ob, volume, name, frame, &filename); + + if (attr) { + VoxelAttribute *volume_data = attr->data_voxel(); + assert(volume_data && "Failed to create volume data!\n"); + + // TODO(kevin): add volume fields to the Volume* + //volume_data->manager = volume_manager; + volume_data->slot = scene->volume_manager->add_volume(volume, filename, name.string()); + } } } } |