Skip to main content
added 97 characters in body
Source Link
zeffii
  • 39.9k
  • 9
  • 106
  • 189

without the ops:

import bpy

context = bpy.context
scene = context.scene
objects = bpy.data.objects

selected_objects = context.selected_objects.copy()
mt = objects.new('parent_empty', None)
scene.objects.link(mt)

for o in selected_objects:
    o.parent = mt

You'd need to wrap this in operator /addon code so you could trigger it from a shortcut or menu, permanently..

Templates for Operators can be found in: TextEditor -> Templates -> Python -> Operator Simple

without the ops:

import bpy

context = bpy.context
scene = context.scene
objects = bpy.data.objects

selected_objects = context.selected_objects.copy()
mt = objects.new('parent_empty', None)
scene.objects.link(mt)

for o in selected_objects:
    o.parent = mt

You'd need to wrap this in operator /addon code so you could trigger it from a shortcut or menu, permanently..

without the ops:

import bpy

context = bpy.context
scene = context.scene
objects = bpy.data.objects

selected_objects = context.selected_objects.copy()
mt = objects.new('parent_empty', None)
scene.objects.link(mt)

for o in selected_objects:
    o.parent = mt

You'd need to wrap this in operator /addon code so you could trigger it from a shortcut or menu, permanently..

Templates for Operators can be found in: TextEditor -> Templates -> Python -> Operator Simple

Source Link
zeffii
  • 39.9k
  • 9
  • 106
  • 189

without the ops:

import bpy

context = bpy.context
scene = context.scene
objects = bpy.data.objects

selected_objects = context.selected_objects.copy()
mt = objects.new('parent_empty', None)
scene.objects.link(mt)

for o in selected_objects:
    o.parent = mt

You'd need to wrap this in operator /addon code so you could trigger it from a shortcut or menu, permanently..