[Bf-blender-cvs] [c68f031b8a3] temp-geometry-nodes-volume: initial working volume

Jacques Lucke noreply at git.blender.org
Mon Jan 18 16:36:46 CET 2021


Commit: c68f031b8a39f370419d346c198d84a6fc6d35b3
Author: Jacques Lucke
Date:   Mon Jan 18 15:32:11 2021 +0100
Branches: temp-geometry-nodes-volume
https://developer.blender.org/rBc68f031b8a39f370419d346c198d84a6fc6d35b3

initial working volume

===================================================================

M	source/blender/blenkernel/intern/volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
M	source/blender/nodes/geometry/nodes/node_geo_object_info.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc
index eadb01c43fc..d4c4888cb45 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -523,6 +523,8 @@ static void volume_copy_data(Main *UNUSED(bmain),
     volume_dst->runtime.grids = OBJECT_GUARDED_NEW(VolumeGridVector, grids_src);
   }
 #endif
+
+  volume_dst->batch_cache = nullptr;
 }
 
 static void volume_free_data(ID *id)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
index 75736ae714a..20c61c2d60a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
@@ -228,6 +228,12 @@ static void join_components(Span<const InstancesComponent *> src_components, Geo
   }
 }
 
+static void join_components(Span<const VolumeComponent *> src_components, GeometrySet &result)
+{
+  VolumeComponent &dst_component = result.get_component_for_write<VolumeComponent>();
+  UNUSED_VARS(src_components, dst_component);
+}
+
 template<typename Component>
 static void join_component_type(Span<const GeometrySet *> src_geometry_sets, GeometrySet &result)
 {
@@ -260,6 +266,7 @@ static void geo_node_join_geometry_exec(GeoNodeExecParams params)
   join_component_type<MeshComponent>(src_geometry_sets, geometry_set_result);
   join_component_type<PointCloudComponent>(src_geometry_sets, geometry_set_result);
   join_component_type<InstancesComponent>(src_geometry_sets, geometry_set_result);
+  join_component_type<VolumeComponent>(src_geometry_sets, geometry_set_result);
 
   params.set_output("Geometry", std::move(geometry_set_result));
 }
diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index 07d6858369d..b9b07270f8b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -19,6 +19,7 @@
 #include "BKE_mesh.h"
 #include "BKE_mesh_wrapper.h"
 #include "BKE_modifier.h"
+#include "BKE_volume.h"
 
 #include "BLI_math_matrix.h"
 
@@ -74,6 +75,15 @@ static void geo_node_object_info_exec(GeoNodeExecParams params)
           mesh_component.copy_vertex_group_names_from_object(*object);
         }
       }
+      if (object->type == OB_VOLUME) {
+        Volume *volume = (Volume *)object->data;
+
+        Volume *copied_volume = BKE_volume_copy_for_eval(volume, false);
+
+        VolumeComponent &volume_component =
+            geometry_set.get_component_for_write<VolumeComponent>();
+        volume_component.replace(copied_volume);
+      }
     }
   }



More information about the Bf-blender-cvs mailing list