2.5 - Partial Bugfixes for Parenting Objects to Curves (Ctrl-P)

* Path Constraint option (i.e. this creates a follow-path constraint but doesn't actually parent the object to the curve) works now. Fixed a crash here too.

* Follow Path option (i.e. parent the object to the curve, and follow it), is not working correctly yet. Some matrix seems to get set wrongly.
This commit is contained in:
2009-09-21 12:09:00 +00:00
parent 61c79adb8b
commit d2639e732b
2 changed files with 14 additions and 5 deletions

View File

@@ -1188,7 +1188,10 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
if (cu->path && cu->path->data) {
if ((data->followflag & FOLLOWPATH_STATIC) == 0) {
/* animated position along curve depending on time */
curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset;
if (cob->scene)
curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset;
else
curvetime= ctime - data->offset;
/* 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...

View File

@@ -566,8 +566,9 @@ static int parent_set_exec(bContext *C, wmOperator *op)
}
else cu->flag |= CU_FOLLOW;
/* fall back on regular parenting now */
partype= PAR_OBJECT;
/* fall back on regular parenting now (for follow only) */
if(partype == PAR_FOLLOW)
partype= PAR_OBJECT;
}
}
else if(partype==PAR_BONE) {
@@ -593,7 +594,9 @@ static int parent_set_exec(bContext *C, wmOperator *op)
/* apply transformation of previous parenting */
ED_object_apply_obmat(ob);
ob->parent= par;
/* set the parent (except for follow-path constraint option) */
if(partype != PAR_PATH_CONST)
ob->parent= par;
/* handle types */
if (pchan)
@@ -602,7 +605,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
ob->parsubstr[0]= 0;
/* constraint */
if(partype==PAR_PATH_CONST) {
if(partype == PAR_PATH_CONST) {
bConstraint *con;
bFollowPathConstraint *data;
float cmat[4][4], vec[3];
@@ -620,6 +623,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
ob->loc[0] = vec[0];
ob->loc[1] = vec[1];
ob->loc[2] = vec[2];
}
else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
if(partype == PAR_ARMATURE_NAME)
@@ -645,6 +649,8 @@ static int parent_set_exec(bContext *C, wmOperator *op)
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
if(partype == PAR_PATH_CONST)
; /* don't do anything here, since this is not technically "parenting" */
if( ELEM(partype, PAR_CURVE, PAR_LATTICE) || pararm )
ob->partype= PARSKEL; /* note, dna define, not operator property */
else if (partype == PAR_BONE)