[Bf-blender-cvs] [ef228d92f2e] master: Fix: Volume grid duplication on USD import.

Michael Kowalski noreply at git.blender.org
Thu Mar 24 17:43:46 CET 2022


Commit: ef228d92f2e77ffab3b764a307415e951c90b608
Author: Michael Kowalski
Date:   Thu Mar 24 11:53:45 2022 -0400
Branches: master
https://developer.blender.org/rBef228d92f2e77ffab3b764a307415e951c90b608

Fix: Volume grid duplication on USD import.

Fix provided by Piotr Makal in patch D14204.

This patch fixes volume grid duplication which was occurring during
importing USD files. This was caused by calling BKE_volume_grid_add
twice per grid (excluding 'density' grid) for the same Volume
object: (1) in USDVolumeReader::read_object_data and (2) later in
BKE_volume_load.

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

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

M	source/blender/io/usd/intern/usd_reader_volume.cc

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

diff --git a/source/blender/io/usd/intern/usd_reader_volume.cc b/source/blender/io/usd/intern/usd_reader_volume.cc
index aec30539ee6..13044de5002 100644
--- a/source/blender/io/usd/intern/usd_reader_volume.cc
+++ b/source/blender/io/usd/intern/usd_reader_volume.cc
@@ -54,18 +54,6 @@ void USDVolumeReader::read_object_data(Main *bmain, const double motionSampleTim
 
     pxr::UsdVolOpenVDBAsset fieldBase(fieldPrim);
 
-    pxr::UsdAttribute fieldNameAttr = fieldBase.GetFieldNameAttr();
-
-    if (fieldNameAttr.IsAuthored()) {
-      pxr::TfToken fieldName;
-      fieldNameAttr.Get(&fieldName, motionSampleTime);
-
-      /* A Blender volume creates density by default. */
-      if (fieldName != usdtokens::density) {
-        BKE_volume_grid_add(volume, fieldName.GetString().c_str(), VOLUME_GRID_FLOAT);
-      }
-    }
-
     pxr::UsdAttribute filepathAttr = fieldBase.GetFilePathAttr();
 
     if (filepathAttr.IsAuthored()) {



More information about the Bf-blender-cvs mailing list