Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- DIR ="/home/path/to/folder"
- bg_file = os.path.join(DIR, "myimage.jpg")
- bg_img = bpy.data.images.load(bg_file)
- bpy.data.scenes['Scene'].render.filepath = os.path.join(DIR, "image")
- bpy.context.scene.camera = bpy.data.objects['Camera']
- bpy.ops.render.render(write_still=True)
- import bpy
- filepath = "/home/path/to/folder"
- img = bpy.data.images.load(filepath)
- for area in bpy.context.screen.areas:
- if area.type == 'VIEW_3D':
- space_data = area.spaces.active
- bg = space_data.background_images.new()
- bg.image = img
- break
- cam = bpy.data.cameras.new("Camera")
- cam_ob = bpy.data.objects.new("Camera", cam)
- bpy.context.scene.camera = cam_ob
- bpy.context.scene.objects.link(cam_ob)
- bpy.context.scene.objects.active = bpy.context.scene.objects["Camera"]
- import bpy
- bpy.ops.import_image.to_plane(files=[{"name":"starfield.jpg", "name":"starfield.jpg"}], directory="/home/eli/Pictures/Blend/Python/")
- bpy.context.object.scale[0] = 9
- bpy.context.object.scale[1] = 16
- bpy.ops.transform.translate(value=(0, 0, -3))
- import os
- import bpy
- DIR ='/home/eli/Pictures/Blend/Python/'
- bg_file = os.path.join(DIR, 'starfield.jpg')
- bg_img = bpy.data.images.load(bg_file)
- for area in bpy.context.screen.areas:
- if area.type == 'VIEW_3D':
- space_data = area.spaces.active
- bg = space_data.background_images.new()
- bg.image = bg_img
- break
- bpy.data.scenes['Scene'].render.filepath = bg_file
- bpy.context.scene.camera = bpy.data.objects['Camera']
- bpy.ops.render.render(write_still=True)
- bpy.data.worlds['World'].node_tree.nodes['Background'].type
- 'BACKGROUND'
- bpy.data.worlds['World'].node_tree.nodes.new('bpy.types.ShaderNodeBackground(img)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement