[Bf-blender-cvs] [0763771] blender-v2.72-release: Fix T41950: Parent-Child Menu behaves weird

Bastien Montagne noreply at git.blender.org
Wed Oct 15 13:08:25 CEST 2014


Commit: 0763771e94663c3245d0b99d749bf9771f291d98
Author: Bastien Montagne
Date:   Fri Oct 10 16:57:29 2014 +0200
Branches: blender-v2.72-release
https://developer.blender.org/rB0763771e94663c3245d0b99d749bf9771f291d98

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.

===================================================================

M	source/blender/editors/object/object_relations.c

===================================================================

diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index abc0516..74683cf 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 */




More information about the Bf-blender-cvs mailing list