I'm trying to use Blender's mesh displacement from a script to create stl's. Once this works, I'll run blender with --background to create the stl files from the command line.
I start Blender with:
blender ~/3D/Models/4x4UVSquare.blend -d -P ./test.py
the script is:
import bpy
bpy.ops.image.open(filepath="junk.jpg", \
directory="/Users/me/3D/Art Work/", \
files=[{"name":"junk.jpg", "name":"junk.jpg"}], \
relative_path=True, show_multiview=False \
)
bpy.data.images["junk.jpg"].reload()
bpy.data.textures['displaceImage'].image = bpy.data.images['junk.jpg']
I put in the ".reload()" hoping it would help. It doesn't. Blender starts up, loads the .blend file, loads the image and assigns the image to the texture. When the UI comes up and displays the scene, there's no displacement. In the UI Image area under Texture, the filename is correct, but a little message reads "Can't load image".
When I hit the "reload" icon, the image reloads, the displacement appears and all it well.
Why do I have to reload the image at all? Why doesn't image.reload() work in the script?