I’m trying to create a bunch of blender textures to use as brushes in a script…
Ideally I’ll make this an operator that can be pointed at any directory and load all the images and add then to textures…
in 2.49 I could:
directory = "/media/mikedata/Projects/Alphabrushes"
file = os.listdir(directory)
for f in file:
img = bpy.data.images.new()
img.name = f
img.filename = directory + f
tex = bpy.data.textures.new()
tex.name = f
tex.type = 8
tex.image = img
but in 2.5 there doesn’t seem to be an equivalent to " bpy.data.images.new"
Also, in 2.49 you could call a file selector as follows:
from Blender import Window
def my_callback(filename): # callback for the FileSelector
print "You chose the file:", filename # do something with the chosen file
Window.FileSelector (my_callback, "Choose one!")
what is the equivalent in 2.5?
It seems to me that there are operators for blend files via selector and images via selector…
but I can’t figure out the general case…
That sounds resonable. Right now we simply changed an attribute (“type”) inside the texture object.
Now we need to tell Blender to “change” the object according to this attribute (i think) … which then also has an “image” attribute.
Will try this when I get some time.