5
Group: 'ScriptTemplate'
6
Tooltip: 'Add a new text for editing selected objects'
9
from Blender import Window
15
Name: 'My Object Script'
18
Tooltip: 'Put some useful info here'
21
# Add a licence here if you wish to re-distribute, we recommend the GPL
23
from Blender import Window, sys
26
def my_object_util(sce):
28
# Remove these when writing your own tool
29
print 'Blend object count', len(bpy.data.objects)
30
print 'Scene object count', len(sce.objects)
32
# context means its selected, in the view layer and not hidden.
33
print 'Scene context count', len(sce.objects.context)
37
# Move context objects on the x axis
39
for ob in sce.objects.context:
43
# Copy Objects, does not copy object data
45
# Store the current contetx
46
context = list(sce.objects.context)
48
sce.objects.selected = []
52
sce.objects.link(ob_copy) # the copy is not added to a scene
58
# Gets the current scene, there can be many scenes in 1 blend file.
59
sce = bpy.data.scenes.active
64
# Run the object editing function
67
# Timing the script is a good way to be aware on any speed hits when scripting
68
print 'My Script finished in %.2f seconds' % (sys.time()-t)
72
# This lets you can import the script without running it
73
if __name__ == '__main__':
78
new_text = bpy.data.texts.new('object_template.py')
79
new_text.write(script_data)
80
bpy.data.texts.active = new_text
b'\\ No newline at end of file'