SHARE
TWEET

Untitled

a guest Apr 21st, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. DIR ="/home/path/to/folder"
  3. bg_file = os.path.join(DIR, "myimage.jpg")
  4. bg_img = bpy.data.images.load(bg_file)
  5. bpy.data.scenes['Scene'].render.filepath = os.path.join(DIR, "image")
  6. bpy.context.scene.camera = bpy.data.objects['Camera']
  7. bpy.ops.render.render(write_still=True)
  8.    
  9. import bpy
  10. filepath = "/home/path/to/folder"
  11. img = bpy.data.images.load(filepath)
  12.  
  13. for area in bpy.context.screen.areas:
  14.     if area.type == 'VIEW_3D':
  15.         space_data = area.spaces.active
  16.         bg = space_data.background_images.new()
  17.         bg.image = img
  18.         break
  19.  
  20. cam = bpy.data.cameras.new("Camera")
  21. cam_ob = bpy.data.objects.new("Camera", cam)
  22. bpy.context.scene.camera = cam_ob
  23. bpy.context.scene.objects.link(cam_ob)
  24. bpy.context.scene.objects.active = bpy.context.scene.objects["Camera"]
  25.    
  26. import bpy
  27. bpy.ops.import_image.to_plane(files=[{"name":"starfield.jpg", "name":"starfield.jpg"}], directory="/home/eli/Pictures/Blend/Python/")
  28. bpy.context.object.scale[0] = 9
  29. bpy.context.object.scale[1] = 16
  30. bpy.ops.transform.translate(value=(0, 0, -3))
  31.    
  32. import os
  33. import bpy
  34.  
  35. DIR ='/home/eli/Pictures/Blend/Python/'
  36. bg_file = os.path.join(DIR, 'starfield.jpg')
  37. bg_img = bpy.data.images.load(bg_file)
  38.  
  39. for area in bpy.context.screen.areas:
  40.     if area.type == 'VIEW_3D':
  41.         space_data = area.spaces.active
  42.         bg = space_data.background_images.new()
  43.         bg.image = bg_img
  44.         break
  45.  
  46. bpy.data.scenes['Scene'].render.filepath = bg_file
  47. bpy.context.scene.camera = bpy.data.objects['Camera']
  48. bpy.ops.render.render(write_still=True)
  49.    
  50. bpy.data.worlds['World'].node_tree.nodes['Background'].type
  51. 'BACKGROUND'
  52.    
  53. bpy.data.worlds['World'].node_tree.nodes.new('bpy.types.ShaderNodeBackground(img)')
RAW Paste Data
Top