Page MenuHome

shapegallery.py

shapegallery.py

#!BPY
"""
Name: 'Shape Gallery'
Blender: 237
Group: 'Object'
Tooltip: 'Create and Pin Objects for Shapes'
"""
__author__ = "Johnny Matthews"
__version__ = "0.1 2005-10-04"
__doc__ = """\
This script creates a linked object for each shape and then pins each shape to a copy
"""
import Blender
cols = 2
ob = Blender.Object.GetSelected()[0]
sce = Blender.Scene.getCurrent()
me = ob.getData()
key = me.getKey()
obs = [ob]
obpos = ob.getLocation()
obmat = ob.getMatrix()
curr = 1
for kb in key.getBlocks():
t = Blender.Object.New("Mesh",ob.name+"-"+kb.name)
obs.append(t)
t.shareFrom(ob)
t.setShapesPinned(1)
t.setShapesCurrent(curr)
t.setMatrix(obmat)
sce.link(t)
curr = curr + 1
minx = ""
maxx = ""
minz = ""
maxz = ""
for o in obs:
bb = ob.getBoundBox()
for co in bb:
if minx == "":
minx = co[0]
if maxx == "":
maxx = co[0]
if minz == "":
minz = co[1]
if maxz == "":
maxz = co[1]
if co[0] < minx:
minx = co[0]
if co[2] < minz:
minz = co[0]
if co[0] > maxx:
maxx = co[0]
if co[2] > maxz:
maxz = co[0]
x = abs(maxx) + abs(minx)
for o in range(len(obs)):
loc = obs[o].getLocation()
obs[o].setLocation(loc[0]+(x*o),loc[1],loc[2])
Blender.Window.RedrawAll()

File Metadata

Mime Type
text/plain
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
25/bb/792944b41881ceeff89657719cfe

Event Timeline