# how to clear parent inverse without actually moving the object

In Blender, a parent-child relationship stores the relationship between the 2 objects created when parenting.

This is normally OK, but in some cases its useful to have a reset loc/rot/scale, align the child exactly with its parent.

I need to reset those extra matrices in blender object - I have an object that is perfectly aligned with it's parent, but the euler rotations values say something very different. I need a script to have this object's rotation at 0,0,0 (or, potentially other value, which expresses the real rotation offset to it's parent)

You can reset the parent inverse matrix, then apply the relationship between the original matrix and the parents onto the child object.

This script assumes you have the child selected.

import bpy
ob = bpy.context.object

# Store a copy of the objects final transformation
# so we can read from it later.
ob_matrix_orig = ob.matrix_world.copy()

# Reset parent inverse matrix.
# (relationship created when parenting)
ob.matrix_parent_inverse.identity()

# Re-apply the difference between parent/child
# (this writes directly into the loc/scale/rot) via a matrix.
ob.matrix_basis = ob.parent.matrix_world.inverted() @ ob_matrix_orig


Note, if the child has any shearing because of rotation and the parents non-uniform scaling, that will be removed, since loc/scale/rot can't represent shearing.

• The matrix multiplication on the last line doesn't seem to work in Blender 2.80, seems like something changed. – emackey Sep 20 at 15:00
• Updated for 2.8x – ideasman42 Sep 20 at 22:42