acoolrocket

Blender - Apply scale of null back to 1.0 but retain object’s transformations

Sep 11th, 2026
33
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import bpy
  2.  
  3. # Get all selected empties/nulls
  4. selected_empties = [
  5. obj for obj in bpy.context.selected_objects if obj.type == "EMPTY"
  6. ]
  7.  
  8. for empty in selected_empties:
  9. # 1. Store direct children and their current world transforms
  10. children = empty.children
  11. if not children:
  12. empty.scale = (1.0, 1.0, 1.0)
  13. continue
  14.  
  15. child_transforms = {child: child.matrix_world.copy() for child in children}
  16.  
  17. # 2. Reset the null scale to 1
  18. empty.scale = (1.0, 1.0, 1.0)
  19. bpy.context.view_layer.update()
  20.  
  21. # 3. Restore the children's world transforms (Blender auto-calculates the new local scale)
  22. for child, matrix in child_transforms.items():
  23. child.matrix_world = matrix
  24.  
  25. bpy.context.view_layer.update()
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment