Skip to content

Instantly share code, notes, and snippets.

@herronelou
Created December 2, 2021 21:41
Show Gist options
  • Save herronelou/4c5fa19d45701d62efc86ce29a5cd7c5 to your computer and use it in GitHub Desktop.
Save herronelou/4c5fa19d45701d62efc86ce29a5cd7c5 to your computer and use it in GitHub Desktop.
Pixel Orca
""" Create A pixellated Orca, similar to the scupture in Vancouver """
import nuke
blocks = [('a', 0), ('b', .1), ('c', .5), ('d', 1)]
colors = {k: nuke.nodes.Constant(color='{0} {0} {0} 1'.format(c)) for k,c in blocks}
scene = nuke.nodes.Scene()
scene.setSelected(True)
index = x = y = z = c = m = 0
data = '9y9y3yaz9y9y3yaa9z9z4zxz9y9y3yaaz9y9y3y3az9y9y3y3a8z9y9y5y7az9y9y6y8az9y9y7yaabdd3az'\
'9y9y9y5daaz9y9y9yybc3da8zxzz9y9y3y3az9y9y3y3az9y9y3y3az9y9y5ya3z9y9yyy7az9y9yyy9az9y9yyy9aaaz9y'\
'9yyy4a6y3az9y9y3y3a8yaaz9y9y4y3a8yaaz9y9y5y4a6y3az9y9y7y3a5y3az9y9y9y9az9y9y9y3yb5d6zx3z9y9yyy4'\
'az9y9yyy5az9y9yy6az9y9yy6az9y9y8az9y8y4a5y3az9y7y4a8y3az9y7yb3a9yyaaz9y8y3a9y3yaaz9y9y3a9y3yaaz'\
'9y9yy3a9y4yaz9y9y3yaa9y3yaz9y9y5yaa9yyyaz9y9y7y3a8yaz9y9y6y5abdd4yaz9y9y6y4a4y4dzz9y9y4y4az9y9y'\
'3y4azzx4z9y9yyyaaz9y9yaay4az9y8yaa5yaaz9y7yaa7yaaz9y6yaa9yy3az9y5ycba9y4yaaz9y5ydda9y6yaz9y6ydb'\
'a9y6yaz9y7ydba9y6yaz9y9y3a9y5yaz9y9yyyaa9y5yaz9y9y4yaa9y3ybz9y9y5yaa9yyydz9y9y6yayyab3d4ybz9y9y6'\
'yayya4y4dz9y9y5y5az9y9y4y4a3zx5z9y9y7az9y6y3a6yaaz9y4y3a9y3az9y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9yyyddyydcaaz9yy7dc3az9y9dbaaz9'\
'ydc3abc3dz9y9y9yyy3az9y9y9yyy3a3zyyaz3azaazaza3zx9z3z9y9y9yyy3az9y9y9y3ya4z3azyazaza3zx9zzz9y9y9'\
'y3yaaz9y9y9yyy3a6zaazaza3zx9zzz9y9y9y3yaa7zazaza3zx9zzz9y9y9y3yab8zaza3zx9z9zzza3zx9z9z5z'
for blk in data:
if blk.isdigit():
m = int(blk)
else:
for _ in range(m):
if blk == 'y':
y += 1
elif blk == 'x':
y = z = 0
x += 1
elif blk == 'z':
z += 1
y = 0
else:
n = nuke.nodes.Cube(translate='{0} {1} {2}'.format(x, y, z))
n.setInput(0, colors[blk])
scene.setInput(index, n)
y += 1
index += 1
m=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment