Volumes: make Mesh to Volume modifier independent of object transforms
This commit is contained in:
@@ -120,7 +120,6 @@ static void initData(ModifierData *md)
|
|||||||
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
|
||||||
{
|
{
|
||||||
MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md);
|
MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md);
|
||||||
DEG_add_modifier_to_transform_relation(ctx->node, "Mesh to Volume Modifier");
|
|
||||||
if (mvmd->object) {
|
if (mvmd->object) {
|
||||||
DEG_add_object_relation(
|
DEG_add_object_relation(
|
||||||
ctx->node, mvmd->object, DEG_OB_COMP_GEOMETRY, "Mesh to Volume Modifier");
|
ctx->node, mvmd->object, DEG_OB_COMP_GEOMETRY, "Mesh to Volume Modifier");
|
||||||
@@ -198,7 +197,9 @@ static float compute_voxel_size(const MeshToVolumeModifierData *mvmd,
|
|||||||
return voxel_size;
|
return voxel_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Volume *input_volume)
|
static Volume *modifyVolume(ModifierData *md,
|
||||||
|
const ModifierEvalContext *UNUSED(ctx),
|
||||||
|
Volume *input_volume)
|
||||||
{
|
{
|
||||||
#ifdef WITH_OPENVDB
|
#ifdef WITH_OPENVDB
|
||||||
using namespace blender;
|
using namespace blender;
|
||||||
@@ -215,8 +216,7 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo
|
|||||||
}
|
}
|
||||||
BKE_mesh_wrapper_ensure_mdata(mesh);
|
BKE_mesh_wrapper_ensure_mdata(mesh);
|
||||||
|
|
||||||
const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->imat) *
|
const float4x4 mesh_to_own_object_space_transform = object_to_convert->obmat;
|
||||||
float4x4(object_to_convert->obmat);
|
|
||||||
const float voxel_size = compute_voxel_size(mvmd, mesh_to_own_object_space_transform);
|
const float voxel_size = compute_voxel_size(mvmd, mesh_to_own_object_space_transform);
|
||||||
|
|
||||||
float4x4 mesh_to_index_space_transform;
|
float4x4 mesh_to_index_space_transform;
|
||||||
@@ -263,7 +263,7 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo
|
|||||||
return volume;
|
return volume;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
UNUSED_VARS(md, ctx);
|
UNUSED_VARS(md);
|
||||||
UNUSED_VARS(compute_voxel_size);
|
UNUSED_VARS(compute_voxel_size);
|
||||||
BKE_modifier_set_error(md, "Compiled without OpenVDB");
|
BKE_modifier_set_error(md, "Compiled without OpenVDB");
|
||||||
return input_volume;
|
return input_volume;
|
||||||
|
|||||||
Reference in New Issue
Block a user