:The Story of Mel, a Real Programmer: =====================================

•January 24, 2008 • Leave a Comment

:The Story of Mel, a Real Programmer: =====================================
This was posted to USENET by its author, Ed Nather (utastro!nather), on May 21, 1983.
A recent article devoted to the *macho* side of programming made the bald and unvarnished statement:
Real Programmers write in FORTRAN.
Maybe they do now, in this decadent era of Lite beer, hand calculators, and “user-friendly” software but back
in the Good Old Days, when the term “software” sounded funny and Real Computers were made out of drums
and vacuum tubes, Real Programmers wrote in machine code. Not FORTRAN. Not RATFOR. Not, even,
assembly language. Machine Code. Raw, unadorned, inscrutable hexadecimal numbers. Directly.
Information prepared by the Project Gutenberg legal advisor 264
Lest a whole new generation of programmers grow up in ignorance of this glorious past, I feel duty-bound to
describe, as best I can through the generation gap, how a Real Programmer wrote code. I’ll call him Mel,
because that was his name.
I first met Mel when I went to work for Royal McBee Computer Corp., a now-defunct subsidiary of the
typewriter company. The firm manufactured the LGP-30, a small, cheap (by the standards of the day)
drum-memory computer, and had just started to manufacture the RPC-4000, a much-improved, bigger, better,
faster — drum-memory computer. Cores cost too much, and weren’t here to stay, anyway. (That’s why you
haven’t heard of the company, or the computer.)
I had been hired to write a FORTRAN compiler for this new marvel and Mel was my guide to its wonders.
Mel didn’t approve of compilers.
“If a program can’t rewrite its own code”, he asked, “what good is it?”
Mel had written, in hexadecimal, the most popular computer program the company owned. It ran on the
LGP-30 and played blackjack with potential customers at computer shows. Its effect was always dramatic.
The LGP-30 booth was packed at every show, and the IBM salesmen stood around talking to each other.
Whether or not this actually sold computers was a question we never discussed.
Mel’s job was to re-write the blackjack program for the RPC-4000. (Port? What does that mean?) The new
computer had a one-plus-one addressing scheme, in which each machine instruction, in addition to the
operation code and the address of the needed operand, had a second address that indicated where, on the
revolving drum, the next instruction was located.
In modern parlance, every single instruction was followed by a GO TO! Put *that* in Pascal’s pipe and smoke
it.
Mel loved the RPC-4000 because he could optimize his code: that is, locate instructions on the drum so that
just as one finished its job, the next would be just arriving at the “read head” and available for immediate
execution. There was a program to do that job, an “optimizing assembler”, but Mel refused to use it.
“You never know where it’s going to put things”, he explained, “so you’d have to use separate constants”.
It was a long time before I understood that remark. Since Mel knew the numerical value of every operation
code, and assigned his own drum addresses, every instruction he wrote could also be considered a numerical
constant. He could pick up an earlier “add” instruction, say, and multiply by it, if it had the right numeric
value. His code was not easy for someone else to modify.
I compared Mel’s hand-optimized programs with the same code massaged by the optimizing assembler
program, and Mel’s always ran faster. That was because the “top-down” method of program design hadn’t
been invented yet, and Mel wouldn’t have used it anyway. He wrote the innermost parts of his program loops
first, so they would get first choice of the optimum address locations on the drum. The optimizing assembler
wasn’t smart enough to do it that way.
Mel never wrote time-delay loops, either, even when the balky Flexowriter required a delay between output
characters to work right. He just located instructions on the drum so each successive one was just *past* the
read head when it was needed; the drum had to execute another complete revolution to find the next
instruction. He coined an unforgettable term for this procedure. Although “optimum” is an absolute term, like
“unique”, it became common verbal practice to make it relative: “not quite optimum” or “less optimum” or
“not very optimum”. Mel called the maximum time-delay locations the “most pessimum”.
Information prepared by the Project Gutenberg legal advisor 265
After he finished the blackjack program and got it to run (“Even the initializer is optimized”, he said proudly),
he got a Change Request from the sales department. The program used an elegant (optimized) random number
generator to shuffle the “cards” and deal from the “deck”, and some of the salesmen felt it was too fair, since
sometimes the customers lost. They wanted Mel to modify the program so, at the setting of a sense switch on
the console, they could change the odds and let the customer win.
Mel balked. He felt this was patently dishonest, which it was, and that it impinged on his personal integrity as
a programmer, which it did, so he refused to do it. The Head Salesman talked to Mel, as did the Big Boss and,
at the boss’s urging, a few Fellow Programmers. Mel finally gave in and wrote the code, but he got the test
backwards, and, when the sense switch was turned on, the program would cheat, winning every time. Mel was
delighted with this, claiming his subconscious was uncontrollably ethical, and adamantly refused to fix it.
After Mel had left the company for greener pa$ture$, the Big Boss asked me to look at the code and see if I
could find the test and reverse it. Somewhat reluctantly, I agreed to look. Tracking Mel’s code was a real
adventure.
I have often felt that programming is an art form, whose real value can only be appreciated by another versed
in the same arcane art; there are lovely gems and brilliant coups hidden from human view and admiration,
sometimes forever, by the very nature of the process. You can learn a lot about an individual just by reading
through his code, even in hexadecimal. Mel was, I think, an unsung genius.
Perhaps my greatest shock came when I found an innocent loop that had no test in it. No test. *None*.
Common sense said it had to be a closed loop, where the program would circle, forever, endlessly. Program
control passed right through it, however, and safely out the other side. It took me two weeks to figure it out.
The RPC-4000 computer had a really modern facility called an index register. It allowed the programmer to
write a program loop that used an indexed instruction inside; each time through, the number in the index
register was added to the address of that instruction, so it would refer to the next datum in a series. He had
only to increment the index register each time through. Mel never used it.
Instead, he would pull the instruction into a machine register, add one to its address, and store it back. He
would then execute the modified instruction right from the register. The loop was written so this additional
execution time was taken into account — just as this instruction finished, the next one was right under the
drum’s read head, ready to go. But the loop had no test in it.
The vital clue came when I noticed the index register bit, the bit that lay between the address and the
operation code in the instruction word, was turned on — yet Mel never used the index register, leaving it zero
all the time. When the light went on it nearly blinded me.
He had located the data he was working on near the top of memory — the largest locations the instructions
could address — so, after the last datum was handled, incrementing the instruction address would make it
overflow. The carry would add one to the operation code, changing it to the next one in the instruction set: a
jump instruction. Sure enough, the next program instruction was in address location zero, and the program
went happily on its way.
I haven’t kept in touch with Mel, so I don’t know if he ever gave in to the flood of change that has washed over
programming techniques since those long-gone days. I like to think he didn’t. In any event, I was impressed
enough that I quit looking for the offending test, telling the Big Boss I couldn’t find it. He didn’t seem
surprised.
When I left the company, the blackjack program would still cheat if you turned on the right sense switch, and
I think that’s how it should be. I didn’t feel comfortable hacking up the code of a Real Programmer.
Information prepared by the Project Gutenberg legal advisor 266
This is one of hackerdom’s great heroic epics, free verse or no. In a few spare images it captures more about
the esthetics and psychology of hacking than all the scholarly volumes on the subject put together. For an
opposing point of view, see the entry for {real programmer}.
[1992 postscript --- the author writes: "The original submission to the net was not in free verse, nor any
approximation to it --- it was straight prose style, in non-justified paragraphs. In bouncing around the net it
apparently got modified into the `free verse' form now popular. In other words, it got hacked on the net. That
seems appropriate, somehow."]

I dig that shit man wow

Worst Contextual Ad Mess Up of All-Time!

•January 14, 2008 • Leave a Comment

This one defies description. You’ve got to see it to believe it.

read more | digg story

simplest ui snippet

•January 8, 2008 • Leave a Comment

import Blender
from Blender.Draw import *
def ui():
Label("stuff",30,30,50,50)
def ev(e,v):
if not v:return
print e,"\t",v
if e==QKEY:Exit()
Register(ui,ev,None)

another script for blender

•January 7, 2008 • Leave a Comment

#!BPY
“”"
Name:’EyeFab’
Blender:245
Group:’Mesh’
Tooltip:’an odd tool’
“”"
import Blender
import bpy
from Blender import Draw
from Blender import Window
import math
global N                                # number which is used in moduli op w/ vert.indices
global inv_mod_truthex                  # either selects when remainder is zero or not zero. could add offset here
global color_a,color_b,color_c,color_d  # solid face : solid vert /:/ blend face : blend vert
global init_color_a,init_color_b
global init_color_c,init_color_d
global skipping_hidden                  # when enabled skips hidden during n select operations
global irf,igf,ibf                      # initial rgb sine mutilators
global showhelp
showhelp=False
irf=1.1000001
igf=1.1000002
ibf=1.1000003
gridmax=64                              # a rather smallish grid hardcoded here
N = 2                                   # every other vertex by index
skipping_hidden=False                 # starts out disabled
inv_mod_truthex = False               # starts out disabled
init_color_a=(0.5, 0.5, 0.5)            # grey
init_color_b=(0.5, 0.5, 0.5)
init_color_c=(0.5, 0.5, 0.5)
init_color_d=(0.5, 0.5, 0.5)

# Theres work in progress here—->
class SineModule:
def __init__(self,freq):
self.freq=freq
def getN(self,n):
return int(math.sin(self.freq*n)*128)+128

class FqMultiModule:
def __init__(self,FqModuleSet):
self.fqs=[]
for fq in FqModuleSet:
self.fqs.append(SineModule(fq))
def getN(self,n):
ret=[]
for fq in self.fqs:
ret.append(fq.getN(n))
return ret

scn=Blender.Scene.GetCurrent()          # scn that x 1,000,000
meshes = [me for me in scn.objects.selected if (me.type=='Mesh')]
if len(meshes)<1:                       # checking for at least one selected mesh
scn.objects.selected=[]         # but otherwise make a grid (user input res)
res=Draw.PupIntInput(“res for grid:”,32,4,gridmax)
if res==None:Blender.Draw.Exit()# how rude
newGrid=Blender.Mesh.Primitives.Grid(res,res,2)
newObject=scn.objects.new(newGrid,”newGrid”)
scn.objects.active=newObject
Window.RedrawAll()
Window.EditMode(0)
scn=Blender.Scene.GetCurrent()          # scn that x 1,000,001
scn.objects.active.drawType=5
Window.RedrawAll()
sce= bpy.data.scenes.active             # now for the bpy part so certain key things are easier than w/o bpy
ob_act = sce.objects.active
obj= ob_act.getData(mesh=1)
obj.vertexColors=True                   # careful: if you already have vertex colors of your own
# make them a new channel at least so they dont get destroyed in a moment
# and a reinit in case…
def reinit(evt=None,val=None):
global obj
scn=Blender.Scene.GetCurrent()
meshes = [me for me in scn.objects.selected if (me.type=='Mesh')]
if len(meshes)<1:
scn.objects.selected=[]
res=Draw.PupIntInput(“res for grid:”,32,4,gridmax)
if res==None:Blender.Draw.Exit()
newGrid=Blender.Mesh.Primitives.Grid(res,res,2)
newObject=scn.objects.new(newGrid,”newGrid”)
scn.objects.active=newObject
Window.RedrawAll()
Window.EditMode(0)
scn=Blender.Scene.GetCurrent()
scn.objects.active.drawType=5
Window.RedrawAll()
sce= bpy.data.scenes.active
ob_act = sce.objects.active
obj= ob_act.getData(mesh=1)
obj.vertexColors=True

def selN(sl):
Window.EditMode(0)
Window.WaitCursor(1)
if skipping_hidden:             # If skipping hidden–
# mostly because im bad about coming up with descriptive variable names hehe
these=[v for v in obj.verts if (v.hide==0)]     # for each no hidden vertice:
for j,v in enumerate(these):                    # for each of those by number:
i=v.index
if not inv_mod_truthex:
if (j % N)==0:                  # thars some maths
specific=obj.verts[i]   # required here.
specific.sel=sl
elif inv_mod_truthex:
if (j % N)>0:
specific=obj.verts[i]
specific.sel=sl
elif not skipping_hidden:
for v in obj.verts:
i=v.index
if not inv_mod_truthex:
if (i % N)==0:
specific=obj.verts[i]
specific.sel=sl
elif inv_mod_truthex:
if (i % N)>0:
specific=obj.verts[i]
specific.sel=sl
Window.WaitCursor(0)
Window.EditMode(1)
def hidesel(ornot=0):
Window.EditMode(0)
Window.WaitCursor(1)
if not ornot:
for v in obj.verts:
v.hide=v.sel
elif ornot:
v.hide=not v.sel
Window.WaitCursor(0)
Window.EditMode(1)

# associated with the colorpickers:
def colorSelFaceVerts_solid(evt,val):
global init_color_a
red=int(val[0]*255)
gre=int(val[1]*255)
blu=int(val[2]*255)
init_color_a=val
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
selected_faces = []
for f in obj.faces:
if f.sel:
selected_faces.append(f)
for f in selected_faces:
for i,v in enumerate(f):
col=f.col[i]
col.r=red
col.g=gre
col.b=blu
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)
def colorSelFaceVerts_blend(evt,val):
global init_color_b
red=int(val[0]*255)
gre=int(val[1]*255)
blu=int(val[2]*255)
init_color_b=val
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
selected_faces = []
for f in obj.faces:
if f.sel:
selected_faces.append(f)
for f in selected_faces:
for i,v in enumerate(f):
col=f.col[i]
col.r=(col.r+red)/2
col.g=(col.g+gre)/2
col.b=(col.b+blu)/2
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)

def colorSelVerts_solid(evt,val):
global init_color_c
red=int(val[0]*255)
gre=int(val[1]*255)
blu=int(val[2]*255)
init_color_c=val
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
for f in obj.faces:
for i,v in enumerate(f):
if v.sel:
col=f.col[i]
col.r=red
col.g=gre
col.b=blu
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)
def colorSelVerts_blend(evt,val):
global init_color_d
red=int(val[0]*255)
gre=int(val[1]*255)
blu=int(val[2]*255)
init_color_d=val
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
selected_faces = []
for f in obj.faces:
for i,v in enumerate(f):
if v.sel:
col=f.col[i]
col.r=(col.r+red)/2
col.g=(col.g+gre)/2
col.b=(col.b+blu)/2
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)

def onlyface(evt=None,val=None):
# i made this one cuz i thought it should be in blender
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
selected_faces = [f for f in obj.faces if (f.sel==1)]
for f in obj.faces:
f.sel = 0
for f in selected_faces:
for v in f.verts:
v.sel=1
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)

def swapsel(evt=None,val=None):
# and this is just handy to have around with single key shortcut
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
for v in obj.verts:
v.sel = not v.sel
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)

def colorCycle(evt=None,val=None):
# here we have some more math action
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
mt=Blender.Get(‘curframe’)
freq_set=FqMultiModule([irf,igf,ibf])
for f in obj.faces:
for i,v in enumerate(f.verts):
if v.sel==1:
r,g,b=freq_set.getN(v.index)
f.col[i].r=r
f.col[i].g=g
f.col[i].b=b
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)
def selall():
# and another reinvented wheel just for convenience
eMode=Window.EditMode()
if eMode:
Window.EditMode(0)
Window.WaitCursor(1)
foundany=obj.verts.selected()
selcount=len(foundany)
if selcount>0:
for vix in foundany:
obj.verts[vix].sel=0
else:
for v in obj.verts:
obj.verts[v.index].sel=1
if eMode:
Window.EditMode(1)
Window.WaitCursor(0)

def ui():
#the draw loop
W,H=Window.GetAreaSize()
x=y=12
lh=2*x
lw=cpw=cph=(W/2)-x
s_n=”N:%d” % N
s_v=”in(V):%s” % inv_mod_truthex
s_skip=”(s)kip:%s” % skipping_hidden
s_dim=”w%d h%d” % (W,H)
Draw.Label(s_n,x,y,lw,lh)
y+=lh
hey_skip=Draw.Toggle(s_skip,7,x,y,lw,lh,skipping_hidden,”skip hidden verts during (un)select iteration”,skiptog)
y+=lh
vTog=Draw.Toggle(s_v,9,x,y,lw,lh,inv_mod_truthex,”invert truth of mod expressions”,vtog)
y+=lh
Draw.Label(“==”, x, y,lw,lh)
Draw.Label(“&=”, x+lw, y,lw,lh)
y+=lh
Draw.Label(“f”, 0, y, lw, lh)
color_a=Draw.ColorPicker(1,x,y,cpw,cph, init_color_a, “colors faces 100 percent”, colorSelFaceVerts_solid)
color_b=Draw.ColorPicker(2,x+cpw,y,cpw,cph, init_color_b, “colors sel v”, colorSelFaceVerts_blend)
y+=cph
Draw.Label(“v”, 0, y, lw, lh)
color_c=Draw.ColorPicker(3,x,y,cpw,cph, init_color_c, “colors sel v”, colorSelVerts_solid)
color_d=Draw.ColorPicker(4,x+cpw,y,cpw,cph, init_color_d, “colors sel v”, colorSelVerts_blend)
y+=cph
rf=Draw.Number(“rf”,3, x,y,lw,lh,irf,0.00001,2.000,” “,set_rf)
Draw.Button(“go”,8,x+lw,y,lw,3*lh,”cycle colors”,colorCycle)
y+=lh
gf=Draw.Number(“gf”,4, x,y,lw,lh,igf,0.00001,2.000,” “,set_gf)
y+=lh
bf=Draw.Number(“bf”,5, x,y,lw,lh,ibf,0.00001,2.000,” “,set_bf)
y+=lh
Draw.Button(“oFacev”,10,x,y,lw,lh,”select only verts that contribute to face selection”,onlyface)
Draw.Button(“sWap”,13,x+lw,y,lw,lh,”select whatnot”,swapsel)
y+=lh
Draw.Button(“reinit”,11,x,y,lw,lh,”in case you select a dif ob”,reinit)
s_help= “?:%s” % showhelp
helpTog = Draw.Toggle(s_help,12,x+lw,y,lw,lh,showhelp,”toggles help text”,helptog)
y+=lh
if showhelp==True:
i=0
Draw.Label(“[controls]“,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“————–”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“L mouse- sel by n”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“R mouse- unsel by n”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“wheel- to set n”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“w/shift- also sel”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“w/ctrl- also un”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“w- swaps”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“v- togs mod truth”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“s- togs skip hid”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“f- for only faces”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“h- to hide”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“a- sel none/all”,x,y+(lh*i),lw*2,lh)
i+=1
Draw.Label(“—————”,x,y+(lh*i),lw*2,lh)
i+=1

#—————————————
#                                       )
#       button callback functions—–>
#                                       )
#—————————————
def helptog(evt,val):
global showhelp
if val:
showhelp=True
else:
showhelp=False

# the color stuff
def vtog(evt,val):
global inv_mod_truthex
if val:
inv_mod_truthex=True
else:
inv_mod_truthex=False

def skiptog(evt,val):
global skipping_hidden
if val:
skipping_hidden=True
else:
skipping_hidden=False
def set_rf(evt,val):
global irf
irf=val
def set_gf(evt,val):
global igf
igf=val
def set_bf(evt,val):
global ibf
ibf=val
# this other event type could have been just ‘None’
def eva(evt):
print “what?”,evt,”me worry?”

# and the keyboard stuff—>
def evz(evt,val):
# These here are the user input events:
global N,inv_mod_truthex,skipping_hidden
qk = Window.GetKeyQualifiers()
print qk
# left and right click:
if (evt==Draw.LEFTMOUSE) and val:
selN(1)
if (evt==Draw.RIGHTMOUSE) and val:
selN(0)
# spacebar to exit
if (evt==Draw.SPACEKEY) and val:
Draw.Exit()
if (evt==10) and val:
N+=1
if qk==3:selN(1)

if (evt==11) and val:
if N>2:
N-=1
if qk==3:selN(1)
# work in progress re ctrl button stuff
if (evt==Draw.HKEY) and val:
hidesel()
if (evt==Draw.JKEY) and val:
hidesel(1)
if (evt==Draw.VKEY) and val:
inv_mod_truthex = not inv_mod_truthex
if (evt==Draw.SKEY) and val:
skipping_hidden=not skipping_hidden
if (evt==Draw.TABKEY) and val:
Window.EditMode(not Window.EditMode())
if (evt==Draw.FKEY) and val:
onlyface()
if (evt==Draw.WKEY) and val:
swapsel()
if (evt==Draw.AKEY) and val:
selall()
if (evt==Draw.ZKEY) and val:
colorCycle()
Draw.Redraw()
#++++++++++++++++++++++++++++++++++++Fire it up, man!
Draw.Register(ui,evz,eva)

vertex color animation script blender

•January 6, 2008 • Leave a Comment

make a mesh i like grids

  1. make vertex colors on it
  2. make material and turn on vcol paint
  3. set drawtype to textured
  4. open text window and load this script:

wordpress invariably destroys my python when i try and put it in code tags for ya, sorry.  you’ll haftu fix the indents but hay what fun

#!BPY
“”"
Name:’AYVABTU’
Blender:245
Group:’Mesh’
Tooltip:’Selects Vertice moduli indices’
“”"
import Blender
import bpy
from Blender import Draw
from Blender import Window
from Blender import sys
import math
global N,inverting_modulus_truth,color_a,color_b,init_color_a,init_color_b,skipping_hidden,irf,igf,ibf
irf=igf=ibf=1.005
N = 2
skipping_hidden=bool(0)
inverting_modulus_truth = bool(1)
init_color_a=(0.8, 0.2, 0.8)
init_color_b=(0.2, 0.8, 0.2)
class Freq:
def __init__(self,freq):
self.freq=freq
def getN(self,n):
return int(math.sin(self.freq*n)*128)+128

class freqs:
def __init__(self,freqset):
self.fqs=[]
for fq in freqset:
self.fqs.append(Freq(fq))
def getN(self,n):
ret=[]
for fq in self.fqs:
ret.append(fq.getN(n))
return ret

t= Blender.sys.time()
print “===================[%s]======” % t
###########################################
scn=Blender.Scene.GetCurrent()
meshes = [me for me in scn.objects.selected if (me.type=='Mesh')]
if len(meshes)<1:
scn.objects.selected=[]
res=Draw.PupIntInput(“res for default grid:”,32,2,100)
if res==None:Blender.Draw.Exit()
nu=Blender.Mesh.Primitives.Grid(res,res,2)
nuob=scn.objects.new(nu,”nu”)
scn.objects.active=nuob
Window.RedrawAll()
Window.EditMode(0)
sce= bpy.data.scenes.active
ob_act = sce.objects.active
obj= ob_act.getData(mesh=1)
obj.vertexColors=True
Window.EditMode(0)

mt=Blender.Get(‘curframe’)
print “frame:”
print “\t”,mt

freq_set=freqs([irf+mt,igf+mt,ibf+mt])
for f in obj.faces:
for i,v in enumerate(f.verts):
if v.sel==1:
r,g,b=freq_set.getN(v.index)
print “–r%d g%d b%d–” %(r,g,b)
f.col[i].r=r
f.col[i].g=g
f.col[i].b=b

  1. go to script links and make a world scriptlink on framechanged that runs the text whalleva ucallit
  2. change the frame forward manually with arrow key
  3. tab into and out of the object
  4. you should see results but sometimes tinkering is needed
  5. now you can render an animation or just watch it slowly
  6. big meshes obviously cooler than little ones

luv 4 py thotz

•December 31, 2007 • Leave a Comment

waaaay back before i ever even started my career as a geek, i remember my mentor telling me to learn python.

this was 96.

i learned it last week.

python : other languages    —>   mice :  punch cards

think like a human again, program in python

[end rant]

More namestorming for blender site idea:

•December 28, 2007 • Leave a Comment

on the way back from having CHRISTmas eve gumbo at anne and charles’s i rode home in the back of dad’s pickup.

its not legal anymore, but its a good way to have your head jostled until ideas com out.

charles is very very zen, and this led me to try putting the word zen on the end of blender.

blendzen.com has an excellent ring to it, not to mention that it fits equally well in meaning.
i wiki’d zen and was reminded that ‘zen’ in other parts of the world– one might also call dhyana

blendhyana.com would be the sister site with internationalizations.

and then the typo site:  blendyhana.com — which is not bad in itself ( benihana )

so, lets recap, i rode in a truck and thought of blendzen.com.  also blendhyana.com and blendyhana.com

so now, days later, im writing and i think thats enough.  because there could be no end.  blendharma, anyone?

python script for blender: select every nth vertex of a mesh

•December 22, 2007 • 3 Comments

i learnt python today. love it.  much like blender in quirkiness factor.  wrote this simple script to do just what it say it do:

#!BPY
“”"
Name: ‘Select Every Nth Vert’
Blender: 244
Group: ‘Mesh’
Tooltip: ‘Selects every nth vertex of active mesh’
“”"
#12/21/07 dustractor@gmail.com

import Blender

from Blender.BGL import *
from Blender.Draw import *
from Blender.Window import *
from Blender.Mesh import *
import BPyMessages
import bpy

# Events
EVENT_NOEVENT = 1
EVENT_DRAW = 2
EVENT_EXIT = 3
global ator
global initator
initator=2
######################################################
# GUI drawing
######################################################
def draw():
global ator, initator

global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT

########## Titles
glClear(GL_COLOR_BUFFER_BIT)
glRasterPos2d(8, 103)
Text(“selection iterator”)

######### Parameters GUI Buttons
glRasterPos2d(8, 83)
Text(“Parameters:”)
ator = Number(“ator: “, EVENT_NOEVENT, 10, 55, 210, 18,
initator, 2, 99, “Number to iterate by “);

######### Draw and Exit Buttons
Button(“Draw”,EVENT_DRAW , 10, 10, 80, 18)
Button(“Exit”,EVENT_EXIT , 140, 10, 80, 18)
def event(evt, val):
if (evt == QKEY and not val):
Exit()

def bevent(evt):
global ator,initator
global EVENT_NOEVENT,EVENT_DRAW,EVENT_EXIT
######### Manages GUI events
if (evt == EVENT_EXIT):
Exit()
elif (evt== EVENT_DRAW):
initator=ator.val
theIteration()

Register(draw, event, bevent)

######################################################
# Main Body
######################################################
def theIteration():
global ator
iter=0
t = Blender.sys.time()
sce = bpy.data.scenes.active
ob_act = sce.objects.active
if not ob_act or ob_act.type != ‘Mesh’:
BPyMessages.Error_NoMeshActive()
return
is_editmode = Blender.Window.EditMode()
if is_editmode:
Blender.Window.EditMode(0)
Blender.Window.WaitCursor(1)
theMesh = ob_act.getData(mesh=1)
for v in theMesh.verts:
iterator=iter%ator.val
iter+=1
if iterator==1:
v.sel=1
if iterator==0:
v.sel=0

if is_editmode:
Blender.Window.EditMode(1)
print ‘My Script finished in %.2f seconds’ % (Blender.sys.time()-t)
Blender.Window.WaitCursor(0)
Redraw()

•December 18, 2007 • Leave a Comment

alternative-to-some-other-render.jpgdatwudbit-boo.jpgmake-bigger-one1.jpg

study on tree, bark, leaves, clouds, and stuff

•December 14, 2007 • Leave a Comment

lone-tree-cliche2.jpg
a few more adjustments …