Fix T59237: Instancing on a path doesn't do anything

This commit makes it so curve path parent solving accepts an explicit
arguments for both time and curve speed flag, making it so we don't
have to mock around with scene's frame.

One unfortunate issue still is that if the instancing object is used
for something else, we might be running into a threading conflict.
Possible solution would be to create a temp copy of an object, but
then it will be an issue of preventing drivers from modifying other
datablocks.

At least the original issue is fixed now, and things behave same as
in older Blender version. Additionally, the global variable which
was defining curve speed flag behavior is gone now!
This commit is contained in:
Sergey Sharybin 2018-12-19 11:20:32 +01:00
parent bc8f2e9ee4
commit 908a274240
12 changed files with 83 additions and 105 deletions

View File

@ -157,8 +157,9 @@ 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, struct View3D *v3d, unsigned int *r_bases_len);
void BKE_object_get_parent_matrix(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
struct Object *par, float parentmat[4][4]);
struct Object *ob, struct Object *par, float parentmat[4][4]);
void BKE_object_get_parent_matrix_for_dupli(
struct Object *ob, struct Object *par, float dupli_ctime, int dupli_transflag, float parentmat[4][4]);
void BKE_object_where_is_calc(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_ex(
@ -166,11 +167,12 @@ void BKE_object_where_is_calc_ex(
struct Object *ob, float r_originmat[3][3]);
void BKE_object_where_is_calc_time(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime);
void BKE_object_where_is_calc_time_for_dupli(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, int dupli_transflag);
void BKE_object_where_is_calc_time_ex(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime,
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime, int dupli_transflag,
struct RigidBodyWorld *rbw, float r_originmat[3][3]);
void BKE_object_where_is_calc_mat4(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float obmat[4][4]);
void BKE_object_where_is_calc_mat4(struct Object *ob, float obmat[4][4]);
/* possibly belong in own moduke? */
struct BoundBox *BKE_boundbox_alloc_unit(void);
@ -231,7 +233,6 @@ void BKE_object_eval_local_transform(
struct Object *ob);
void BKE_object_eval_parent(
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
void BKE_object_eval_constraints(
struct Depsgraph *depsgraph,

View File

@ -63,7 +63,7 @@ struct MovieTrackingReconstruction *BKE_tracking_get_active_reconstruction(struc
/* matrices for constraints and drawing */
void BKE_tracking_get_camera_object_matrix(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float mat[4][4]);
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]);

View File

@ -4247,7 +4247,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(depsgraph, cob->scene, camob_eval, mat);
BKE_tracking_get_camera_object_matrix(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]);
@ -4259,7 +4259,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(depsgraph, scene, camob_eval, mat);
BKE_object_where_is_calc_mat4(camob_eval, mat);
/* camera axis */
vec[0] = 0.0f;
@ -4521,7 +4521,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(depsgraph, scene, camob, cammat);
BKE_object_where_is_calc_mat4(camob, cammat);
BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat);

View File

@ -1891,7 +1891,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, NULL, ob, ob->parent, par_imat);
BKE_object_get_parent_matrix(ob, ob->parent, par_imat);
invert_m4(par_imat);
mul_m4_m4m4(mat, par_imat, ob->obmat);
}
@ -1900,40 +1900,33 @@ void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4])
}
}
/* extern */
int enable_cu_speed = 1;
/**
* \param depsgraph: Used for dupli-frame time.
* \return success if \a mat is set.
*/
static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Object *par, float mat[4][4])
static bool ob_parcurve(Object *ob, Object *par,
float dupli_ctime, int dupli_transflag, float mat[4][4])
{
Curve *cu = par->data;
float vec[4], dir[3], quat[4], radius, ctime;
/* TODO: Make sure this doesn't crash. */
#if 0
/* only happens on reload file, but violates depsgraph still... fix! */
if (par->curve_cache == NULL) {
if (scene == NULL) {
return false;
}
BKE_displist_make_curveTypes(depsgraph, scene, par, 0);
}
#else
/* See: T56619 */
/* NOTE: Curve cache is supposed to be evaluated here already, however there
* are cases where we can not guarantee that. This includes, for example,
* dependency cycles. We can't correct anything from here, since that would
* cause a threading conflicts.
*
* TODO(sergey): Somce of the legit looking cases like T56619 need to be
* looked into, and maybe curve cache (and other dependencies) are to be
* evaluated prior to conversion. */
if (par->runtime.curve_cache == NULL) {
return false;
}
#endif
if (par->runtime.curve_cache->path == NULL) {
return false;
}
/* catch exceptions: curve paths used as a duplicator */
if (enable_cu_speed) {
if ((dupli_transflag & OB_DUPLINOSPEED) == 0) {
/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
* but this will only work if it actually is animated...
*
@ -1946,20 +1939,13 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob,
else {
ctime = cu->ctime;
}
CLAMP(ctime, 0.0f, 1.0f);
}
else {
/* For dupli-frames only */
if (depsgraph == NULL) {
return false;
}
ctime = DEG_get_ctime(depsgraph);
ctime = dupli_ctime;
if (cu->pathlen) {
ctime /= cu->pathlen;
}
CLAMP(ctime, 0.0f, 1.0f);
}
@ -1967,22 +1953,18 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob,
/* vec: 4 items! */
if (where_on_path(par, ctime, vec, dir, (cu->flag & CU_FOLLOW) ? quat : NULL, &radius, NULL)) {
if (cu->flag & CU_FOLLOW) {
quat_apply_track(quat, ob->trackflag, ob->upflag);
normalize_qt(quat);
quat_to_mat4(mat, quat);
}
if (cu->flag & CU_PATH_RADIUS) {
float tmat[4][4], rmat[4][4];
scale_m4_fl(tmat, radius);
mul_m4_m4m4(rmat, tmat, mat);
copy_m4_m4(mat, rmat);
}
copy_v3_v3(mat[3], vec);
}
return true;
@ -2152,8 +2134,9 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
}
}
void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob, Object *par, float parentmat[4][4])
void BKE_object_get_parent_matrix_for_dupli(Object *ob, Object *par,
float dupli_ctime, int dupli_transflag,
float parentmat[4][4])
{
float tmat[4][4];
float vec[3];
@ -2164,7 +2147,7 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob
ok = 0;
if (par->type == OB_CURVE) {
if ((((Curve *)par->data)->flag & CU_PATH) &&
(ob_parcurve(depsgraph, scene, ob, par, tmat)))
(ob_parcurve(ob, par, dupli_ctime, dupli_transflag, tmat)))
{
ok = 1;
}
@ -2197,12 +2180,17 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob
}
void BKE_object_get_parent_matrix(Object *ob, Object *par, float parentmat[4][4])
{
BKE_object_get_parent_matrix_for_dupli(ob, par, 0, 0, parentmat);
}
/**
* \param r_originmat: Optional matrix that stores the space the object is in (without its own matrix applied)
*/
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)
static void solve_parenting(Object *ob, Object *par, float obmat[4][4], float slowmat[4][4],
float r_originmat[3][3], const bool set_origin,
float dupli_ctime, int dupli_transflag)
{
float totmat[4][4];
float tmat[4][4];
@ -2212,7 +2200,7 @@ static void solve_parenting(Depsgraph *depsgraph,
if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat);
BKE_object_get_parent_matrix_for_dupli(ob, par, dupli_ctime, dupli_transflag, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
@ -2256,7 +2244,7 @@ static bool where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat
/* note, scene is the active scene while actual_scene is the scene the object resides in */
void BKE_object_where_is_calc_time_ex(
Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime,
Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime, int dupli_transflag,
RigidBodyWorld *rbw, float r_originmat[3][3])
{
if (ob == NULL) return;
@ -2269,7 +2257,8 @@ void BKE_object_where_is_calc_time_ex(
float slowmat[4][4];
/* calculate parent matrix */
solve_parenting(depsgraph, scene, ob, par, ob->obmat, slowmat, r_originmat, true);
solve_parenting(ob, par, ob->obmat, slowmat, r_originmat, true,
ctime, dupli_transflag);
/* "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
@ -2303,14 +2292,21 @@ void BKE_object_where_is_calc_time_ex(
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
{
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, NULL, NULL);
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, 0, NULL, NULL);
}
void BKE_object_where_is_calc_time_for_dupli(
Depsgraph *depsgraph, Scene *scene, struct Object *ob, float ctime, int dupli_transflag)
{
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, ctime, dupli_transflag, NULL, NULL);
}
/* get object transformation matrix without recalculating dependencies and
* 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(Depsgraph *depsgraph, Scene *scene, Object *ob, float obmat[4][4])
void BKE_object_where_is_calc_mat4(Object *ob, float obmat[4][4])
{
if (ob->parent) {
@ -2318,7 +2314,7 @@ void BKE_object_where_is_calc_mat4(Depsgraph *depsgraph, Scene *scene, Object *o
Object *par = ob->parent;
solve_parenting(depsgraph, scene, ob, par, obmat, slowmat, NULL, false);
solve_parenting(ob, par, obmat, slowmat, NULL, false, 0.0f, 0);
if (ob->partype & PARSLOW)
where_is_object_parslow(ob, obmat, slowmat);
@ -2330,11 +2326,11 @@ void BKE_object_where_is_calc_mat4(Depsgraph *depsgraph, Scene *scene, Object *o
void BKE_object_where_is_calc_ex(Depsgraph *depsgraph, Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3])
{
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), rbw, r_originmat);
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, rbw, r_originmat);
}
void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
{
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), NULL, NULL);
BKE_object_where_is_calc_time_ex(depsgraph, scene, ob, DEG_get_ctime(depsgraph), 0, NULL, NULL);
}
/**
@ -2388,7 +2384,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, NULL, ob, parent, parent_mat);
BKE_object_get_parent_matrix(ob, parent, parent_mat);
mul_m4_m4m4(diff_mat, parent_mat, parentinv);
invert_m4_m4(imat, diff_mat);

View File

@ -317,9 +317,7 @@ static void make_duplis_frames(const DupliContext *ctx)
Depsgraph *depsgraph = ctx->depsgraph;
Scene *scene = ctx->scene;
Object *ob = ctx->object;
extern int enable_cu_speed; /* object.c */
Object copyob;
int cfrao = scene->r.cfra;
int dupend = ob->dupend;
/* dupliframes not supported inside collections */
@ -339,16 +337,15 @@ static void make_duplis_frames(const DupliContext *ctx)
copyob = *ob;
/* duplicate over the required range */
if (ob->transflag & OB_DUPLINOSPEED) enable_cu_speed = 0;
for (scene->r.cfra = ob->dupsta; scene->r.cfra <= dupend; scene->r.cfra++) {
const int dupli_transflag = (ob->transflag & OB_DUPLINOSPEED);
for (int frame = ob->dupsta; frame <= dupend; frame++) {
int ok = 1;
/* - dupoff = how often a frames within the range shouldn't be made into duplis
* - dupon = the length of each "skipping" block in frames
*/
if (ob->dupoff) {
ok = scene->r.cfra - ob->dupsta;
ok = frame - ob->dupsta;
ok = ok % (ob->dupon + ob->dupoff);
ok = (ok < ob->dupon);
}
@ -359,23 +356,17 @@ static void make_duplis_frames(const DupliContext *ctx)
* However, this has always been the way that this worked (i.e. pre 2.5), so I guess that it'll be fine!
*/
/* ob-eval will do drivers, so we don't need to do them */
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(depsgraph, scene, ob, (float)scene->r.cfra);
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, (float)frame, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time_for_dupli(depsgraph, scene, ob, (float)frame, dupli_transflag);
make_dupli(ctx, ob, ob->obmat, scene->r.cfra);
make_dupli(ctx, ob, ob->obmat, frame);
}
}
enable_cu_speed = 1;
/* reset frame to original frame, then re-evaluate animation as above
* as 2.5 animation data may have far-reaching consequences
*/
scene->r.cfra = cfrao;
/* ob-eval will do drivers, so we don't need to do them */
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(depsgraph, scene, ob, (float)scene->r.cfra);
const float original_ctime = DEG_get_ctime(depsgraph);
BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, original_ctime, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(depsgraph, scene, ob, original_ctime);
/* but, to make sure unkeyed object transforms are still sane,
* let's copy object's original data back over

View File

@ -92,9 +92,7 @@ void BKE_object_eval_local_transform(Depsgraph *depsgraph, Object *ob)
/* Evaluate parent */
/* NOTE: based on solve_parenting(), but with the cruft stripped out */
void BKE_object_eval_parent(Depsgraph *depsgraph,
Scene *scene,
Object *ob)
void BKE_object_eval_parent(Depsgraph *depsgraph, Object *ob)
{
Object *par = ob->parent;
@ -109,7 +107,7 @@ void BKE_object_eval_parent(Depsgraph *depsgraph,
copy_m4_m4(locmat, ob->obmat);
/* get parent effect matrix */
BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat);
BKE_object_get_parent_matrix(ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
@ -397,7 +395,7 @@ void BKE_object_eval_transform_all(Depsgraph *depsgraph,
/* This mimics full transform update chain from new depsgraph. */
BKE_object_eval_local_transform(depsgraph, object);
if (object->parent != NULL) {
BKE_object_eval_parent(depsgraph, scene, object);
BKE_object_eval_parent(depsgraph, object);
}
if (!BLI_listbase_is_empty(&object->constraints)) {
BKE_object_eval_constraints(depsgraph, scene, object);

View File

@ -399,7 +399,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(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float mat[4][4])
void BKE_tracking_get_camera_object_matrix(Scene *scene, Object *ob, float mat[4][4])
{
if (!ob) {
if (scene->camera)
@ -409,7 +409,7 @@ void BKE_tracking_get_camera_object_matrix(struct Depsgraph *depsgraph, Scene *s
}
if (ob)
BKE_object_where_is_calc_mat4(depsgraph, scene, ob, mat);
BKE_object_where_is_calc_mat4(ob, mat);
else
unit_m4(mat);
}

View File

@ -779,7 +779,6 @@ void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
void DepsgraphNodeBuilder::build_object_transform(Object *object)
{
OperationDepsNode *op_node;
Scene *scene_cow = get_cow_datablock(scene_);
Object *ob_cow = get_cow_datablock(object);
/* local transforms (from transform channels - loc/rot/scale + deltas) */
@ -795,7 +794,6 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object)
add_operation_node(&object->id, DEG_NODE_TYPE_TRANSFORM,
function_bind(BKE_object_eval_parent,
_1,
scene_cow,
ob_cow),
DEG_OPCODE_TRANSFORM_PARENT);
}

View File

@ -1685,7 +1685,7 @@ static void DRW_shgroup_camera(OBJECT_ShadingGroupList *sgl, Object *ob, ViewLay
UI_GetThemeColor4fv(TH_BUNDLE_SOLID, bundle_color_solid);
float camera_mat[4][4];
BKE_tracking_get_camera_object_matrix(draw_ctx->depsgraph, scene, ob, camera_mat);
BKE_tracking_get_camera_object_matrix(scene, ob, camera_mat);
float bundle_scale_mat[4][4];
if (is_solid_bundle) {

View File

@ -145,8 +145,7 @@ static int count_selected_bundles(bContext *C)
return tot;
}
static void object_solver_inverted_matrix(Depsgraph *depsgraph,
Scene *scene,
static void object_solver_inverted_matrix(Scene *scene,
Object *ob,
float invmat[4][4])
{
@ -163,7 +162,7 @@ static void object_solver_inverted_matrix(Depsgraph *depsgraph,
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
if (!found) {
Object *cam = data->camera ? data->camera : scene->camera;
BKE_object_where_is_calc_mat4(depsgraph, scene, cam, invmat);
BKE_object_where_is_calc_mat4(cam, invmat);
}
mul_m4_m4m4(invmat, invmat, data->invmat);
found = true;
@ -201,7 +200,6 @@ 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);
@ -238,14 +236,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(depsgraph, scene, camera, mat);
BKE_tracking_get_camera_object_matrix(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(depsgraph, scene, object, mat);
object_solver_inverted_matrix(scene, object, mat);
mul_v3_m4v3(vec, mat, vec);
copy_v3_v3(object->loc, vec);
}
@ -280,8 +278,7 @@ void CLIP_OT_set_origin(wmOperatorType *ot)
/********************** set floor operator *********************/
static void set_axis(Depsgraph *depsgraph,
Scene *scene,
static void set_axis(Scene *scene,
Object *ob,
MovieClip *clip,
MovieTrackingObject *tracking_object,
@ -295,14 +292,14 @@ static void set_axis(Depsgraph *depsgraph,
BKE_object_to_mat4(ob, obmat);
BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat);
BKE_tracking_get_camera_object_matrix(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(depsgraph, scene, ob, imat);
object_solver_inverted_matrix(scene, ob, imat);
mul_v3_m4v3(vec, imat, vec);
invert_m4_m4(imat, obmat);
@ -433,7 +430,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat);
BKE_tracking_get_camera_object_matrix(scene, camera, mat);
/* Get 3 bundles to use as reference. */
track = tracksbase->first;
@ -496,7 +493,7 @@ static int set_plane_exec(bContext *C, wmOperator *op)
}
BKE_object_where_is_calc(depsgraph, scene, object);
set_axis(depsgraph, scene, object, clip, tracking_object, axis_track, 'X');
set_axis(scene, object, clip, tracking_object, axis_track, 'X');
DEG_id_tag_update(&clip->id, 0);
DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);
@ -542,7 +539,6 @@ 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");
@ -571,7 +567,7 @@ static int set_axis_exec(bContext *C, wmOperator *op)
track = track->next;
}
set_axis(depsgraph, scene, object, clip, tracking_object, track, axis == 0 ? 'X' : 'Y');
set_axis(scene, object, clip, tracking_object, track, axis == 0 ? 'X' : 'Y');
DEG_id_tag_update(&clip->id, 0);
DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);
@ -622,7 +618,6 @@ 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);
@ -647,7 +642,7 @@ static int do_set_scale(bContext *C,
}
}
BKE_tracking_get_camera_object_matrix(depsgraph, scene, camera, mat);
BKE_tracking_get_camera_object_matrix(scene, camera, mat);
track = tracksbase->first;
while (track) {

View File

@ -550,7 +550,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
/* **************************************************** */
/** Returns the center position of a tracking marker visible on the viewport (useful to snap to). **/
static void bundle_midpoint(Depsgraph *depsgraph, Scene *scene, Object *ob, float r_vec[3])
static void bundle_midpoint(Scene *scene, Object *ob, float r_vec[3])
{
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
MovieTracking *tracking;
@ -565,7 +565,7 @@ static void bundle_midpoint(Depsgraph *depsgraph, Scene *scene, Object *ob, floa
copy_m4_m4(cammat, ob->obmat);
BKE_tracking_get_camera_object_matrix(depsgraph, scene, ob, mat);
BKE_tracking_get_camera_object_matrix(scene, ob, mat);
INIT_MINMAX(min, max);
@ -694,7 +694,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(depsgraph, scene, DEG_get_original_object(ob_eval), vec);
bundle_midpoint(scene, DEG_get_original_object(ob_eval), vec);
}
}

View File

@ -1674,7 +1674,6 @@ static short snapCamera(
{
short retval = 0;
Depsgraph *depsgraph = sctx->depsgraph;
Scene *scene = sctx->scene;
bool is_persp = snapdata->view_proj == VIEW_PROJ_PERSP;
@ -1699,7 +1698,7 @@ static short snapCamera(
tracking = &clip->tracking;
BKE_tracking_get_camera_object_matrix(depsgraph, scene, object, orig_camera_mat);
BKE_tracking_get_camera_object_matrix(scene, object, orig_camera_mat);
invert_m4_m4(orig_camera_imat, orig_camera_mat);
invert_m4_m4(imat, obmat);