diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-10-10 18:57:29 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-15 15:06:12 +0400 |
commit | 0763771e94663c3245d0b99d749bf9771f291d98 (patch) | |
tree | df13cf926d652d9983e2ecb4c26111f4cb97b0ae | |
parent | e58fe2021f149e8c700dd194fbae02ba96eec229 (diff) |
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.
-rw-r--r-- | source/blender/editors/object/object_relations.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index abc0516cf2b..74683cf43f8 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -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 */ |