I can only help you on the 1st question: Here you can find what you’ll need as a tutorial. This is the API doc for Blender.
And the forum is a good place to learn. Try to read and understand the scripts found within Blender too…
Good luck !
to that 2nd problem: i’ll try to explain it bit more.
i want to achieve this: blender loads an image. script creates a list of doubles containing the current coordinates (eg. if an image size is 30x50, the list would be (0,0),(0,1),(0,2)…). then the script iterates through each of the coordinates, writing down the color value, whether it’s black or white ((0,0)=1, (0,1)=0)…
what modules should i use to get the image-unpacking?
The class Image has the methods “getPixelF(x, y)” and “getPixelI(x, y)” which give you the information you want. (Don’t tangle up Blender Units and Pixels g)
Also, I found that doing the python walk through that comes with python was very helpful, if you don’t know how to program in python already. It doesn’t take too log to read through and do a few examples. Good investment of time.
import Blender
from Blender import Image
#
image = Image.Load("/path/to/my/image.png") # load an image file
myPixelDepth = image.getDepth()
#Check for two color image.
if myPixelDepth < 2:
aryImageMetrics = image.getSize()
myWidth = aryImageSize[0]
myHeight = aryImageSize[1]
for y in range(myHeight):
for x in range(myWidth:
myRGBA = image.getPixelI(x, y)
obrazok=Image.Load("/home/eidam/Pictures/test.jpg")
print obrazok.getFilename()
new_thing=NMesh.GetRaw()
dimensions=obrazok.getSize()
width=dimensions[0]
height=dimensions[1]
for a in range(width):
for b in range(height):
colInfo=obrazok.getPixelF(a,b)
#print colInfo #for debugging, uncomment this line
if colInfo[0]==colInfo[1]==colInfo[2]<float(0.5):
vrtx=NMesh.Vert(a,b,0)
new_thing.verts.append(vrtx)
NMesh.PutRaw(new_thing,'new_thing',1)
Blender.Redraw()
i am just wondering how to do this modeller with the third dimension