[Bf-blender-cvs] [ccf43fe6050] blender-v2.83-release: Cycles: Fix rendering instanced smoke domain.

Jacques Lucke noreply at git.blender.org
Wed May 20 16:54:41 CEST 2020


Commit: ccf43fe6050c4cf986bd227ffbf25b7b02c077be
Author: Jacques Lucke
Date:   Wed May 20 16:53:28 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBccf43fe6050c4cf986bd227ffbf25b7b02c077be

Cycles: Fix rendering instanced smoke domain.

The problem was that Cycles would store a pointer to an object in
`DEGObjectIterData->templ_dupli_object`. This pointer was then accessed
when the iterator was already freed.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7797

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

M	intern/cycles/blender/blender_volume.cpp

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

diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp
index 6254a1a1b24..4eed6be8c7c 100644
--- a/intern/cycles/blender/blender_volume.cpp
+++ b/intern/cycles/blender/blender_volume.cpp
@@ -34,15 +34,13 @@ CCL_NAMESPACE_BEGIN
 /* TODO: verify this is not loading unnecessary attributes. */
 class BlenderSmokeLoader : public ImageLoader {
  public:
-  BlenderSmokeLoader(const BL::Object &b_ob, AttributeStandard attribute)
-      : b_ob(b_ob), attribute(attribute)
+  BlenderSmokeLoader(BL::Object &b_ob, AttributeStandard attribute)
+      : b_domain(object_fluid_gas_domain_find(b_ob)), b_mesh(b_ob.data()), attribute(attribute)
   {
   }
 
   bool load_metadata(ImageMetaData &metadata) override
   {
-    BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
-
     if (!b_domain) {
       return false;
     }
@@ -79,7 +77,6 @@ class BlenderSmokeLoader : public ImageLoader {
     /* Create a matrix to transform from object space to mesh texture space.
      * This does not work with deformations but that can probably only be done
      * well with a volume grid mapping of coordinates. */
-    BL::Mesh b_mesh(b_ob.data());
     float3 loc, size;
     mesh_texture_space(b_mesh, loc, size);
     metadata.transform_3d = transform_translate(-loc) * transform_scale(size);
@@ -90,9 +87,6 @@ class BlenderSmokeLoader : public ImageLoader {
 
   bool load_pixels(const ImageMetaData &, void *pixels, const size_t, const bool) override
   {
-    /* smoke volume data */
-    BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
-
     if (!b_domain) {
       return false;
     }
@@ -179,10 +173,11 @@ class BlenderSmokeLoader : public ImageLoader {
   bool equals(const ImageLoader &other) const override
   {
     const BlenderSmokeLoader &other_loader = (const BlenderSmokeLoader &)other;
-    return b_ob == other_loader.b_ob && attribute == other_loader.attribute;
+    return b_domain == other_loader.b_domain && attribute == other_loader.attribute;
   }
 
-  BL::Object b_ob;
+  BL::FluidDomainSettings b_domain;
+  BL::Mesh b_mesh;
   AttributeStandard attribute;
 };



More information about the Bf-blender-cvs mailing list