Created
March 31, 2017 17:19
-
-
Save akloster/d2cff07a9dc336a171293bc3633d24a6 to your computer and use it in GitHub Desktop.
create an image caption in blender python part 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open template .blend | |
path = os.path.dirname(__file__) | |
template_path="/"+os.path.join(path,"blends",template+".blend") | |
if not os.path.exists(template_path): | |
print(prog_name + "could not find this template file: '%s'" % template_path) | |
sys.exit(1) | |
bpy.ops.wm.open_mainfile(filepath=template_path) | |
# Change text | |
bpy.data.objects["Text"].data.body = text | |
# Render output image | |
bpy.context.scene.render.filepath = output | |
bpy.context.scene.render.resolution_x = 1900 | |
bpy.context.scene.render.resolution_y = 1080 | |
bpy.ops.render.render(write_still=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment