diff options
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_tracking.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops_orient.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap_object.c | 3 |
9 files changed, 47 insertions, 37 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index a7cdef06268..4621f2fbe31 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -142,7 +142,7 @@ struct Base **BKE_object_pose_base_array_get_unique(struct ViewLayer *view_layer struct Base **BKE_object_pose_base_array_get(struct ViewLayer *view_layer, unsigned int *r_bases_len); void BKE_object_get_parent_matrix( - struct Scene *scene, struct Object *ob, + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *par, float parentmat[4][4]); void BKE_object_where_is_calc( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); @@ -154,7 +154,8 @@ void BKE_object_where_is_calc_time( void BKE_object_where_is_calc_time_ex( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, struct RigidBodyWorld *rbw, float r_originmat[3][3]); -void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); +void BKE_object_where_is_calc_mat4( + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float obmat[4][4]); /* possibly belong in own moduke? */ struct BoundBox *BKE_boundbox_alloc_unit(void); diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 13302caa09d..0c3b118d947 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -32,6 +32,7 @@ * \author Sergey Sharybin */ +struct Depsgraph; struct bGPDlayer; struct ImBuf; struct ListBase; @@ -61,7 +62,8 @@ struct ListBase *BKE_tracking_get_active_plane_tracks(struct MovieTracking *trac struct MovieTrackingReconstruction *BKE_tracking_get_active_reconstruction(struct MovieTracking *tracking); /* matrices for constraints and drawing */ -void BKE_tracking_get_camera_object_matrix(struct Scene *scene, struct Object *ob, float mat[4][4]); +void BKE_tracking_get_camera_object_matrix( + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float mat[4][4]); void BKE_tracking_get_projection_matrix(struct MovieTracking *tracking, struct MovieTrackingObject *object, int framenr, int winx, int winy, float mat[4][4]); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 28c6fe852c2..385c0f7f6bf 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3963,7 +3963,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase translate_m4(cob->matrix, track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]); } else { - BKE_tracking_get_camera_object_matrix(cob->scene, camob_eval, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, cob->scene, camob_eval, mat); mul_m4_m4m4(cob->matrix, obmat, mat); translate_m4(cob->matrix, track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]); @@ -3975,7 +3975,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp); float len, d; - BKE_object_where_is_calc_mat4(scene, camob_eval, mat); + BKE_object_where_is_calc_mat4(depsgraph, scene, camob_eval, mat); /* camera axis */ vec[0] = 0.0f; @@ -4238,7 +4238,7 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase float ctime = DEG_get_ctime(depsgraph); float framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, ctime); - BKE_object_where_is_calc_mat4(scene, camob, cammat); + BKE_object_where_is_calc_mat4(depsgraph, scene, camob, cammat); BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 02e0d46e5c1..9c9d3b4088e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1681,7 +1681,7 @@ void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]) if (ob->parent) { float par_imat[4][4]; - BKE_object_get_parent_matrix(NULL, ob, ob->parent, par_imat); + BKE_object_get_parent_matrix(NULL, NULL, ob, ob->parent, par_imat); invert_m4(par_imat); mul_m4_m4m4(mat, par_imat, ob->obmat); } @@ -1697,7 +1697,7 @@ int enable_cu_speed = 1; * \param scene: Used when curve cache needs to be calculated, or for dupli-frame time. * \return success if \a mat is set. */ -static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) +static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Object *par, float mat[4][4]) { Curve *cu = par->data; float vec[4], dir[3], quat[4], radius, ctime; @@ -1736,11 +1736,11 @@ static bool ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[4][4]) } else { /* For dupli-frames only */ - if (scene == NULL) { + if (depsgraph == NULL) { return false; } - ctime = BKE_scene_frame_get(scene); + ctime = DEG_get_ctime(depsgraph); if (cu->pathlen) { ctime /= cu->pathlen; } @@ -1991,7 +1991,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) } -void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float parentmat[4][4]) +void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par, float parentmat[4][4]) { float tmat[4][4]; float vec[3]; @@ -2002,7 +2002,7 @@ void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float p ok = 0; if (par->type == OB_CURVE) { if ((((Curve *)par->data)->flag & CU_PATH) && - (ob_parcurve(scene, ob, par, tmat))) + (ob_parcurve(depsgraph, scene, ob, par, tmat))) { ok = 1; } @@ -2038,7 +2038,8 @@ void BKE_object_get_parent_matrix(Scene *scene, Object *ob, Object *par, float p /** * \param r_originmat Optional matrix that stores the space the object is in (without its own matrix applied) */ -static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4][4], float slowmat[4][4], +static void solve_parenting(Depsgraph *depsgraph, + Scene *scene, Object *ob, Object *par, float obmat[4][4], float slowmat[4][4], float r_originmat[3][3], const bool set_origin) { float totmat[4][4]; @@ -2049,7 +2050,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4 if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat); - BKE_object_get_parent_matrix(scene, ob, par, totmat); + BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat); /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); @@ -2106,7 +2107,7 @@ void BKE_object_where_is_calc_time_ex( float slowmat[4][4]; /* calculate parent matrix */ - solve_parenting(scene, ob, par, ob->obmat, slowmat, r_originmat, true); + solve_parenting(depsgraph, scene, ob, par, ob->obmat, slowmat, r_originmat, true); /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around * An old-fashioned hack which probably doesn't really cut it anymore @@ -2147,7 +2148,7 @@ void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *o * constraints -- assume dependencies are already solved by depsgraph. * no changes to object and it's parent would be done. * used for bundles orientation in 3d space relative to parented blender camera */ -void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) +void BKE_object_where_is_calc_mat4(Depsgraph *depsgraph, Scene *scene, Object *ob, float obmat[4][4]) { if (ob->parent) { @@ -2155,7 +2156,7 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) Object *par = ob->parent; - solve_parenting(scene, ob, par, obmat, slowmat, NULL, false); + solve_parenting(depsgraph, scene, ob, par, obmat, slowmat, NULL, false); if (ob->partype & PARSLOW) where_is_object_parslow(ob, obmat, slowmat); @@ -2225,7 +2226,7 @@ void BKE_object_apply_mat4_ex(Object *ob, float mat[4][4], Object *parent, float if (parent != NULL) { float rmat[4][4], diff_mat[4][4], imat[4][4], parent_mat[4][4]; - BKE_object_get_parent_matrix(NULL, ob, parent, parent_mat); + BKE_object_get_parent_matrix(NULL, NULL, ob, parent, parent_mat); mul_m4_m4m4(diff_mat, parent_mat, parentinv); invert_m4_m4(imat, diff_mat); diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index d21a1326392..1778eaeae75 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -95,7 +95,7 @@ void BKE_object_eval_parent(Depsgraph *depsgraph, copy_m4_m4(locmat, ob->obmat); /* get parent effect matrix */ - BKE_object_get_parent_matrix(scene, ob, par, totmat); + BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat); /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 3314e8d01b6..fe9cf1e9609 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -395,7 +395,7 @@ MovieTrackingReconstruction *BKE_tracking_get_active_reconstruction(MovieTrackin /* Get transformation matrix for a given object which is used * for parenting motion tracker reconstruction to 3D world. */ -void BKE_tracking_get_camera_object_matrix(Scene *scene, Object *ob, float mat[4][4]) +void BKE_tracking_get_camera_object_matrix(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float mat[4][4]) { if (!ob) { if (scene->camera) @@ -405,7 +405,7 @@ void BKE_tracking_get_camera_object_matrix(Scene *scene, Object *ob, float mat[4 } if (ob) - BKE_object_where_is_calc_mat4(scene, ob, mat); + BKE_object_where_is_calc_mat4(depsgraph, scene, ob, mat); else unit_m4(mat); } diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c index 2c6ef20f1c4..3db52e6a39b 100644 --- a/source/blender/editors/space_clip/tracking_ops_orient.c +++ b/source/blender/editors/space_clip/tracking_ops_orient.c @@ -145,7 +145,8 @@ static int count_selected_bundles(bContext *C) return tot; } -static void object_solver_inverted_matrix(Scene *scene, +static void object_solver_inverted_matrix(Depsgraph *depsgraph, + Scene *scene, Object *ob, float invmat[4][4]) { @@ -162,7 +163,7 @@ static void object_solver_inverted_matrix(Scene *scene, bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data; if (!found) { Object *cam = data->camera ? data->camera : scene->camera; - BKE_object_where_is_calc_mat4(scene, cam, invmat); + BKE_object_where_is_calc_mat4(depsgraph, scene, cam, invmat); } mul_m4_m4m4(invmat, invmat, data->invmat); found = true; @@ -200,6 +201,7 @@ static int set_origin_exec(bContext *C, wmOperator *op) MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; Scene *scene = CTX_data_scene(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *camera = get_camera_with_movieclip(scene, clip); int selected_count = count_selected_bundles(C); @@ -236,14 +238,14 @@ static int set_origin_exec(bContext *C, wmOperator *op) mul_v3_fl(median, 1.0f / selected_count); float mat[4][4], vec[3]; - BKE_tracking_get_camera_object_matrix(scene, camera, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat); mul_v3_m4v3(vec, mat, median); if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { sub_v3_v3(object->loc, vec); } else { - object_solver_inverted_matrix(scene, object, mat); + object_solver_inverted_matrix(depsgraph, scene, object, mat); mul_v3_m4v3(vec, mat, vec); copy_v3_v3(object->loc, vec); } @@ -278,7 +280,8 @@ void CLIP_OT_set_origin(wmOperatorType *ot) /********************** set floor operator *********************/ -static void set_axis(Scene *scene, +static void set_axis(Depsgraph *depsgraph, + Scene *scene, Object *ob, MovieClip *clip, MovieTrackingObject *tracking_object, @@ -292,14 +295,14 @@ static void set_axis(Scene *scene, BKE_object_to_mat4(ob, obmat); - BKE_tracking_get_camera_object_matrix(scene, camera, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat); mul_v3_m4v3(vec, mat, track->bundle_pos); copy_v3_v3(dvec, vec); if (!is_camera) { float imat[4][4]; - object_solver_inverted_matrix(scene, ob, imat); + object_solver_inverted_matrix(depsgraph, scene, ob, imat); mul_v3_m4v3(vec, imat, vec); invert_m4_m4(imat, obmat); @@ -430,7 +433,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_tracking_get_camera_object_matrix(scene, camera, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat); /* Get 3 bundles to use as reference. */ track = tracksbase->first; @@ -493,7 +496,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) } BKE_object_where_is_calc(depsgraph, scene, object); - set_axis(scene, object, clip, tracking_object, axis_track, 'X'); + set_axis(depsgraph, scene, object, clip, tracking_object, axis_track, 'X'); DEG_id_tag_update(&clip->id, 0); DEG_id_tag_update(&object->id, OB_RECALC_OB); @@ -539,6 +542,7 @@ static int set_axis_exec(bContext *C, wmOperator *op) MovieTracking *tracking = &clip->tracking; MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking); Scene *scene = CTX_data_scene(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *object; int axis = RNA_enum_get(op->ptr, "axis"); @@ -567,7 +571,7 @@ static int set_axis_exec(bContext *C, wmOperator *op) track = track->next; } - set_axis(scene, object, clip, tracking_object, track, axis == 0 ? 'X' : 'Y'); + set_axis(depsgraph, scene, object, clip, tracking_object, track, axis == 0 ? 'X' : 'Y'); DEG_id_tag_update(&clip->id, 0); DEG_id_tag_update(&object->id, OB_RECALC_OB); @@ -618,6 +622,7 @@ static int do_set_scale(bContext *C, MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking); MovieTrackingTrack *track; Scene *scene = CTX_data_scene(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *object = NULL; Object *camera = get_camera_with_movieclip(scene, clip); ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking); @@ -642,7 +647,7 @@ static int do_set_scale(bContext *C, } } - BKE_tracking_get_camera_object_matrix(scene, camera, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat); track = tracksbase->first; while (track) { diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 13d2ceb4ad4..ac967e3c97c 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -524,7 +524,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) /* **************************************************** */ -static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) +static void bundle_midpoint(Depsgraph *depsgraph, Scene *scene, Object *ob, float vec[3]) { MovieClip *clip = BKE_object_movieclip_get(scene, ob, false); MovieTracking *tracking; @@ -539,7 +539,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) copy_m4_m4(cammat, ob->obmat); - BKE_tracking_get_camera_object_matrix(scene, ob, mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, ob, mat); INIT_MINMAX(min, max); @@ -578,7 +578,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) { - const Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph(C); ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); @@ -650,7 +650,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) if (ob_eval->type == OB_CAMERA) { /* snap to bundles should happen only when bundles are visible */ if (v3d->flag2 & V3D_SHOW_RECONSTRUCTION) { - bundle_midpoint(scene, DEG_get_original_object(ob_eval), vec); + bundle_midpoint(depsgraph, scene, DEG_get_original_object(ob_eval), vec); } } diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 29497fe801c..d3092fa18cd 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1633,6 +1633,7 @@ static short snapCamera( { short retval = 0; + Depsgraph *depsgraph = sctx->depsgraph; Scene *scene = sctx->scene; bool is_persp = snapdata->view_proj == VIEW_PROJ_PERSP; @@ -1657,7 +1658,7 @@ static short snapCamera( tracking = &clip->tracking; - BKE_tracking_get_camera_object_matrix(scene, object, orig_camera_mat); + BKE_tracking_get_camera_object_matrix(depsgraph, scene, object, orig_camera_mat); invert_m4_m4(orig_camera_imat, orig_camera_mat); invert_m4_m4(imat, obmat); |