0
$\begingroup$

suppose i have two object a cylinder and sphere. I set sphere as parent of cylinder. Now when I reposition sphere the position of cylinder also changes. But when i see transform properties of cylinder (child of sphere) its transform properties are not changed. i want transform property to change with the position of child object. please suggest a way to achieve this if possible

enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ other than using "clear parent and keep transformation", I don't know if it's possible. $\endgroup$
    – m.ardito
    Jul 1, 2017 at 13:57

2 Answers 2

1
$\begingroup$

The Transform Panel shows the Local Coordinate Values. Since the Cylinder is parented to the Sphere, what you are asking for is not possible, unless you change the transform panel UI to display world space values (which would require more calculation, I presume)

$\endgroup$
0
$\begingroup$

You can create a panel that shows the info you want, which you can retrieve from the objects matrix_world property.

import bpy

class TrueTransforms(bpy.types.Panel):
    bl_idname = 'OBJECT_PT_true_transforms'
    bl_label = 'True Transforms'
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

    def draw(self, context):
        row = self.layout.row()
        row.prop(context.scene, 'trans_obj')
        obj = bpy.data.objects[context.scene.trans_obj]
        loc = obj.matrix_world.translation
        row = self.layout.row()
        row.label(text='X: {:.5f}'.format(loc.x))
        row = self.layout.row()
        row.label(text='Y: {:.5f}'.format(loc.y))
        row = self.layout.row()
        row.label(text='Z: {:.5f}'.format(loc.z))

def kidlist(self, context):
    kids = [(o.name,o.name,'') for o in bpy.data.objects if o.parent]
    return kids

def register():
    bpy.types.Scene.trans_obj = bpy.props.EnumProperty(items=kidlist)
    bpy.utils.register_class(TrueTransforms)

def unregister():
    bpy.utils.unregister_class(TrueTransforms)
    del bpy.types.Scene.trans_obj

if __name__ == "__main__":
    register()

If you make that into an addon, you can enable it and save your settings so it is available each time you start blender.

$\endgroup$
2
  • $\begingroup$ Thank you very much. Can you please do the same for true rotation? your Script show only the translation. Thank you!! $\endgroup$ Jun 8, 2023 at 10:24
  • $\begingroup$ The matrix_world property is a mathutils.Matrix, you can use obj.matrix_world.to_euler() or obj.matrix_world.to_quaternion() to extract the objects rotation. $\endgroup$
    – sambler
    Jun 15, 2023 at 3:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .