Fix T41950: Parent-Child Menu behaves weird

Issue was, parenting with operator, then unparenting would keep the inverse parent matrix.
So if you then parented again through the mere Object field of Object buttons, you'd still
use previous inver parent matrix, giving some weird behavior from user PoV.

This commit simply makes sure inverse parent matrix is always reset to indentity when clearing
parents.
This commit is contained in:
Bastien Montagne 2014-10-10 16:57:29 +02:00
parent 504370cafb
commit b100bdca25
Notes: blender-bot 2023-02-14 10:02:31 +01:00
Referenced by commit 714a3739da, Fix T100599: dont reset parent inverse setting parent type the same
Referenced by issue #41950, Parent-Child Menu behaves weird
1 changed files with 10 additions and 2 deletions

View File

@ -506,12 +506,15 @@ void ED_object_parent_clear(Object *ob, int type)
}
case CLEAR_PARENT_INVERSE:
{
/* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state) is cleared */
unit_m4(ob->parentinv);
/* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state)
* is cleared. In other words: nothing to do here! */
break;
}
}
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
@ -556,6 +559,9 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
void ED_object_parent(Object *ob, Object *par, int type, const char *substr)
{
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
if (!par || BKE_object_parent_loop_check(par, ob)) {
ob->parent = NULL;
ob->partype = PAROBJECT;
@ -655,6 +661,8 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
ob->parent = par;
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
}
/* handle types */