[Bf-blender-cvs] [4877e0e] openvdb: Move registration of volumes from attributes out of the smoke sim logic.
Lukas Tönne
noreply at git.blender.org
Thu Nov 17 13:31:15 CET 2016
Commit: 4877e0efc978f01a4062379474763bf669705498
Author: Lukas Tönne
Date: Thu Nov 17 13:30:11 2016 +0100
Branches: openvdb
https://developer.blender.org/rB4877e0efc978f01a4062379474763bf669705498
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.
===================================================================
M intern/cycles/blender/blender_volume.cpp
===================================================================
diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp
index e68f2ef..2e5beff 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());
+ }
}
}
}
More information about the Bf-blender-cvs
mailing list