Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- # Get all selected empties/nulls
- selected_empties = [
- obj for obj in bpy.context.selected_objects if obj.type == "EMPTY"
- ]
- for empty in selected_empties:
- # 1. Store direct children and their current world transforms
- children = empty.children
- if not children:
- empty.scale = (1.0, 1.0, 1.0)
- continue
- child_transforms = {child: child.matrix_world.copy() for child in children}
- # 2. Reset the null scale to 1
- empty.scale = (1.0, 1.0, 1.0)
- bpy.context.view_layer.update()
- # 3. Restore the children's world transforms (Blender auto-calculates the new local scale)
- for child, matrix in child_transforms.items():
- child.matrix_world = matrix
- bpy.context.view_layer.update()
Advertisement