Refactor: Rename Object->imat to Object->world_to_object
The goal is to improve clarity and readability, without introducing big design changes. Follows the recent obmat to object_to_world refactor: the similar naming is used, and it is a run-time only rename, meaning, there is no affect on .blend files. This patch does not touch the redundant inversions. Those can be removed in almost (if not all) cases, but it would be the best to do it as a separate change. Differential Revision: https://developer.blender.org/D16367
This commit is contained in:
@@ -131,8 +131,8 @@ static void sphere_do(CastModifierData *cmd,
|
||||
invert_m4_m4(imat, mat);
|
||||
}
|
||||
|
||||
invert_m4_m4(ob->imat, ob->object_to_world);
|
||||
mul_v3_m4v3(center, ob->imat, ctrl_ob->object_to_world[3]);
|
||||
invert_m4_m4(ob->world_to_object, ob->object_to_world);
|
||||
mul_v3_m4v3(center, ob->world_to_object, ctrl_ob->object_to_world[3]);
|
||||
}
|
||||
|
||||
/* now we check which options the user wants */
|
||||
@@ -280,8 +280,8 @@ static void cuboid_do(CastModifierData *cmd,
|
||||
invert_m4_m4(imat, mat);
|
||||
}
|
||||
|
||||
invert_m4_m4(ob->imat, ob->object_to_world);
|
||||
mul_v3_m4v3(center, ob->imat, ctrl_ob->object_to_world[3]);
|
||||
invert_m4_m4(ob->world_to_object, ob->object_to_world);
|
||||
mul_v3_m4v3(center, ob->world_to_object, ctrl_ob->object_to_world[3]);
|
||||
}
|
||||
|
||||
if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
|
||||
|
||||
@@ -344,8 +344,8 @@ static void deformVerts_do(HookModifierData *hmd,
|
||||
/* just object target */
|
||||
copy_m4_m4(dmat, ob_target->object_to_world);
|
||||
}
|
||||
invert_m4_m4(ob->imat, ob->object_to_world);
|
||||
mul_m4_series(hd.mat, ob->imat, dmat, hmd->parentinv);
|
||||
invert_m4_m4(ob->world_to_object, ob->object_to_world);
|
||||
mul_m4_series(hd.mat, ob->world_to_object, dmat, hmd->parentinv);
|
||||
/* --- done with 'hd' init --- */
|
||||
|
||||
/* Regarding index range checking below.
|
||||
|
||||
@@ -134,7 +134,7 @@ static Volume *mesh_to_volume(ModifierData *md,
|
||||
}
|
||||
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 = float4x4(ctx->object->world_to_object) *
|
||||
float4x4(object_to_convert->object_to_world);
|
||||
geometry::MeshToVolumeResolution resolution;
|
||||
resolution.mode = (MeshToVolumeModifierResolutionMode)mvmd->resolution_mode;
|
||||
|
||||
@@ -262,7 +262,8 @@ struct DisplaceGridOp {
|
||||
return index_to_object;
|
||||
}
|
||||
const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->object_to_world);
|
||||
const openvdb::Mat4s world_to_texture = matrix_to_openvdb(vdmd.texture_map_object->imat);
|
||||
const openvdb::Mat4s world_to_texture = matrix_to_openvdb(
|
||||
vdmd.texture_map_object->world_to_object);
|
||||
return index_to_object * object_to_world * world_to_texture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
||||
|
||||
openvdb::math::Transform::Ptr transform = local_grid->transform().copy();
|
||||
transform->postMult(openvdb::Mat4d((float *)vmmd->object->object_to_world));
|
||||
openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx->object->imat);
|
||||
openvdb::Mat4d imat = openvdb::Mat4d((float *)ctx->object->world_to_object);
|
||||
/* `imat` had floating point issues and wasn't affine. */
|
||||
imat.setCol(3, openvdb::Vec4d(0, 0, 0, 1));
|
||||
transform->postMult(imat);
|
||||
|
||||
@@ -152,8 +152,8 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
if (wmd->objectcenter != nullptr) {
|
||||
float mat[4][4];
|
||||
/* get the control object's location in local coordinates */
|
||||
invert_m4_m4(ob->imat, ob->object_to_world);
|
||||
mul_m4_m4m4(mat, ob->imat, wmd->objectcenter->object_to_world);
|
||||
invert_m4_m4(ob->world_to_object, ob->object_to_world);
|
||||
mul_m4_m4m4(mat, ob->world_to_object, wmd->objectcenter->object_to_world);
|
||||
|
||||
wmd->startx = mat[3][0];
|
||||
wmd->starty = mat[3][1];
|
||||
|
||||
Reference in New Issue
Block a user