In case anyone is interested, the script to create the building used in this video follows:
import poser
print
blockHeight = 0.8
yDelta = 0.1 * blockHeight
def newBlock(x, z, y):
poser.Scene().LoadLibraryProp("/Runtime/Libraries/Props/Primitives/box.ppz")
poser.Scene().CurrentActor().ParameterByCode (poser.kParmCodeXTRAN).SetValue(x)
poser.Scene().CurrentActor().ParameterByCode (poser.kParmCodeZTRAN).SetValue(z)
poser.Scene().CurrentActor().ParameterByCode (poser.kParmCodeYTRAN).SetValue(y)
poser.Scene().CurrentActor().ParameterByCode (poser.kParmCodeYSCALE).SetValue(blockHeight)
poser.Scene().CurrentActor().SetName("building_" + poser.Scene().CurrentActor().Name())
def row2x2(y):
global yDelta
a = 0.09
newBlock (a, a, y)
newBlock (-a, a, y)
newBlock (-a, -a, y)
newBlock (a, -a, y)
y = y + yDelta
b = 0.11
newBlock (0.0, b, y)
newBlock (-b, 0, y)
newBlock (0.0, -b, y)
newBlock (b, 0.0, y)
newBlock (0.0, 0.0, y)
def row3x3(y): # 2 & 3
global yDelta
a = 0.15
b = 1.1
newBlock (a * 0.5, a * b, y)
newBlock (-a * 0.5, a * b, y)
newBlock (a * 0.5, -a * b, y)
newBlock (-a * 0.5, -a * b, y)
newBlock (a * b, a * 0.5, y)
newBlock (a * b, -a * 0.5, y)
newBlock (-a * b, a * 0.5, y)
newBlock (-a * b, -a * 0.5, y)
y = y + yDelta
newBlock (0, a, y)
newBlock (a, a, y)
newBlock (-a, a, y)
newBlock (a, 0, y)
newBlock (-a, 0, y)
newBlock (0, -a, y)
newBlock (a, -a, y)
newBlock (-a, -a, y)
def row4x4(y): # 3 & 4
global yDelta
a = 0.14
b = 0.9
newBlock (0, a * 2 * b, y)
newBlock (a * 1, a * 2 * b, y)
newBlock (-a * 1, a * 2 * b, y)
newBlock (a * 2 * b, 0, y)
newBlock (a * 2 * b, a * 1, y)
newBlock (a * 2 * b, -a * 1, y)
newBlock (0, -a * 2 * b, y)
newBlock (a * 1, -a * 2 * b, y)
newBlock (-a * 1, -a * 2 * b, y)
newBlock (-a * 2 * b, 0, y)
newBlock (-a * 2 * b, a * 1, y)
newBlock (-a * 2 * b, -a * 1, y)
y = y + yDelta
newBlock (a * 1.5, a * 1.5, y)
newBlock (a * 0.5, a * 1.5, y)
newBlock (-a * 1.5, a * 1.5, y)
newBlock (-a * 0.5, a * 1.5, y)
newBlock (a * 1.5, a * 0.5, y)
newBlock (a * 1.5, a * -0.5, y)
newBlock (-a * 1.5, a * 0.5, y)
newBlock (-a * 1.5, a * -0.5, y)
newBlock (a * 1.5, -a * 1.5, y)
newBlock (a * 0.5, -a * 1.5, y)
newBlock (-a * 1.5, -a * 1.5, y)
newBlock (-a * 0.5, -a * 1.5, y)
def row5x5(y):
global yDelta
a = 0.14
b = 1.1
newBlock (a * 0.5, a * 2 * b, y)
newBlock (a * 1.5, a * 2 * b, y)
newBlock (-a * 0.5, a * 2 * b, y)
newBlock (-a * 1.5, a * 2 * b, y)
newBlock (a * 2 * b, a * 0.5, y)
newBlock (a * 2 * b, a * 1.5, y)
newBlock (a * 2 * b, -a * 0.5, y)
newBlock (a * 2 * b, -a * 1.5, y)
newBlock (a * 0.5, -a * 2 * b, y)
newBlock (a * 1.5, -a * 2 * b, y)
newBlock (-a * 0.5, -a * 2 * b, y)
newBlock (-a * 1.5, -a * 2 * b, y)
newBlock (-a * 2 * b, a * 0.5, y)
newBlock (-a * 2 * b, a * 1.5, y)
newBlock (-a * 2 * b, -a * 0.5, y)
newBlock (-a * 2 * b, -a * 1.5, y)
y = y + yDelta
newBlock (a, a * 2, y)
newBlock (a * 2, a * 2, y)
newBlock (0, a * 2, y)
newBlock (-a, a * 2, y)
newBlock (-a * 2, a * 2, y)
newBlock (a * 2, a, y)
newBlock (a * 2, 0, y)
newBlock (a * 2, -a, y)
newBlock (-a * 2, a, y)
newBlock (-a * 2, 0, y)
newBlock (-a * 2, -a, y)
newBlock (a, -a * 2, y)
newBlock (a * 2, -a * 2, y)
newBlock (0, -a * 2, y)
newBlock (-a, -a * 2, y)
newBlock (-a * 2, -a * 2, y)
# Unrem to delete any figures from the scene
#for f in poser.Scene().Figures():
# poser.Scene().SelectFigure(f)
# poser.Scene().DeleteCurrentFigure()
for p in poser.Scene().Actors():
if (p.IsProp()):
if string.find(p.Name(), "building_") != -1:
print "Deleting " + p.Name()
poser.Scene().SelectActor(p)
poser.Scene().DeleteCurrentProp()
print "Creating Cubes"
y = 0
row4x4(y)
y = y + (2 * yDelta)
row4x4(y)
y = y + (2 * yDelta)
row4x4(y)
y = y + (2 * yDelta)
row3x3(y)
y = y + (2 * yDelta)
row3x3(y)
y = y + (2 * yDelta)
row3x3(y)
y = y + (2 * yDelta)
row2x2(y)
y = y + (2 * yDelta)
row2x2(y)
y = y + (2 * yDelta)
row2x2(y)
print "Finished - pls wait while screen refreshes - this could take some time"
No comments:
Post a Comment