Fix T103618: GN Transform modifies source VDB grid
The call to BKE_volume_grid_openvdb_for_write() was accidentally removed in D15806. This adds it to BKE_volume_grid_transform_matrix_set() to avoid that it happens again when that function is used. Differential Revision: D16949
This commit is contained in:
parent
3a2899cc31
commit
e2006f15a9
Notes:
blender-bot
2023-02-14 06:00:45 +01:00
Referenced by issue #103618, VDB Volume transformed in Geometry Nodes unstable results
|
@ -114,7 +114,9 @@ int BKE_volume_grid_channels(const struct VolumeGrid *grid);
|
|||
* Transformation from index space to object space.
|
||||
*/
|
||||
void BKE_volume_grid_transform_matrix(const struct VolumeGrid *grid, float mat[4][4]);
|
||||
void BKE_volume_grid_transform_matrix_set(struct VolumeGrid *volume_grid, const float mat[4][4]);
|
||||
void BKE_volume_grid_transform_matrix_set(const struct Volume *volume,
|
||||
struct VolumeGrid *volume_grid,
|
||||
const float mat[4][4]);
|
||||
|
||||
/* Volume Editing
|
||||
*
|
||||
|
|
|
@ -1474,7 +1474,9 @@ void BKE_volume_grid_transform_matrix(const VolumeGrid *volume_grid, float mat[4
|
|||
#endif
|
||||
}
|
||||
|
||||
void BKE_volume_grid_transform_matrix_set(struct VolumeGrid *volume_grid, const float mat[4][4])
|
||||
void BKE_volume_grid_transform_matrix_set(const Volume *volume,
|
||||
VolumeGrid *volume_grid,
|
||||
const float mat[4][4])
|
||||
{
|
||||
#ifdef WITH_OPENVDB
|
||||
openvdb::math::Mat4f mat_openvdb;
|
||||
|
@ -1483,7 +1485,7 @@ void BKE_volume_grid_transform_matrix_set(struct VolumeGrid *volume_grid, const
|
|||
mat_openvdb(col, row) = mat[col][row];
|
||||
}
|
||||
}
|
||||
openvdb::GridBase::Ptr grid = volume_grid->grid();
|
||||
openvdb::GridBase::Ptr grid = BKE_volume_grid_openvdb_for_write(volume, volume_grid, false);
|
||||
grid->setTransform(std::make_shared<openvdb::math::Transform>(
|
||||
std::make_shared<openvdb::math::AffineMap>(mat_openvdb)));
|
||||
#else
|
||||
|
|
|
@ -142,7 +142,7 @@ static void transform_volume(GeoNodeExecParams ¶ms,
|
|||
normalize_v3(grid_matrix.values[2]);
|
||||
}
|
||||
}
|
||||
BKE_volume_grid_transform_matrix_set(volume_grid, grid_matrix.values);
|
||||
BKE_volume_grid_transform_matrix_set(&volume, volume_grid, grid_matrix.values);
|
||||
}
|
||||
if (found_too_small_scale) {
|
||||
params.error_message_add(NodeWarningType::Warning,
|
||||
|
|
Loading…
Reference in New Issue