diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
32 files changed, 281 insertions, 273 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 10aa4ec7906..8f6bd812d8e 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1738,7 +1738,7 @@ void what_does_obaction(Object *ob, BKE_object_workob_clear(workob); /* init workob */ - copy_m4_m4(workob->obmat, ob->obmat); + copy_m4_m4(workob->object_to_world, ob->object_to_world); copy_m4_m4(workob->parentinv, ob->parentinv); copy_m4_m4(workob->constinv, ob->constinv); workob->parent = ob->parent; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 2e73cac99b5..0f8bf0e9928 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1596,7 +1596,7 @@ void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float o } /* Get inverse of (armature) object's matrix. */ - invert_m4_m4(obmat, ob->obmat); + invert_m4_m4(obmat, ob->object_to_world); /* multiply given matrix by object's-inverse to find pose-space matrix */ mul_m4_m4m4(outmat, inmat, obmat); @@ -2569,7 +2569,7 @@ void BKE_pose_where_is(struct Depsgraph *depsgraph, Scene *scene, Object *ob) } } else { - invert_m4_m4(ob->imat, ob->obmat); /* imat is needed */ + invert_m4_m4(ob->imat, ob->object_to_world); /* imat is needed */ /* 1. clear flags */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { @@ -2696,14 +2696,14 @@ void BKE_pchan_minmax(const Object *ob, pchan->custom_translation[0], pchan->custom_translation[1], pchan->custom_translation[2]); - mul_m4_series(mat, ob->obmat, tmp, rmat, smat); + mul_m4_series(mat, ob->object_to_world, tmp, rmat, smat); BKE_boundbox_minmax(bb_custom, mat, r_min, r_max); } else { float vec[3]; - mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head); + mul_v3_m4v3(vec, ob->object_to_world, pchan_tx->pose_head); minmax_v3v3_v3(r_min, r_max, vec); - mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_tail); + mul_v3_m4v3(vec, ob->object_to_world, pchan_tx->pose_tail); minmax_v3v3_v3(r_min, r_max, vec); } } diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c index 89afb886fc2..64a3937c191 100644 --- a/source/blender/blenkernel/intern/armature_deform.c +++ b/source/blender/blenkernel/intern/armature_deform.c @@ -582,9 +582,9 @@ static void armature_deform_coords_impl(const Object *ob_arm, }; float obinv[4][4]; - invert_m4_m4(obinv, ob_target->obmat); + invert_m4_m4(obinv, ob_target->object_to_world); - mul_m4_m4m4(data.postmat, obinv, ob_arm->obmat); + mul_m4_m4m4(data.postmat, obinv, ob_arm->object_to_world); invert_m4_m4(data.premat, data.postmat); if (em_target != NULL) { diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 6d7aed239e7..b9f46118c0d 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -249,7 +249,7 @@ static void apply_curve_transform( * unless the option to allow curve to be positioned elsewhere is activated (i.e. no root). */ if ((ik_data->flag & CONSTRAINT_SPLINEIK_NO_ROOT) == 0) { - mul_m4_v3(ik_data->tar->obmat, r_vec); + mul_m4_v3(ik_data->tar->object_to_world, r_vec); } /* Convert the position to pose-space. */ @@ -819,7 +819,7 @@ void BKE_pose_eval_init(struct Depsgraph *depsgraph, Scene *UNUSED(scene), Objec BLI_assert((object->pose->flag & POSE_RECALC) == 0); /* imat is needed for solvers. */ - invert_m4_m4(object->imat, object->obmat); + invert_m4_m4(object->imat, object->object_to_world); /* clear flags */ for (bPoseChannel *pchan = pose->chanbase.first; pchan != NULL; pchan = pchan->next) { diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 2e07b52c7bf..a0458f0f8d8 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -959,7 +959,7 @@ void boids_precalc_rules(ParticleSettings *part, float cfra) if (flbr->ob && flbr->cfra != cfra) { /* save object locations for velocity calculations */ copy_v3_v3(flbr->oloc, flbr->loc); - copy_v3_v3(flbr->loc, flbr->ob->obmat[3]); + copy_v3_v3(flbr->loc, flbr->ob->object_to_world[3]); flbr->cfra = cfra; } } diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 8608ce97397..7c1193d80ab 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -221,16 +221,16 @@ float BKE_camera_object_dof_distance(const Object *ob) } if (cam->dof.focus_object) { float view_dir[3], dof_dir[3]; - normalize_v3_v3(view_dir, ob->obmat[2]); + normalize_v3_v3(view_dir, ob->object_to_world[2]); bPoseChannel *pchan = BKE_pose_channel_find_name(cam->dof.focus_object->pose, cam->dof.focus_subtarget); if (pchan) { float posemat[4][4]; - mul_m4_m4m4(posemat, cam->dof.focus_object->obmat, pchan->pose_mat); - sub_v3_v3v3(dof_dir, ob->obmat[3], posemat[3]); + mul_m4_m4m4(posemat, cam->dof.focus_object->object_to_world, pchan->pose_mat); + sub_v3_v3v3(dof_dir, ob->object_to_world[3], posemat[3]); } else { - sub_v3_v3v3(dof_dir, ob->obmat[3], cam->dof.focus_object->obmat[3]); + sub_v3_v3v3(dof_dir, ob->object_to_world[3], cam->dof.focus_object->object_to_world[3]); } return fabsf(dot_v3v3(view_dir, dof_dir)); } @@ -628,7 +628,7 @@ static void camera_frame_fit_data_init(const Scene *scene, BKE_camera_params_compute_matrix(params); /* initialize callback data */ - copy_m3_m4(data->camera_rotmat, (float(*)[4])ob->obmat); + copy_m3_m4(data->camera_rotmat, (float(*)[4])ob->object_to_world); normalize_m3(data->camera_rotmat); /* To transform a plane which is in its homogeneous representation (4d vector), * we need the inverse of the transpose of the transform matrix... */ @@ -828,7 +828,7 @@ bool BKE_camera_view_frame_fit_to_coords(const Depsgraph *depsgraph, static void camera_model_matrix(const Object *camera, float r_modelmat[4][4]) { - copy_m4_m4(r_modelmat, camera->obmat); + copy_m4_m4(r_modelmat, camera->object_to_world); } static void camera_stereo3d_model_matrix(const Object *camera, @@ -854,7 +854,7 @@ static void camera_stereo3d_model_matrix(const Object *camera, } float size[3]; - mat4_to_size(size, camera->obmat); + mat4_to_size(size, camera->object_to_world); size_to_mat4(sizemat, size); if (pivot == CAM_S3D_PIVOT_CENTER) { @@ -894,7 +894,7 @@ static void camera_stereo3d_model_matrix(const Object *camera, toeinmat[3][0] = interocular_distance * fac_signed; /* transform */ - normalize_m4_m4(r_modelmat, camera->obmat); + normalize_m4_m4(r_modelmat, camera->object_to_world); mul_m4_m4m4(r_modelmat, r_modelmat, toeinmat); /* scale back to the original size */ @@ -902,7 +902,7 @@ static void camera_stereo3d_model_matrix(const Object *camera, } else { /* CAM_S3D_PIVOT_LEFT, CAM_S3D_PIVOT_RIGHT */ /* rotate perpendicular to the interocular line */ - normalize_m4_m4(r_modelmat, camera->obmat); + normalize_m4_m4(r_modelmat, camera->object_to_world); mul_m4_m4m4(r_modelmat, r_modelmat, rotmat); /* translate along the interocular line */ @@ -918,7 +918,7 @@ static void camera_stereo3d_model_matrix(const Object *camera, } } else { - normalize_m4_m4(r_modelmat, camera->obmat); + normalize_m4_m4(r_modelmat, camera->object_to_world); /* translate - no rotation in CAM_S3D_OFFAXIS, CAM_S3D_PARALLEL */ translate_m4(r_modelmat, -interocular_distance * fac_signed, 0.0f, 0.0f); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 89983eb8f62..910869bbc72 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -269,7 +269,7 @@ static int do_step_cloth( /* Get the current position. */ copy_v3_v3(verts->xconst, mvert[i].co); - mul_m4_v3(ob->obmat, verts->xconst); + mul_m4_v3(ob->object_to_world, verts->xconst); if (vert_mass_changed) { verts->mass = clmd->sim_parms->mass; @@ -581,7 +581,7 @@ static void cloth_to_object(Object *ob, ClothModifierData *clmd, float (*vertexC if (clmd->clothObject) { /* Inverse matrix is not up to date. */ - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); for (i = 0; i < cloth->mvert_num; i++) { copy_v3_v3(vertexCos[i], cloth->verts[i].x); @@ -763,11 +763,11 @@ static bool cloth_from_object( if (first) { copy_v3_v3(verts->x, mvert[i].co); - mul_m4_v3(ob->obmat, verts->x); + mul_m4_v3(ob->object_to_world, verts->x); if (shapekey_rest) { copy_v3_v3(verts->xrest, shapekey_rest[i]); - mul_m4_v3(ob->obmat, verts->xrest); + mul_m4_v3(ob->object_to_world, verts->xrest); } else { copy_v3_v3(verts->xrest, verts->x); @@ -1155,7 +1155,7 @@ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh) /* vertex count is already ensured to match */ for (i = 0; i < mesh->totvert; i++, verts++) { copy_v3_v3(verts->xrest, mvert[i].co); - mul_m4_v3(ob->obmat, verts->xrest); + mul_m4_v3(ob->object_to_world, verts->xrest); } } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a6a6a1ca28f..1f288aef5ad 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -149,7 +149,7 @@ bConstraintOb *BKE_constraints_make_evalob( /* Quats/Axis-Angle, so Eulers should just use default order */ cob->rotOrder = EULER_ORDER_DEFAULT; } - copy_m4_m4(cob->matrix, ob->obmat); + copy_m4_m4(cob->matrix, ob->object_to_world); } else { unit_m4(cob->matrix); @@ -175,7 +175,7 @@ bConstraintOb *BKE_constraints_make_evalob( } /* matrix in world-space */ - mul_m4_m4m4(cob->matrix, ob->obmat, cob->pchan->pose_mat); + mul_m4_m4m4(cob->matrix, ob->object_to_world, cob->pchan->pose_mat); } else { unit_m4(cob->matrix); @@ -216,7 +216,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) /* cob->ob might not exist! */ if (cob->ob) { /* copy new ob-matrix back to owner */ - copy_m4_m4(cob->ob->obmat, cob->matrix); + copy_m4_m4(cob->ob->object_to_world, cob->matrix); /* copy inverse of delta back to owner */ invert_m4_m4(cob->ob->constinv, delta); @@ -276,7 +276,7 @@ void BKE_constraint_mat_convertspace(Object *ob, } else { /* World to pose. */ - invert_m4_m4(imat, ob->obmat); + invert_m4_m4(imat, ob->object_to_world); mul_m4_m4m4(mat, imat, mat); /* Use pose-space as stepping stone for other spaces. */ @@ -319,7 +319,7 @@ void BKE_constraint_mat_convertspace(Object *ob, } else { /* Pose to world. */ - mul_m4_m4m4(mat, ob->obmat, mat); + mul_m4_m4m4(mat, ob->object_to_world, mat); /* Use world-space as stepping stone for other spaces. */ if (to != CONSTRAINT_SPACE_WORLD) { /* Call self with slightly different values. */ @@ -429,7 +429,7 @@ void BKE_constraint_mat_convertspace(Object *ob, /* Check if object has a parent. */ if (ob->parent) { /* 'subtract' parent's effects from owner. */ - mul_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv); + mul_m4_m4m4(diff_mat, ob->parent->object_to_world, ob->parentinv); invert_m4_m4_safe(imat, diff_mat); mul_m4_m4m4(mat, imat, mat); } @@ -465,7 +465,7 @@ void BKE_constraint_mat_convertspace(Object *ob, /* check that object has a parent - otherwise this won't work */ if (ob->parent) { /* 'add' parent's effect back to owner */ - mul_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv); + mul_m4_m4m4(diff_mat, ob->parent->object_to_world, ob->parentinv); mul_m4_m4m4(mat, diff_mat, mat); } else { @@ -518,7 +518,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ const int defgroup = BKE_object_defgroup_name_index(ob, substring); /* initialize target matrix using target matrix */ - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); /* get index of vertex group */ if (defgroup == -1) { @@ -584,7 +584,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ * calc_gizmo_stats, V3D_ORIENT_NORMAL case */ /* We need the transpose of the inverse for a normal. */ - copy_m3_m4(imat, ob->obmat); + copy_m3_m4(imat, ob->object_to_world); invert_m3_m3(tmat, imat); transpose_m3(tmat); @@ -605,7 +605,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ normalize_m4(mat); /* apply the average coordinate as the new location */ - mul_v3_m4v3(mat[3], ob->obmat, vec); + mul_v3_m4v3(mat[3], ob->object_to_world, vec); } /* function that sets the given matrix based on given vertex group in lattice */ @@ -627,7 +627,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m const int defgroup = BKE_object_defgroup_name_index(ob, substring); /* initialize target matrix using target matrix */ - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); /* get index of vertex group */ if (defgroup == -1) { @@ -661,11 +661,11 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m } } - /* find average location, then multiply by ob->obmat to find world-space location */ + /* find average location, then multiply by ob->object_to_world to find world-space location */ if (grouped) { mul_v3_fl(vec, 1.0f / grouped); } - mul_v3_m4v3(tvec, ob->obmat, vec); + mul_v3_m4v3(tvec, ob->object_to_world, vec); /* copy new location to matrix */ copy_v3_v3(mat[3], tvec); @@ -684,7 +684,7 @@ static void constraint_target_to_mat4(Object *ob, { /* Case OBJECT */ if (substring[0] == '\0') { - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); BKE_constraint_mat_convertspace(ob, NULL, cob, mat, from, to, false); } /* Case VERTEXGROUP */ @@ -719,7 +719,7 @@ static void constraint_target_to_mat4(Object *ob, if (headtail < 0.000001f && !(is_bbone && full_bbone)) { /* skip length interpolation if set to head */ - mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat); + mul_m4_m4m4(mat, ob->object_to_world, pchan->pose_mat); } else if (is_bbone && pchan->bone->segments == pchan->runtime.bbone_segments) { /* use point along bbone */ @@ -745,7 +745,7 @@ static void constraint_target_to_mat4(Object *ob, mul_v3_m4v3(tempmat[3], pchan->pose_mat, loc); } - mul_m4_m4m4(mat, ob->obmat, tempmat); + mul_m4_m4m4(mat, ob->object_to_world, tempmat); } else { float tempmat[4][4], loc[3]; @@ -757,11 +757,11 @@ static void constraint_target_to_mat4(Object *ob, copy_m4_m4(tempmat, pchan->pose_mat); copy_v3_v3(tempmat[3], loc); - mul_m4_m4m4(mat, ob->obmat, tempmat); + mul_m4_m4m4(mat, ob->object_to_world, tempmat); } } else { - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); } /* convert matrix space as required */ @@ -1069,7 +1069,7 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar if (data->flag & CHILDOF_SET_INVERSE) { invert_m4_m4(data->invmat, parmat); if (cob->pchan != NULL) { - mul_m4_series(data->invmat, data->invmat, cob->ob->obmat); + mul_m4_series(data->invmat, data->invmat, cob->ob->object_to_world); } copy_m4_m4(inverse_matrix, data->invmat); @@ -1388,8 +1388,8 @@ static void kinematic_get_tarmat(struct Depsgraph *UNUSED(depsgraph), else { float vec[3]; /* move grabtarget into world space */ - mul_v3_m4v3(vec, ob->obmat, data->grabtarget); - copy_m4_m4(ct->matrix, ob->obmat); + mul_v3_m4v3(vec, ob->object_to_world, data->grabtarget); + copy_m4_m4(ct->matrix, ob->object_to_world); copy_v3_v3(ct->matrix[3], vec); } } @@ -1528,7 +1528,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), copy_v3_v3(totmat[3], vec); - mul_m4_m4m4(ct->matrix, ct->tar->obmat, totmat); + mul_m4_m4m4(ct->matrix, ct->tar->object_to_world, totmat); } } } @@ -2557,7 +2557,7 @@ static void armdef_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bPoseChannel *pchan = BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget); if (pchan != NULL) { - mul_m4_m4m4(ct->matrix, ct->tar->obmat, pchan->pose_mat); + mul_m4_m4m4(ct->matrix, ct->tar->object_to_world, pchan->pose_mat); return; } } @@ -2613,7 +2613,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, float weight = ct->weight; /* Our object's location in target pose space. */ - invert_m4_m4(iobmat, ct->tar->obmat); + invert_m4_m4(iobmat, ct->tar->object_to_world); mul_v3_m4v3(co, iobmat, wco); /* Multiply by the envelope weight when appropriate. */ @@ -2644,7 +2644,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, mul_m4_m4m4(basemat, bone->arm_mat, b_bone_rest_mats[index].mat); } - armdef_accumulate_matrix(ct->tar->obmat, + armdef_accumulate_matrix(ct->tar->object_to_world, iobmat, basemat, b_bone_mats[index + 1].mat, @@ -2657,7 +2657,7 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, mul_m4_m4m4(basemat, bone->arm_mat, b_bone_rest_mats[index + 1].mat); } - armdef_accumulate_matrix(ct->tar->obmat, + armdef_accumulate_matrix(ct->tar->object_to_world, iobmat, basemat, b_bone_mats[index + 2].mat, @@ -2667,8 +2667,13 @@ static void armdef_accumulate_bone(bConstraintTarget *ct, } else { /* Simple bone. This requires DEG_OPCODE_BONE_DONE dependency due to chan_mat. */ - armdef_accumulate_matrix( - ct->tar->obmat, iobmat, bone->arm_mat, pchan->chan_mat, weight, r_sum_mat, r_sum_dq); + armdef_accumulate_matrix(ct->tar->object_to_world, + iobmat, + bone->arm_mat, + pchan->chan_mat, + weight, + r_sum_mat, + r_sum_dq); } /* Accumulate the weight. */ @@ -2694,7 +2699,7 @@ static void armdef_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ /* For constraints on bones, use the rest position to bind b-bone segments * and envelopes, to allow safely changing the bone location as if parented. */ copy_v3_v3(input_co, cob->pchan->bone->arm_head); - mul_m4_v3(cob->ob->obmat, input_co); + mul_m4_v3(cob->ob->object_to_world, input_co); } else { copy_v3_v3(input_co, cob->matrix[3]); @@ -3927,7 +3932,7 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar unit_m4(totmat); copy_v3_v3(totmat[3], vec); - mul_m4_m4m4(targetMatrix, ct->tar->obmat, totmat); + mul_m4_m4m4(targetMatrix, ct->tar->object_to_world, totmat); } } @@ -4227,7 +4232,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), if (BKE_shrinkwrap_init_tree( &tree, target_eval, scon->shrinkType, scon->shrinkMode, do_track_normal)) { - BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat); + BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->object_to_world); switch (scon->shrinkType) { case MOD_SHRINKWRAP_NEAREST_SURFACE: @@ -4902,7 +4907,7 @@ static void followtrack_evaluate_using_3d_position_object(FollowTrackContext *co /* Object matrix of the camera. */ float camera_obmat[4][4]; - copy_m4_m4(camera_obmat, camera_object->obmat); + copy_m4_m4(camera_obmat, camera_object->object_to_world); /* Calculate inverted matrix of the solved camera at the current time. */ float reconstructed_camera_mat[4][4]; @@ -5054,10 +5059,10 @@ static void followtrack_project_to_depth_object_if_needed(FollowTrackContext *co } float depth_object_mat_inv[4][4]; - invert_m4_m4(depth_object_mat_inv, depth_object->obmat); + invert_m4_m4(depth_object_mat_inv, depth_object->object_to_world); float ray_start[3], ray_end[3]; - mul_v3_m4v3(ray_start, depth_object_mat_inv, context->camera_object->obmat[3]); + mul_v3_m4v3(ray_start, depth_object_mat_inv, context->camera_object->object_to_world[3]); mul_v3_m4v3(ray_end, depth_object_mat_inv, cob->matrix[3]); float ray_direction[3]; @@ -5080,7 +5085,7 @@ static void followtrack_project_to_depth_object_if_needed(FollowTrackContext *co &tree_data); if (result != -1) { - mul_v3_m4v3(cob->matrix[3], depth_object->obmat, hit.co); + mul_v3_m4v3(cob->matrix[3], depth_object->object_to_world, hit.co); } free_bvhtree_from_mesh(&tree_data); @@ -5128,9 +5133,9 @@ static void followtrack_evaluate_using_2d_position(FollowTrackContext *context, } float disp[3]; - mul_v3_m4v3(disp, camera_object->obmat, vec); + mul_v3_m4v3(disp, camera_object->object_to_world, vec); - copy_m4_m4(rmat, camera_object->obmat); + copy_m4_m4(rmat, camera_object->object_to_world); zero_v3(rmat[3]); mul_m4_m4m4(cob->matrix, cob->matrix, rmat); @@ -5152,10 +5157,10 @@ static void followtrack_evaluate_using_2d_position(FollowTrackContext *context, } float disp[3]; - mul_v3_m4v3(disp, camera_object->obmat, vec); + mul_v3_m4v3(disp, camera_object->object_to_world, vec); /* apply camera rotation so Z-axis would be co-linear */ - copy_m4_m4(rmat, camera_object->obmat); + copy_m4_m4(rmat, camera_object->object_to_world); zero_v3(rmat[3]); mul_m4_m4m4(cob->matrix, cob->matrix, rmat); @@ -5303,7 +5308,7 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat); invert_m4_m4(imat, mat); - mul_m4_m4m4(parmat, camob->obmat, imat); + mul_m4_m4m4(parmat, camob->object_to_world, imat); copy_m4_m4(obmat, cob->matrix); @@ -5650,7 +5655,7 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, BLI_freelinkN(&single_con, new_con); /* Apply transform from matrix. */ - BKE_object_apply_mat4(ob, ob_eval->obmat, true, true); + BKE_object_apply_mat4(ob, ob_eval->object_to_world, true, true); return true; } @@ -6237,7 +6242,7 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, cob->ob = (Object *)ownerdata; cob->pchan = NULL; if (cob->ob) { - copy_m4_m4(cob->matrix, cob->ob->obmat); + copy_m4_m4(cob->matrix, cob->ob->object_to_world); copy_m4_m4(cob->startmat, cob->matrix); } else { diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c index 9a27ba91c2f..066d8494451 100644 --- a/source/blender/blenkernel/intern/curve_deform.c +++ b/source/blender/blenkernel/intern/curve_deform.c @@ -44,8 +44,8 @@ typedef struct { static void init_curve_deform(const Object *ob_curve, const Object *ob_target, CurveDeform *cd) { float imat[4][4]; - invert_m4_m4(imat, ob_target->obmat); - mul_m4_m4m4(cd->objectspace, imat, ob_curve->obmat); + invert_m4_m4(imat, ob_target->object_to_world); + mul_m4_m4m4(cd->objectspace, imat, ob_curve->object_to_world); invert_m4_m4(cd->curvespace, cd->objectspace); copy_m3_m4(cd->objectspace3, cd->objectspace); cd->no_rot_axis = 0; diff --git a/source/blender/blenkernel/intern/curves.cc b/source/blender/blenkernel/intern/curves.cc index 72e53023d6d..61755a5be9b 100644 --- a/source/blender/blenkernel/intern/curves.cc +++ b/source/blender/blenkernel/intern/curves.cc @@ -412,11 +412,11 @@ void curves_copy_parameters(const Curves &src, Curves &dst) CurvesSurfaceTransforms::CurvesSurfaceTransforms(const Object &curves_ob, const Object *surface_ob) { - this->curves_to_world = curves_ob.obmat; + this->curves_to_world = curves_ob.object_to_world; this->world_to_curves = this->curves_to_world.inverted(); if (surface_ob != nullptr) { - this->surface_to_world = surface_ob->obmat; + this->surface_to_world = surface_ob->object_to_world; this->world_to_surface = this->surface_to_world.inverted(); this->surface_to_curves = this->world_to_curves * this->surface_to_world; this->curves_to_surface = this->world_to_surface * this->curves_to_world; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index e177250ae5a..b9cec17b6e0 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3783,7 +3783,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph, numOfVerts_p = mesh_p->totvert; mvert_p = BKE_mesh_verts_for_write(mesh_p); - copy_m4_m4(prev_obmat, ob->obmat); + copy_m4_m4(prev_obmat, ob->object_to_world); /* current frame mesh */ scene->r.cfra = cur_fra; @@ -3816,7 +3816,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph, .brush_vel = *brushVel, .mvert_p = mvert_p, .mvert_c = mvert_c, - .obmat = ob->obmat, + .obmat = ob->object_to_world, .prev_obmat = prev_obmat, .timescale = timescale, }; @@ -3856,7 +3856,7 @@ static void dynamicPaint_brushObjectCalculateVelocity( SUBFRAME_RECURSION, BKE_scene_ctime_get(scene), eModifierType_DynamicPaint); - copy_m4_m4(prev_obmat, ob->obmat); + copy_m4_m4(prev_obmat, ob->object_to_world); /* current frame mesh */ scene->r.cfra = cur_fra; @@ -3871,7 +3871,7 @@ static void dynamicPaint_brushObjectCalculateVelocity( /* calculate speed */ mul_m4_v3(prev_obmat, prev_loc); - mul_m4_v3(ob->obmat, cur_loc); + mul_m4_v3(ob->object_to_world, cur_loc); sub_v3_v3v3(brushVel->v, cur_loc, prev_loc); mul_v3_fl(brushVel->v, 1.0f / timescale); @@ -4279,14 +4279,14 @@ static bool dynamicPaint_paintMesh(Depsgraph *depsgraph, * (Faster than transforming per surface point * coordinates and normals to object space) */ for (ii = 0; ii < numOfVerts; ii++) { - mul_m4_v3(brushOb->obmat, mvert[ii].co); + mul_m4_v3(brushOb->object_to_world, mvert[ii].co); boundInsert(&mesh_bb, mvert[ii].co); /* for proximity project calculate average normal */ if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) { float nor[3]; copy_v3_v3(nor, vert_normals[ii]); - mul_mat3_m4_v3(brushOb->obmat, nor); + mul_mat3_m4_v3(brushOb->object_to_world, nor); normalize_v3(nor); add_v3_v3(avg_brushNor, nor); @@ -5870,7 +5870,7 @@ static bool dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *o } /* matrix comparison */ - if (!equals_m4m4(bData->prev_obmat, ob->obmat)) { + if (!equals_m4m4(bData->prev_obmat, ob->object_to_world)) { return true; } @@ -5957,7 +5957,7 @@ static void dynamic_paint_generate_bake_data_cb(void *__restrict userdata, mul_v3_v3v3(scaled_nor, temp_nor, ob->scale); bData->bNormal[index].normal_scale = len_v3(scaled_nor); } - mul_mat3_m4_v3(ob->obmat, temp_nor); + mul_mat3_m4_v3(ob->object_to_world, temp_nor); normalize_v3(temp_nor); negate_v3_v3(bData->bNormal[index].invNorm, temp_nor); } @@ -5995,7 +5995,7 @@ static void dynamic_paint_generate_bake_data_cb(void *__restrict userdata, mul_v3_v3v3(scaled_nor, temp_nor, ob->scale); bData->bNormal[index].normal_scale = len_v3(scaled_nor); } - mul_mat3_m4_v3(ob->obmat, temp_nor); + mul_mat3_m4_v3(ob->object_to_world, temp_nor); normalize_v3(temp_nor); negate_v3_v3(bData->bNormal[index].invNorm, temp_nor); } @@ -6113,7 +6113,7 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface, bData->mesh_bounds.valid = false; for (index = 0; index < canvasNumOfVerts; index++) { copy_v3_v3(canvas_verts[index].v, mvert[index].co); - mul_m4_v3(ob->obmat, canvas_verts[index].v); + mul_m4_v3(ob->object_to_world, canvas_verts[index].v); boundInsert(&bData->mesh_bounds, canvas_verts[index].v); } @@ -6143,7 +6143,7 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface, dynamicPaint_prepareAdjacencyData(surface, false); /* Copy current frame vertices to check against in next frame */ - copy_m4_m4(bData->prev_obmat, ob->obmat); + copy_m4_m4(bData->prev_obmat, ob->object_to_world); memcpy(bData->prev_verts, mvert, canvasNumOfVerts * sizeof(MVert)); bData->clear = 0; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 42b38854248..983e4b3c6e6 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -154,8 +154,8 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef if (eff->ob->runtime.curve_cache->anim_path_accum_length) { BKE_where_on_path( eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL); - mul_m4_v3(eff->ob->obmat, eff->guide_loc); - mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir); + mul_m4_v3(eff->ob->object_to_world, eff->guide_loc); + mul_mat3_m4_v3(eff->ob->object_to_world, eff->guide_dir); } } } @@ -707,8 +707,8 @@ bool get_effector_data(EffectorCache *eff, copy_v3_v3(efd->loc, verts[*efd->index].co); copy_v3_v3(efd->nor, vert_normals[*efd->index]); - mul_m4_v3(eff->ob->obmat, efd->loc); - mul_mat3_m4_v3(eff->ob->obmat, efd->nor); + mul_m4_v3(eff->ob->object_to_world, efd->loc); + mul_mat3_m4_v3(eff->ob->object_to_world, efd->nor); normalize_v3(efd->nor); @@ -760,23 +760,23 @@ bool get_effector_data(EffectorCache *eff, const Object *ob = eff->ob; /* Use z-axis as normal. */ - normalize_v3_v3(efd->nor, ob->obmat[2]); + normalize_v3_v3(efd->nor, ob->object_to_world[2]); if (eff->pd && ELEM(eff->pd->shape, PFIELD_SHAPE_PLANE, PFIELD_SHAPE_LINE)) { float temp[3], translate[3]; - sub_v3_v3v3(temp, point->loc, ob->obmat[3]); + sub_v3_v3v3(temp, point->loc, ob->object_to_world[3]); project_v3_v3v3(translate, temp, efd->nor); /* for vortex the shape chooses between old / new force */ if (eff->pd->forcefield == PFIELD_VORTEX || eff->pd->shape == PFIELD_SHAPE_LINE) { - add_v3_v3v3(efd->loc, ob->obmat[3], translate); + add_v3_v3v3(efd->loc, ob->object_to_world[3], translate); } else { /* normally efd->loc is closest point on effector xy-plane */ sub_v3_v3v3(efd->loc, point->loc, translate); } } else { - copy_v3_v3(efd->loc, ob->obmat[3]); + copy_v3_v3(efd->loc, ob->object_to_world[3]); } zero_v3(efd->vel); @@ -801,8 +801,8 @@ bool get_effector_data(EffectorCache *eff, } else { /* for some effectors we need the object center every time */ - sub_v3_v3v3(efd->vec_to_point2, point->loc, eff->ob->obmat[3]); - normalize_v3_v3(efd->nor2, eff->ob->obmat[2]); + sub_v3_v3v3(efd->vec_to_point2, point->loc, eff->ob->object_to_world[3]); + normalize_v3_v3(efd->nor2, eff->ob->object_to_world[2]); } } diff --git a/source/blender/blenkernel/intern/fcurve_driver.c b/source/blender/blenkernel/intern/fcurve_driver.c index 9f63e2d3743..3d1439b5530 100644 --- a/source/blender/blenkernel/intern/fcurve_driver.c +++ b/source/blender/blenkernel/intern/fcurve_driver.c @@ -321,7 +321,7 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar) } else { /* Object. */ - mat[i] = ob->obmat; + mat[i] = ob->object_to_world; } } @@ -399,7 +399,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) else { /* Convert to world-space. */ copy_v3_v3(tmp_loc, pchan->pose_head); - mul_m4_v3(ob->obmat, tmp_loc); + mul_m4_v3(ob->object_to_world, tmp_loc); } } else { @@ -410,7 +410,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) float mat[4][4]; /* Extract transform just like how the constraints do it! */ - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); BKE_constraint_mat_convertspace( ob, NULL, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false); @@ -424,7 +424,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) } else { /* World-space. */ - copy_v3_v3(tmp_loc, ob->obmat[3]); + copy_v3_v3(tmp_loc, ob->object_to_world[3]); } } @@ -500,7 +500,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) } else { /* World-space matrix. */ - mul_m4_m4m4(mat, ob->obmat, pchan->pose_mat); + mul_m4_m4m4(mat, ob->object_to_world, pchan->pose_mat); } } else { @@ -514,7 +514,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) if (dtar->flag & DTAR_FLAG_LOCALSPACE) { if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) { /* Just like how the constraints do it! */ - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); BKE_constraint_mat_convertspace( ob, NULL, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false); } @@ -525,7 +525,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) } else { /* World-space matrix - just the good-old one. */ - copy_m4_m4(mat, ob->obmat); + copy_m4_m4(mat, ob->object_to_world); } } diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 5470231cd07..b0e99e10acc 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -433,7 +433,7 @@ static void manta_set_domain_from_mesh(FluidDomainSettings *fds, copy_v3_v3(fds->global_size, size); copy_v3_v3(fds->dp0, min); - invert_m4_m4(fds->imat, ob->obmat); + invert_m4_m4(fds->imat, ob->object_to_world); /* Prevent crash when initializing a plane as domain. */ if (!init_resolution || (size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || @@ -498,8 +498,8 @@ static bool fluid_modifier_init( zero_v3(fds->shift_f); add_v3_fl(fds->shift_f, 0.5f); zero_v3(fds->prev_loc); - mul_m4_v3(ob->obmat, fds->prev_loc); - copy_m4_m4(fds->obmat, ob->obmat); + mul_m4_v3(ob->object_to_world, fds->prev_loc); + copy_m4_m4(fds->obmat, ob->object_to_world); /* Set resolutions. */ if (fmd->domain->type == FLUID_DOMAIN_TYPE_GAS && @@ -566,11 +566,11 @@ static int get_light(Scene *scene, ViewLayer *view_layer, float *light) Light *la = base_tmp->object->data; if (la->type == LA_LOCAL) { - copy_v3_v3(light, base_tmp->object->obmat[3]); + copy_v3_v3(light, base_tmp->object->object_to_world[3]); return 1; } if (!found_light) { - copy_v3_v3(light, base_tmp->object->obmat[3]); + copy_v3_v3(light, base_tmp->object->object_to_world[3]); found_light = 1; } } @@ -1036,7 +1036,7 @@ static void obstacles_from_mesh(Object *coll_ob, float co[3]; /* Vertex position. */ - mul_m4_v3(coll_ob->obmat, verts[i].co); + mul_m4_v3(coll_ob->object_to_world, verts[i].co); manta_pos_to_cell(fds, verts[i].co); /* Vertex velocity. */ @@ -2099,11 +2099,11 @@ static void emit_from_mesh( float(*vert_normals)[3] = BKE_mesh_vertex_normals_for_write(me); for (i = 0; i < numverts; i++) { /* Vertex position. */ - mul_m4_v3(flow_ob->obmat, verts[i].co); + mul_m4_v3(flow_ob->object_to_world, verts[i].co); manta_pos_to_cell(fds, verts[i].co); /* Vertex normal. */ - mul_mat3_m4_v3(flow_ob->obmat, vert_normals[i]); + mul_mat3_m4_v3(flow_ob->object_to_world, vert_normals[i]); mul_mat3_m4_v3(fds->imat, vert_normals[i]); normalize_v3(vert_normals[i]); @@ -2121,7 +2121,7 @@ static void emit_from_mesh( /* Calculate emission map bounds. */ bb_boundInsert(bb, verts[i].co); } - mul_m4_v3(flow_ob->obmat, flow_center); + mul_m4_v3(flow_ob->object_to_world, flow_center); manta_pos_to_cell(fds, flow_center); /* Set emission map. @@ -2191,7 +2191,7 @@ static void adaptive_domain_adjust( float frame_shift_f[3]; float ob_loc[3] = {0}; - mul_m4_v3(ob->obmat, ob_loc); + mul_m4_v3(ob->object_to_world, ob_loc); sub_v3_v3v3(frame_shift_f, ob_loc, fds->prev_loc); copy_v3_v3(fds->prev_loc, ob_loc); @@ -3495,8 +3495,8 @@ static Mesh *create_smoke_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obje /* Calculate required shift to match domain's global position * it was originally simulated at (if object moves without manta step). */ - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->obmat, ob_loc); + invert_m4_m4(ob->imat, ob->object_to_world); + mul_m4_v3(ob->object_to_world, ob_loc); mul_m4_v3(fds->obmat, ob_cache_loc); sub_v3_v3v3(fds->obj_shift_f, ob_cache_loc, ob_loc); /* Convert shift to local space and apply to vertices. */ @@ -3525,8 +3525,8 @@ static int manta_step( bool mode_replay = (mode == FLUID_DOMAIN_CACHE_REPLAY); /* Update object state. */ - invert_m4_m4(fds->imat, ob->obmat); - copy_m4_m4(fds->obmat, ob->obmat); + invert_m4_m4(fds->imat, ob->object_to_world); + copy_m4_m4(fds->obmat, ob->object_to_world); /* Gas domain might use adaptive domain. */ if (fds->type == FLUID_DOMAIN_TYPE_GAS) { diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index e078991187d..2b36020b4e7 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -98,7 +98,7 @@ static void geometry_set_collect_recursive_collection(const Collection &collecti LISTBASE_FOREACH (const CollectionObject *, collection_object, &collection.gobject) { BLI_assert(collection_object->ob != nullptr); const Object &object = *collection_object->ob; - const float4x4 object_transform = transform * object.obmat; + const float4x4 object_transform = transform * object.object_to_world; geometry_set_collect_recursive_object(object, object_transform, r_sets); } LISTBASE_FOREACH (const CollectionChild *, collection_child, &collection.children) { @@ -220,7 +220,7 @@ void Instances::ensure_geometry_instances() Collection &collection = reference.collection(); FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (&collection, object) { const int handle = instances->add_reference(*object); - instances->add_instance(handle, object->obmat); + instances->add_instance(handle, object->object_to_world); float4x4 &transform = instances->transforms().last(); sub_v3_v3(transform.values[3], collection.instance_offset); } diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 45e56717d6a..666142e3a54 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -2691,7 +2691,7 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph, /* if not layer parented, try with object parented */ if (obparent_eval == NULL) { if ((ob_eval != NULL) && (ob_eval->type == OB_GPENCIL)) { - copy_m4_m4(diff_mat, ob_eval->obmat); + copy_m4_m4(diff_mat, ob_eval->object_to_world); mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat); return; } @@ -2701,8 +2701,8 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph, } if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) { - mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse); - add_v3_v3(diff_mat[3], ob_eval->obmat[3]); + mul_m4_m4m4(diff_mat, obparent_eval->object_to_world, gpl->inverse); + add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]); mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat); return; } @@ -2710,14 +2710,14 @@ void BKE_gpencil_layer_transform_matrix_get(const Depsgraph *depsgraph, bPoseChannel *pchan = BKE_pose_channel_find_name(obparent_eval->pose, gpl->parsubstr); if (pchan) { float tmp_mat[4][4]; - mul_m4_m4m4(tmp_mat, obparent_eval->obmat, pchan->pose_mat); + mul_m4_m4m4(tmp_mat, obparent_eval->object_to_world, pchan->pose_mat); mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse); - add_v3_v3(diff_mat[3], ob_eval->obmat[3]); + add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]); } else { /* if bone not found use object (armature) */ - mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse); - add_v3_v3(diff_mat[3], ob_eval->obmat[3]); + mul_m4_m4m4(diff_mat, obparent_eval->object_to_world, gpl->inverse); + add_v3_v3(diff_mat[3], ob_eval->object_to_world[3]); } mul_m4_m4m4(diff_mat, diff_mat, gpl->layer_mat); return; @@ -2771,12 +2771,12 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob) Object *ob_parent = DEG_get_evaluated_object(depsgraph, gpl->parent); /* calculate new matrix */ if (ELEM(gpl->partype, PAROBJECT, PARSKEL)) { - mul_m4_m4m4(cur_mat, ob->imat, ob_parent->obmat); + mul_m4_m4m4(cur_mat, ob->imat, ob_parent->object_to_world); } else if (gpl->partype == PARBONE) { bPoseChannel *pchan = BKE_pose_channel_find_name(ob_parent->pose, gpl->parsubstr); if (pchan != NULL) { - mul_m4_series(cur_mat, ob->imat, ob_parent->obmat, pchan->pose_mat); + mul_m4_series(cur_mat, ob->imat, ob_parent->object_to_world, pchan->pose_mat); } else { unit_m4(cur_mat); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index f6a409ee3f0..0adf162b4eb 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -355,10 +355,10 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) BKE_displist_free(<Ob->runtime.curve_cache->disp); } - copy_m4_m4(mat, ltOb->obmat); - unit_m4(ltOb->obmat); + copy_m4_m4(mat, ltOb->object_to_world); + unit_m4(ltOb->object_to_world); BKE_lattice_deform_coords(ltOb, NULL, vert_coords, uNew * vNew * wNew, 0, NULL, 1.0f); - copy_m4_m4(ltOb->obmat, mat); + copy_m4_m4(ltOb->object_to_world, mat); lt->typeu = typeu; lt->typev = typev; diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c index 3a1c42b9178..892889aa426 100644 --- a/source/blender/blenkernel/intern/lattice_deform.c +++ b/source/blender/blenkernel/intern/lattice_deform.c @@ -79,15 +79,15 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob /* for example with a particle system: (ob == NULL) */ if (ob == NULL) { /* In deform-space, calc matrix. */ - invert_m4_m4(latmat, oblatt->obmat); + invert_m4_m4(latmat, oblatt->object_to_world); /* back: put in deform array */ invert_m4_m4(imat, latmat); } else { /* In deform-space, calc matrix. */ - invert_m4_m4(imat, oblatt->obmat); - mul_m4_m4m4(latmat, imat, ob->obmat); + invert_m4_m4(imat, oblatt->object_to_world); + mul_m4_m4m4(latmat, imat, ob->object_to_world); /* back: put in deform array. */ invert_m4_m4(imat, latmat); diff --git a/source/blender/blenkernel/intern/mball_tessellate.cc b/source/blender/blenkernel/intern/mball_tessellate.cc index bb3713e770a..f8a64a7cd8b 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.cc +++ b/source/blender/blenkernel/intern/mball_tessellate.cc @@ -1188,8 +1188,9 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje const eEvaluationMode deg_eval_mode = DEG_get_mode(depsgraph); const short parenting_dupli_transflag = (OB_DUPLIFACES | OB_DUPLIVERTS); - copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ - invert_m4_m4(obinv, ob->obmat); + copy_m4_m4(obmat, + ob->object_to_world); /* to cope with duplicators from BKE_scene_base_iter_next */ + invert_m4_m4(obinv, ob->object_to_world); BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); @@ -1237,13 +1238,13 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje /* when metaball object has zero scale, then MetaElem to this MetaBall * will not be put to mainb array */ - if (has_zero_axis_m4(bob->obmat)) { + if (has_zero_axis_m4(bob->object_to_world)) { zero_size = 1; } else if (bob->parent) { struct Object *pob = bob->parent; while (pob) { - if (has_zero_axis_m4(pob->obmat)) { + if (has_zero_axis_m4(pob->object_to_world)) { zero_size = 1; break; } @@ -1307,7 +1308,7 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje * rotation -> * ml local space */ - mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->obmat, pos, rot); + mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->object_to_world, pos, rot); /* ml local space -> basis object space */ invert_m4_m4((float(*)[4])new_ml->imat, (float(*)[4])new_ml->mat); diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c index 261bc3d150b..ce3fc5d99c8 100644 --- a/source/blender/blenkernel/intern/mesh_mirror.c +++ b/source/blender/blenkernel/intern/mesh_mirror.c @@ -152,8 +152,8 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd, /* tmp is a transform from coords relative to the object's own origin, * to coords relative to the mirror object origin */ - invert_m4_m4(tmp, mirror_ob->obmat); - mul_m4_m4m4(tmp, tmp, ob->obmat); + invert_m4_m4(tmp, mirror_ob->object_to_world); + mul_m4_m4m4(tmp, tmp, ob->object_to_world); /* itmp is the reverse transform back to origin-relative coordinates */ invert_m4_m4(itmp, tmp); @@ -169,9 +169,9 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd, /* Account for non-uniform scale in `ob`, see: T87592. */ float ob_scale[3] = { - len_squared_v3(ob->obmat[0]), - len_squared_v3(ob->obmat[1]), - len_squared_v3(ob->obmat[2]), + len_squared_v3(ob->object_to_world[0]), + len_squared_v3(ob->object_to_world[1]), + len_squared_v3(ob->object_to_world[2]), }; /* Scale to avoid precision loss with extreme values. */ const float ob_scale_max = max_fff(UNPACK3(ob_scale)); diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index d98f5e85028..53e6d47860f 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -1330,14 +1330,14 @@ void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd) /* Calculate the world-space matrix for the pose-channel target first, * then carry on as usual. */ - mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat); + mul_m4_m4m4(mat, hmd->object->object_to_world, pchan->pose_mat); invert_m4_m4(imat, mat); - mul_m4_m4m4(hmd->parentinv, imat, ob->obmat); + mul_m4_m4m4(hmd->parentinv, imat, ob->object_to_world); } else { - invert_m4_m4(hmd->object->imat, hmd->object->obmat); - mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat); + invert_m4_m4(hmd->object->imat, hmd->object->object_to_world); + mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->object_to_world); } } } @@ -1355,14 +1355,14 @@ void BKE_object_modifier_gpencil_hook_reset(Object *ob, HookGpencilModifierData /* Calculate the world-space matrix for the pose-channel target first, * then carry on as usual. */ - mul_m4_m4m4(mat, hmd->object->obmat, pchan->pose_mat); + mul_m4_m4m4(mat, hmd->object->object_to_world, pchan->pose_mat); invert_m4_m4(imat, mat); - mul_m4_m4m4(hmd->parentinv, imat, ob->obmat); + mul_m4_m4m4(hmd->parentinv, imat, ob->object_to_world); } else { - invert_m4_m4(hmd->object->imat, hmd->object->obmat); - mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->obmat); + invert_m4_m4(hmd->object->imat, hmd->object->object_to_world); + mul_m4_m4m4(hmd->parentinv, hmd->object->imat, ob->object_to_world); } } @@ -3102,10 +3102,10 @@ void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]) BKE_object_get_parent_matrix(ob, ob->parent, par_imat); invert_m4(par_imat); - mul_m4_m4m4(r_mat, par_imat, ob->obmat); + mul_m4_m4m4(r_mat, par_imat, ob->object_to_world); } else { - copy_m4_m4(r_mat, ob->obmat); + copy_m4_m4(r_mat, ob->object_to_world); } } @@ -3359,32 +3359,32 @@ void BKE_object_get_parent_matrix(Object *ob, Object *par, float r_parentmat[4][ } if (ok) { - mul_m4_m4m4(r_parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->object_to_world, tmat); } else { - copy_m4_m4(r_parentmat, par->obmat); + copy_m4_m4(r_parentmat, par->object_to_world); } break; } case PARBONE: ob_parbone(ob, par, tmat); - mul_m4_m4m4(r_parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->object_to_world, tmat); break; case PARVERT1: unit_m4(r_parentmat); give_parvert(par, ob->par1, vec); - mul_v3_m4v3(r_parentmat[3], par->obmat, vec); + mul_v3_m4v3(r_parentmat[3], par->object_to_world, vec); break; case PARVERT3: ob_parvert3(ob, par, tmat); - mul_m4_m4m4(r_parentmat, par->obmat, tmat); + mul_m4_m4m4(r_parentmat, par->object_to_world, tmat); break; case PARSKEL: - copy_m4_m4(r_parentmat, par->obmat); + copy_m4_m4(r_parentmat, par->object_to_world); break; } } @@ -3422,7 +3422,7 @@ static void solve_parenting( /* origin, for help line */ if (set_origin) { if ((ob->partype & PARTYPE) == PARSKEL) { - copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]); + copy_v3_v3(ob->runtime.parent_display_origin, par->object_to_world[3]); } else { copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]); @@ -3441,10 +3441,10 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph, Object *par = ob->parent; /* calculate parent matrix */ - solve_parenting(ob, par, true, ob->obmat, r_originmat); + solve_parenting(ob, par, true, ob->object_to_world, r_originmat); } else { - BKE_object_to_mat4(ob, ob->obmat); + BKE_object_to_mat4(ob, ob->object_to_world); } /* try to fall back to the scene rigid body world if none given */ @@ -3461,7 +3461,7 @@ static void object_where_is_calc_ex(Depsgraph *depsgraph, } /* set negative scale flag in object */ - if (is_negative_m4(ob->obmat)) { + if (is_negative_m4(ob->object_to_world)) { ob->transflag |= OB_NEG_SCALE; } else { @@ -3507,7 +3507,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o { BKE_object_workob_clear(workob); - unit_m4(workob->obmat); + unit_m4(workob->object_to_world); unit_m4(workob->parentinv); unit_m4(workob->constinv); @@ -3599,7 +3599,7 @@ void BKE_object_apply_parent_inverse(struct Object *ob) * `inv(parent) @ world = parentinv` * `parentinv = inv(parent) @ world` * - * NOTE: If `ob->obmat` has shear, then this `parentinv` is insufficient because + * NOTE: If `ob->object_to_world` has shear, then this `parentinv` is insufficient because * `parent @ parentinv => shearless result` * * Thus, local will have shear which cannot be decomposed into TRS: @@ -3628,7 +3628,7 @@ void BKE_object_apply_parent_inverse(struct Object *ob) copy_m4_m4(ob_local, ob->parentinv); invert_m4(ob_local); mul_m4_m4_post(ob_local, par_imat); - mul_m4_m4_post(ob_local, ob->obmat); + mul_m4_m4_post(ob_local, ob->object_to_world); /* Send use_compat=False so the rotation is predictable. */ BKE_object_apply_mat4(ob, ob_local, false, false); @@ -3793,7 +3793,7 @@ void BKE_object_dimensions_get(Object *ob, float r_vec[3]) const BoundBox *bb = BKE_object_boundbox_get(ob); if (bb) { float3 scale; - mat4_to_size(scale, ob->obmat); + mat4_to_size(scale, ob->object_to_world); r_vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); r_vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); @@ -3850,19 +3850,19 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us case OB_FONT: case OB_SURF: { const BoundBox bb = *BKE_curve_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } case OB_MESH: { const BoundBox bb = *BKE_mesh_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } case OB_GPENCIL: { const BoundBox bb = *BKE_gpencil_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } @@ -3875,7 +3875,7 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us for (v = 0; v < lt->pntsv; v++) { for (u = 0; u < lt->pntsu; u++, bp++) { float3 vec; - mul_v3_m4v3(vec, ob->obmat, bp->vec); + mul_v3_m4v3(vec, ob->object_to_world, bp->vec); minmax_v3v3_v3(r_min, r_max, vec); } } @@ -3890,7 +3890,8 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us case OB_MBALL: { float ob_min[3], ob_max[3]; - changed = BKE_mball_minmax_ex((const MetaBall *)ob->data, ob_min, ob_max, ob->obmat, 0); + changed = BKE_mball_minmax_ex( + (const MetaBall *)ob->data, ob_min, ob_max, ob->object_to_world, 0); if (changed) { minmax_v3v3_v3(r_min, r_max, ob_min); minmax_v3v3_v3(r_min, r_max, ob_max); @@ -3899,20 +3900,20 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us } case OB_CURVES: { const BoundBox bb = *BKE_curves_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } case OB_POINTCLOUD: { const BoundBox bb = *BKE_pointcloud_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } case OB_VOLUME: { const BoundBox bb = *BKE_volume_boundbox_get(ob); - BKE_boundbox_minmax(&bb, ob->obmat, r_min, r_max); + BKE_boundbox_minmax(&bb, ob->object_to_world, r_min, r_max); changed = true; break; } @@ -3926,14 +3927,14 @@ void BKE_object_minmax(Object *ob, float r_min[3], float r_max[3], const bool us size *= ob->empty_drawsize; } - minmax_v3v3_v3(r_min, r_max, ob->obmat[3]); + minmax_v3v3_v3(r_min, r_max, ob->object_to_world[3]); float3 vec; - copy_v3_v3(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->object_to_world[3]); add_v3_v3(vec, size); minmax_v3v3_v3(r_min, r_max, vec); - copy_v3_v3(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->object_to_world[3]); sub_v3_v3(vec, size); minmax_v3v3_v3(r_min, r_max, vec); } @@ -3980,12 +3981,12 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re * however the issue with empty objects being visible when viewed from the side * is only noticeable in orthographic views. */ float3 view_dir; - sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->obmat[3]); - dot = dot_v3v3(ob->obmat[2], view_dir); + sub_v3_v3v3(view_dir, rv3d->viewinv[3], ob->object_to_world[3]); + dot = dot_v3v3(ob->object_to_world[2], view_dir); eps = 0.0f; } else { - dot = dot_v3v3(ob->obmat[2], rv3d->viewinv[2]); + dot = dot_v3v3(ob->object_to_world[2], rv3d->viewinv[2]); eps = 1e-5f; } if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) { @@ -4002,7 +4003,7 @@ bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const Re if (visibility_flag & OB_EMPTY_IMAGE_HIDE_NON_AXIS_ALIGNED) { float3 proj, ob_z_axis; - normalize_v3_v3(ob_z_axis, ob->obmat[2]); + normalize_v3_v3(ob_z_axis, ob->object_to_world[2]); project_plane_v3_v3v3(proj, ob_z_axis, rv3d->viewinv[2]); const float proj_length_sq = len_squared_v3(proj); if (proj_length_sq > 1e-5f) { @@ -4194,7 +4195,7 @@ void BKE_scene_foreach_display_point(Depsgraph *depsgraph, DEG_ITER_OBJECT_FLAG_DUPLI; DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { if ((ob->base_flag & BASE_SELECTED) != 0) { - BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data); + BKE_object_foreach_display_point(ob, ob->object_to_world, func_cb, user_data); } } DEG_OBJECT_ITER_END; @@ -4237,7 +4238,7 @@ void *BKE_object_tfm_backup(Object *ob) copy_v3_v3(obtfm->drotAxis, ob->drotAxis); obtfm->rotAngle = ob->rotAngle; obtfm->drotAngle = ob->drotAngle; - copy_m4_m4(obtfm->obmat, ob->obmat); + copy_m4_m4(obtfm->obmat, ob->object_to_world); copy_m4_m4(obtfm->parentinv, ob->parentinv); copy_m4_m4(obtfm->constinv, ob->constinv); copy_m4_m4(obtfm->imat, ob->imat); @@ -4260,7 +4261,7 @@ void BKE_object_tfm_restore(Object *ob, void *obtfm_pt) copy_v3_v3(ob->drotAxis, obtfm->drotAxis); ob->rotAngle = obtfm->rotAngle; ob->drotAngle = obtfm->drotAngle; - copy_m4_m4(ob->obmat, obtfm->obmat); + copy_m4_m4(ob->object_to_world, obtfm->obmat); copy_m4_m4(ob->parentinv, obtfm->parentinv); copy_m4_m4(ob->constinv, obtfm->constinv); copy_m4_m4(ob->imat, obtfm->imat); @@ -5291,7 +5292,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) for (i = 0; i < verts.size(); i++) { if (index[i] != ORIGINDEX_NONE) { float co[3]; - mul_v3_m4v3(co, ob->obmat, verts[i].co); + mul_v3_m4v3(co, ob->object_to_world, verts[i].co); BLI_kdtree_3d_insert(tree, index[i], co); tot++; } @@ -5305,7 +5306,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) for (i = 0; i < tot; i++) { float co[3]; - mul_v3_m4v3(co, ob->obmat, verts[i].co); + mul_v3_m4v3(co, ob->object_to_world, verts[i].co); BLI_kdtree_3d_insert(tree, i, co); } } @@ -5334,7 +5335,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) a = nu->pntsu; while (a--) { float co[3]; - mul_v3_m4v3(co, ob->obmat, bezt->vec[1]); + mul_v3_m4v3(co, ob->object_to_world, bezt->vec[1]); BLI_kdtree_3d_insert(tree, i++, co); bezt++; } @@ -5346,7 +5347,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) a = nu->pntsu * nu->pntsv; while (a--) { float co[3]; - mul_v3_m4v3(co, ob->obmat, bp->vec); + mul_v3_m4v3(co, ob->object_to_world, bp->vec); BLI_kdtree_3d_insert(tree, i++, co); bp++; } @@ -5369,7 +5370,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot) for (bp = lt->def; i < tot; bp++) { float co[3]; - mul_v3_m4v3(co, ob->obmat, bp->vec); + mul_v3_m4v3(co, ob->object_to_world, bp->vec); BLI_kdtree_3d_insert(tree, i++, co); } diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index d43eff6f9b4..d029d307d6e 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -197,7 +197,8 @@ static bool copy_dupli_context(DupliContext *r_ctx, /** * Generate a dupli instance. * - * \param mat: is transform of the object relative to current context (including #Object.obmat). + * \param mat: is transform of the object relative to current context (including + * #Object.object_to_world). */ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, @@ -296,7 +297,7 @@ static DupliObject *make_dupli(const DupliContext *ctx, /** * Recursive dupli-objects. * - * \param space_mat: is the local dupli-space (excluding dupli #Object.obmat). + * \param space_mat: is the local dupli-space (excluding dupli #Object.object_to_world). */ static void make_recursive_duplis(const DupliContext *ctx, Object *ob, @@ -468,8 +469,8 @@ static void make_duplis_collection(const DupliContext *ctx) /* Combine collection offset and `obmat`. */ unit_m4(collection_mat); sub_v3_v3(collection_mat[3], collection->instance_offset); - mul_m4_m4m4(collection_mat, ob->obmat, collection_mat); - /* Don't access 'ob->obmat' from now on. */ + mul_m4_m4m4(collection_mat, ob->object_to_world, collection_mat); + /* Don't access 'ob->object_to_world' from now on. */ eEvaluationMode mode = DEG_get_mode(ctx->depsgraph); FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (collection, cob, mode) { @@ -477,7 +478,7 @@ static void make_duplis_collection(const DupliContext *ctx) float mat[4][4]; /* Collection dupli-offset, should apply after everything else. */ - mul_m4_m4m4(mat, collection_mat, cob->obmat); + mul_m4_m4m4(mat, collection_mat, cob->object_to_world); make_dupli(ctx, cob, mat, _base_id); @@ -584,7 +585,7 @@ static DupliObject *vertex_dupli(const DupliContext *ctx, /* Make offset relative to inst_ob using relative child transform. */ mul_mat3_m4_v3(child_imat, obmat[3]); /* Apply `obmat` _after_ the local vertex transform. */ - mul_m4_m4m4(obmat, inst_ob->obmat, obmat); + mul_m4_m4m4(obmat, inst_ob->object_to_world, obmat); /* Space matrix is constructed by removing `obmat` transform, * this yields the world-space transform for recursive duplis. */ @@ -608,10 +609,10 @@ static void make_child_duplis_verts_from_mesh(const DupliContext *ctx, const MVert *mvert = vdd->mvert; const int totvert = vdd->totvert; - invert_m4_m4(inst_ob->imat, inst_ob->obmat); + invert_m4_m4(inst_ob->imat, inst_ob->object_to_world); /* Relative transform from parent to child space. */ float child_imat[4][4]; - mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->object_to_world); for (int i = 0; i < totvert; i++) { DupliObject *dob = vertex_dupli( @@ -630,10 +631,10 @@ static void make_child_duplis_verts_from_editmesh(const DupliContext *ctx, BMEditMesh *em = vdd->em; const bool use_rotation = vdd->params.use_rotation; - invert_m4_m4(inst_ob->imat, inst_ob->obmat); + invert_m4_m4(inst_ob->imat, inst_ob->object_to_world); /* Relative transform from parent to child space. */ float child_imat[4][4]; - mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->object_to_world); BMVert *v; BMIter iter; @@ -758,7 +759,7 @@ static void make_duplis_font(const DupliContext *ctx) return; } - copy_m4_m4(pmat, par->obmat); + copy_m4_m4(pmat, par->object_to_world); /* In `par` the family name is stored, use this to find the other objects. */ @@ -803,7 +804,7 @@ static void make_duplis_font(const DupliContext *ctx) mul_m4_v3(pmat, vec); - copy_m4_m4(obmat, par->obmat); + copy_m4_m4(obmat, par->object_to_world); if (UNLIKELY(ct->rot != 0.0f)) { float rmat[4][4]; @@ -951,7 +952,7 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx, } float instance_matrix[4][4]; - mul_m4_m4m4(instance_matrix, collection_matrix, object->obmat); + mul_m4_m4m4(instance_matrix, collection_matrix, object->object_to_world); make_dupli(&sub_ctx, object, instance_matrix, object_id++); make_recursive_duplis(&sub_ctx, object, collection_matrix, object_id++); @@ -986,7 +987,7 @@ static void make_duplis_geometry_set_impl(const DupliContext *ctx, static void make_duplis_geometry_set(const DupliContext *ctx) { const GeometrySet *geometry_set = ctx->object->runtime.geometry_set_eval; - make_duplis_geometry_set_impl(ctx, *geometry_set, ctx->object->obmat, false, false); + make_duplis_geometry_set_impl(ctx, *geometry_set, ctx->object->object_to_world, false, false); } static const DupliGenerator gen_dupli_geometry_set = { @@ -1092,7 +1093,7 @@ static DupliObject *face_dupli(const DupliContext *ctx, } /* Apply `obmat` _after_ the local face transform. */ - mul_m4_m4m4(obmat, inst_ob->obmat, obmat); + mul_m4_m4m4(obmat, inst_ob->object_to_world, obmat); /* Space matrix is constructed by removing `obmat` transform, * this yields the world-space transform for recursive duplis. */ @@ -1176,9 +1177,9 @@ static void make_child_duplis_faces_from_mesh(const DupliContext *ctx, float child_imat[4][4]; - invert_m4_m4(inst_ob->imat, inst_ob->obmat); + invert_m4_m4(inst_ob->imat, inst_ob->object_to_world); /* Relative transform from parent to child space. */ - mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->object_to_world); const float scale_fac = ctx->object->instance_faces_scale; for (a = 0, mp = mpoly; a < totface; a++, mp++) { @@ -1216,9 +1217,9 @@ static void make_child_duplis_faces_from_editmesh(const DupliContext *ctx, BLI_assert((vert_coords == nullptr) || (em->bm->elem_index_dirty & BM_VERT) == 0); - invert_m4_m4(inst_ob->imat, inst_ob->obmat); + invert_m4_m4(inst_ob->imat, inst_ob->object_to_world); /* Relative transform from parent to child space. */ - mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->obmat); + mul_m4_m4m4(child_imat, inst_ob->imat, ctx->object->object_to_world); const float scale_fac = ctx->object->instance_faces_scale; BM_ITER_MESH_INDEX (f, &iter, em->bm, BM_FACES_OF_MESH, a) { @@ -1348,7 +1349,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem sim.psys = psys; sim.psmd = psys_get_modifier(par, psys); /* Make sure emitter `imat` is in global coordinates instead of render view coordinates. */ - invert_m4_m4(par->imat, par->obmat); + invert_m4_m4(par->imat, par->object_to_world); /* First check for loops (particle system object used as dupli-object). */ if (part->ren_as == PART_DRAW_OB) { @@ -1535,7 +1536,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem b = 0; FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN ( part->instance_collection, object, mode) { - copy_m4_m4(tmat, oblist[b]->obmat); + copy_m4_m4(tmat, oblist[b]->object_to_world); /* Apply collection instance offset. */ sub_v3_v3(tmat[3], part->instance_collection->instance_offset); @@ -1558,7 +1559,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem } else { float obmat[4][4]; - copy_m4_m4(obmat, ob->obmat); + copy_m4_m4(obmat, ob->object_to_world); float vec[3]; copy_v3_v3(vec, obmat[3]); @@ -1752,7 +1753,7 @@ ListBase *object_duplilist_preview(Depsgraph *depsgraph, *viewer_path)) { ctx.preview_base_geometry = &viewer_log->geometry; make_duplis_geometry_set_impl( - &ctx, viewer_log->geometry, ob_eval->obmat, true, ob_eval->type == OB_CURVES); + &ctx, viewer_log->geometry, ob_eval->object_to_world, true, ob_eval->type == OB_CURVES); } } return duplilist; diff --git a/source/blender/blenkernel/intern/object_update.cc b/source/blender/blenkernel/intern/object_update.cc index e53090bcffe..7ea13bfcc84 100644 --- a/source/blender/blenkernel/intern/object_update.cc +++ b/source/blender/blenkernel/intern/object_update.cc @@ -61,7 +61,7 @@ void BKE_object_eval_local_transform(Depsgraph *depsgraph, Object *ob) DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* calculate local matrix */ - BKE_object_to_mat4(ob, ob->obmat); + BKE_object_to_mat4(ob, ob->object_to_world); } void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob) @@ -78,18 +78,18 @@ void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob) /* get local matrix (but don't calculate it, as that was done already!) */ /* XXX: redundant? */ - copy_m4_m4(locmat, ob->obmat); + copy_m4_m4(locmat, ob->object_to_world); /* get parent effect matrix */ BKE_object_get_parent_matrix(ob, par, totmat); /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); - mul_m4_m4m4(ob->obmat, tmat, locmat); + mul_m4_m4m4(ob->object_to_world, tmat, locmat); /* origin, for help line */ if ((ob->partype & PARTYPE) == PARSKEL) { - copy_v3_v3(ob->runtime.parent_display_origin, par->obmat[3]); + copy_v3_v3(ob->runtime.parent_display_origin, par->object_to_world[3]); } else { copy_v3_v3(ob->runtime.parent_display_origin, totmat[3]); @@ -121,9 +121,9 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob) DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); /* Make sure inverse matrix is always up to date. This way users of it * do not need to worry about recalculating it. */ - invert_m4_m4_safe(ob->imat, ob->obmat); + invert_m4_m4_safe(ob->imat, ob->object_to_world); /* Set negative scale flag in object. */ - if (is_negative_m4(ob->obmat)) { + if (is_negative_m4(ob->object_to_world)) { ob->transflag |= OB_NEG_SCALE; } else { @@ -257,7 +257,7 @@ void BKE_object_sync_to_original(Depsgraph *depsgraph, Object *object) /* Base flags. */ object_orig->base_flag = object->base_flag; /* Transformation flags. */ - copy_m4_m4(object_orig->obmat, object->obmat); + copy_m4_m4(object_orig->object_to_world, object->object_to_world); copy_m4_m4(object_orig->imat, object->imat); copy_m4_m4(object_orig->constinv, object->constinv); object_orig->transflag = object->transflag; diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 965cd153d00..a39e53662aa 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -1201,7 +1201,7 @@ void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3]) mul_v3_v3fl(stroke, ups->average_stroke_accum, fac); } else { - copy_v3_v3(stroke, ob->obmat[3]); + copy_v3_v3(stroke, ob->object_to_world[3]); } } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d6dd3cf0dbb..f111e2dde17 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2370,8 +2370,8 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors) 0, 0); - mul_m4_v3(sim->ob->obmat, state.co); - mul_mat3_m4_v3(sim->ob->obmat, state.vel); + mul_m4_v3(sim->ob->object_to_world, state.co); + mul_mat3_m4_v3(sim->ob->object_to_world, state.vel); pd_point_from_particle(sim, pa, &state, &point); @@ -2454,8 +2454,8 @@ bool do_guides(Depsgraph *depsgraph, } } - mul_m4_v3(eff->ob->obmat, guidevec); - mul_mat3_m4_v3(eff->ob->obmat, guidedir); + mul_m4_v3(eff->ob->object_to_world, guidevec); + mul_mat3_m4_v3(eff->ob->object_to_world, guidedir); normalize_v3(guidedir); @@ -2956,7 +2956,7 @@ static void psys_thread_create_path(ParticleTask *task, psys_particle_on_emitter( ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa->fuv, foffset, co, 0, 0, 0, orco); - mul_m4_v3(ob->obmat, co); + mul_m4_v3(ob->object_to_world, co); for (w = 0; w < 4; w++) { sub_v3_v3v3(off1[w], co, key[w]->co); @@ -3419,7 +3419,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re /* dynamic hair is in object space */ /* keyed and baked are already in global space */ if (hair_mesh) { - mul_m4_v3(sim->ob->obmat, ca->co); + mul_m4_v3(sim->ob->object_to_world, ca->co); } else if (!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR)) { mul_m4_v3(hairmat, ca->co); @@ -3929,7 +3929,7 @@ void psys_mat_hair_to_global( psys_mat_hair_to_object(ob, mesh, from, pa, facemat); - mul_m4_m4m4(hairmat, ob->obmat, facemat); + mul_m4_m4m4(hairmat, ob->object_to_world, facemat); } /************************************************/ @@ -4661,8 +4661,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, do_particle_interpolation(psys, p, pa, t, &pind, state); if (pind.mesh) { - mul_m4_v3(sim->ob->obmat, state->co); - mul_mat3_m4_v3(sim->ob->obmat, state->vel); + mul_m4_v3(sim->ob->object_to_world, state->co); + mul_mat3_m4_v3(sim->ob->object_to_world, state->vel); } else if (!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) { if ((pa->flag & PARS_REKEY) == 0) { @@ -4685,7 +4685,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, } } else if (totchild) { - // invert_m4_m4(imat, ob->obmat); + // invert_m4_m4(imat, ob->object_to_world); /* interpolate childcache directly if it exists */ if (psys->childcache) { @@ -4733,7 +4733,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, * positioning it accurately to the surface of the emitter. */ // copy_v3_v3(cpa_1st, co); - // mul_m4_v3(ob->obmat, cpa_1st); + // mul_m4_v3(ob->object_to_world, cpa_1st); pa = psys->particles + cpa->parent; diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index a890812cfc4..6cc7dbc70d0 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -187,7 +187,7 @@ static void do_kink_spiral(ParticleThreadContext *ctx, zero_v3(kink_base); kink_base[part->kink_axis] = 1.0f; - mul_mat3_m4_v3(ctx->sim.ob->obmat, kink_base); + mul_mat3_m4_v3(ctx->sim.ob->object_to_world, kink_base); /* Fill in invariant part of modifier context. */ ParticleChildModifierContext modifier_ctx = {NULL}; @@ -873,7 +873,7 @@ void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, part->kink_flat, part->kink, part->kink_axis, - sim->ob->obmat, + sim->ob->object_to_world, smooth_start); } } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index c72bbe2fd08..72733349087 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -750,10 +750,10 @@ void psys_get_birth_coords( /* particles live in global space so */ /* let's convert: */ /* -location */ - mul_m4_v3(ob->obmat, loc); + mul_m4_v3(ob->object_to_world, loc); /* -normal */ - mul_mat3_m4_v3(ob->obmat, nor); + mul_mat3_m4_v3(ob->object_to_world, nor); normalize_v3(nor); /* -tangent */ @@ -771,7 +771,7 @@ void psys_get_birth_coords( fac = -sinf((float)M_PI * (part->tanphase + phase)); madd_v3_v3fl(vtan, utan, fac); - mul_mat3_m4_v3(ob->obmat, vtan); + mul_mat3_m4_v3(ob->object_to_world, vtan); copy_v3_v3(utan, nor); mul_v3_fl(utan, dot_v3v3(vtan, nor)); @@ -786,7 +786,7 @@ void psys_get_birth_coords( r_vel[1] = 2.0f * (psys_frand(psys, p + 11) - 0.5f); r_vel[2] = 2.0f * (psys_frand(psys, p + 12) - 0.5f); - mul_mat3_m4_v3(ob->obmat, r_vel); + mul_mat3_m4_v3(ob->object_to_world, r_vel); normalize_v3(r_vel); } @@ -796,7 +796,7 @@ void psys_get_birth_coords( r_ave[1] = 2.0f * (psys_frand(psys, p + 14) - 0.5f); r_ave[2] = 2.0f * (psys_frand(psys, p + 15) - 0.5f); - mul_mat3_m4_v3(ob->obmat, r_ave); + mul_mat3_m4_v3(ob->object_to_world, r_ave); normalize_v3(r_ave); } @@ -808,7 +808,7 @@ void psys_get_birth_coords( r_rot[3] = 2.0f * (psys_frand(psys, p + 19) - 0.5f); normalize_qt(r_rot); - mat4_to_quat(rot, ob->obmat); + mat4_to_quat(rot, ob->object_to_world); mul_qt_qtqt(r_rot, r_rot, rot); } @@ -822,7 +822,7 @@ void psys_get_birth_coords( /* boids store direction in ave */ if (fabsf(nor[2]) == 1.0f) { - sub_v3_v3v3(state->ave, loc, ob->obmat[3]); + sub_v3_v3v3(state->ave, loc, ob->object_to_world[3]); normalize_v3(state->ave); } else { @@ -868,15 +868,15 @@ void psys_get_birth_coords( /* *emitter object orientation */ if (part->ob_vel[0] != 0.0f) { - normalize_v3_v3(vec, ob->obmat[0]); + normalize_v3_v3(vec, ob->object_to_world[0]); madd_v3_v3fl(vel, vec, part->ob_vel[0]); } if (part->ob_vel[1] != 0.0f) { - normalize_v3_v3(vec, ob->obmat[1]); + normalize_v3_v3(vec, ob->object_to_world[1]); madd_v3_v3fl(vel, vec, part->ob_vel[1]); } if (part->ob_vel[2] != 0.0f) { - normalize_v3_v3(vec, ob->obmat[2]); + normalize_v3_v3(vec, ob->object_to_world[2]); madd_v3_v3fl(vel, vec, part->ob_vel[2]); } @@ -924,7 +924,7 @@ void psys_get_birth_coords( case PART_ROT_OB_X: case PART_ROT_OB_Y: case PART_ROT_OB_Z: - copy_v3_v3(rot_vec, ob->obmat[part->rotmode - PART_ROT_OB_X]); + copy_v3_v3(rot_vec, ob->object_to_world[part->rotmode - PART_ROT_OB_X]); use_global_space = false; break; default: @@ -951,7 +951,7 @@ void psys_get_birth_coords( float q_obmat[4]; float q_imat[4]; - mat4_to_quat(q_obmat, ob->obmat); + mat4_to_quat(q_obmat, ob->object_to_world); invert_qt_qt_normalized(q_imat, q_obmat); if (part->rotmode != PART_ROT_NOR_TAN) { @@ -3364,7 +3364,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, use_hair = psys_hair_use_simulation(pa, max_length); psys_mat_hair_to_object(sim->ob, sim->psmd->mesh_final, psys->part->from, pa, hairmat); - mul_m4_m4m4(root_mat, sim->ob->obmat, hairmat); + mul_m4_m4m4(root_mat, sim->ob->object_to_world, hairmat); normalize_m4(root_mat); bending_stiffness = CLAMPIS( @@ -3555,7 +3555,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) HairKey *key, *root; PARTICLE_P; - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); psys->lattice_deform_data = psys_create_lattice_deform_data(sim); @@ -4380,7 +4380,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, mul_v3_v3(pa->state.co, scaleAbs); /* Match domain scale. */ - mul_m4_v3(ob->obmat, pa->state.co); + mul_m4_v3(ob->object_to_world, pa->state.co); /* Add origin offset to particle position. */ zero_v3(tmp); @@ -4963,7 +4963,7 @@ void particle_system_update(struct Depsgraph *depsgraph, /* Save matrix for duplicators, * at render-time the actual dupli-object's matrix is used so don't update! */ - invert_m4_m4(psys->imat, ob->obmat); + invert_m4_m4(psys->imat, ob->object_to_world); BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL); } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index ffc6bc8d7a3..a67bb8568c3 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -684,7 +684,7 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol) if (totvert > 0 && tottri > 0) { BKE_mesh_calc_volume(mvert, totvert, lt, tottri, mloop, &volume, NULL); - const float volume_scale = mat4_to_volume_scale(ob->obmat); + const float volume_scale = mat4_to_volume_scale(ob->object_to_world); volume *= fabsf(volume_scale); } } @@ -809,7 +809,7 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool return; } - mat4_to_loc_quat(loc, rot, ob->obmat); + mat4_to_loc_quat(loc, rot, ob->object_to_world); rbo->shared->physics_object = RB_body_new(rbo->shared->physics_shape, loc, rot); @@ -974,7 +974,7 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b rbc->physics_constraint = NULL; } - mat4_to_loc_quat(loc, rot, ob->obmat); + mat4_to_loc_quat(loc, rot, ob->object_to_world); if (rb1 && rb2) { switch (rbc->type) { @@ -1266,7 +1266,7 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type) rbo->mesh_source = RBO_MESH_DEFORM; /* set initial transform */ - mat4_to_loc_quat(rbo->pos, rbo->orn, ob->obmat); + mat4_to_loc_quat(rbo->pos, rbo->orn, ob->object_to_world); /* flag cache as outdated */ BKE_rigidbody_cache_reset(rbw); @@ -1689,7 +1689,7 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Object *ob, RigidBodyO if (!(rbo->flag & RBO_FLAG_KINEMATIC)) { /* update scale for all non kinematic objects */ float new_scale[3], old_scale[3]; - mat4_to_size(new_scale, ob->obmat); + mat4_to_size(new_scale, ob->object_to_world); RB_body_get_scale(rbo->shared->physics_object, old_scale); /* Avoid updating collision shape AABBs if scale didn't change. */ @@ -1886,7 +1886,7 @@ static ListBase rigidbody_create_substep_data(RigidBodyWorld *rbw) copy_v4_v4(data->old_rot, rot); copy_v3_v3(data->old_scale, scale); - mat4_decompose(loc, rot, scale, ob->obmat); + mat4_decompose(loc, rot, scale, ob->object_to_world); copy_v3_v3(data->new_pos, loc); copy_v4_v4(data->new_rot, rot); @@ -2055,15 +2055,15 @@ void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime) quat_to_mat4(mat, rbo->orn); copy_v3_v3(mat[3], rbo->pos); - mat4_to_size(size, ob->obmat); + mat4_to_size(size, ob->object_to_world); size_to_mat4(size_mat, size); mul_m4_m4m4(mat, mat, size_mat); - copy_m4_m4(ob->obmat, mat); + copy_m4_m4(ob->object_to_world, mat); } /* otherwise set rigid body transform to current obmat */ else { - mat4_to_loc_quat(rbo->pos, rbo->orn, ob->obmat); + mat4_to_loc_quat(rbo->pos, rbo->orn, ob->object_to_world); } } diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index bd26075f81f..c921cf603de 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -2278,13 +2278,13 @@ int BKE_scene_base_iter_next( if (iter->dupli_refob != *ob) { if (iter->dupli_refob) { /* Restore previous object's real matrix. */ - copy_m4_m4(iter->dupli_refob->obmat, iter->omat); + copy_m4_m4(iter->dupli_refob->object_to_world, iter->omat); } /* Backup new object's real matrix. */ iter->dupli_refob = *ob; - copy_m4_m4(iter->omat, iter->dupli_refob->obmat); + copy_m4_m4(iter->omat, iter->dupli_refob->object_to_world); } - copy_m4_m4((*ob)->obmat, iter->dupob->mat); + copy_m4_m4((*ob)->object_to_world, iter->dupob->mat); iter->dupob = iter->dupob->next; } @@ -2294,7 +2294,7 @@ int BKE_scene_base_iter_next( if (iter->dupli_refob) { /* Restore last object's real matrix. */ - copy_m4_m4(iter->dupli_refob->obmat, iter->omat); + copy_m4_m4(iter->dupli_refob->object_to_world, iter->omat); iter->dupli_refob = nullptr; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index b35031b9a88..be033f495c7 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2644,7 +2644,7 @@ static void springs_from_mesh(Object *ob) bp = ob->soft->bpoint; for (a = 0; a < me->totvert; a++, bp++) { copy_v3_v3(bp->origS, verts[a].co); - mul_m4_v3(ob->obmat, bp->origS); + mul_m4_v3(ob->object_to_world, bp->origS); } } /* recalculate spring length for meshes here */ @@ -2809,9 +2809,9 @@ static float globallen(float *v1, float *v2, Object *ob) { float p1[3], p2[3]; copy_v3_v3(p1, v1); - mul_m4_v3(ob->obmat, p1); + mul_m4_v3(ob->object_to_world, p1); copy_v3_v3(p2, v2); - mul_m4_v3(ob->obmat, p2); + mul_m4_v3(ob->object_to_world, p2); return len_v3v3(p1, p2); } @@ -3073,7 +3073,7 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts, SB_estimate_transform(ob, sb->lcom, sb->lrot, sb->lscale); } /* Inverse matrix is not up to date. */ - invert_m4_m4(ob->imat, ob->obmat); + invert_m4_m4(ob->imat, ob->object_to_world); for (a = 0; a < numVerts; a++, bp++) { copy_v3_v3(vertexCos[a], bp->pos); @@ -3223,7 +3223,7 @@ static void softbody_update_positions(Object *ob, /* copy the position of the goals at desired end time */ copy_v3_v3(bp->origE, vertexCos[a]); /* vertexCos came from local world, go global */ - mul_m4_v3(ob->obmat, bp->origE); + mul_m4_v3(ob->object_to_world, bp->origE); /* just to be save give bp->origT a defined value * will be calculated in interpolate_exciter() */ copy_v3_v3(bp->origT, bp->origE); @@ -3279,7 +3279,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int for (a = 0, bp = sb->bpoint; a < numVerts; a++, bp++) { copy_v3_v3(bp->pos, vertexCos[a]); - mul_m4_v3(ob->obmat, bp->pos); /* Yep, soft-body is global coords. */ + mul_m4_v3(ob->object_to_world, bp->pos); /* Yep, soft-body is global coords. */ copy_v3_v3(bp->origS, bp->pos); copy_v3_v3(bp->origE, bp->pos); copy_v3_v3(bp->origT, bp->pos); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index d08fba0e657..1aef42ef037 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -1129,9 +1129,9 @@ static void sound_update_base(Scene *scene, Object *object, void *new_set) AUD_SequenceEntry_setConeAngleInner(strip->speaker_handle, speaker->cone_angle_inner); AUD_SequenceEntry_setConeVolumeOuter(strip->speaker_handle, speaker->cone_volume_outer); - mat4_to_quat(quat, object->obmat); + mat4_to_quat(quat, object->object_to_world); AUD_SequenceEntry_setAnimationData( - strip->speaker_handle, AUD_AP_LOCATION, scene->r.cfra, object->obmat[3], 1); + strip->speaker_handle, AUD_AP_LOCATION, scene->r.cfra, object->object_to_world[3], 1); AUD_SequenceEntry_setAnimationData( strip->speaker_handle, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1); AUD_SequenceEntry_setAnimationData( @@ -1171,9 +1171,9 @@ void BKE_sound_update_scene(Depsgraph *depsgraph, Scene *scene) } if (scene->camera) { - mat4_to_quat(quat, scene->camera->obmat); + mat4_to_quat(quat, scene->camera->object_to_world); AUD_Sequence_setAnimationData( - scene->sound_scene, AUD_AP_LOCATION, scene->r.cfra, scene->camera->obmat[3], 1); + scene->sound_scene, AUD_AP_LOCATION, scene->r.cfra, scene->camera->object_to_world[3], 1); AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1); } diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index 7ace1a3aa3b..9f48b9b9c4a 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -1310,14 +1310,14 @@ static bool vfont_to_curve(Object *ob, float timeofs, sizefac; if (ob != NULL) { - invert_m4_m4(imat, ob->obmat); + invert_m4_m4(imat, ob->object_to_world); } else { unit_m4(imat); } copy_m3_m4(imat3, imat); - copy_m3_m4(cmat, cu->textoncurve->obmat); + copy_m3_m4(cmat, cu->textoncurve->object_to_world); mul_m3_m3m3(cmat, cmat, imat3); sizefac = normalize_v3(cmat[0]) / font_size; |