Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. import bpy
  2. cam = bpy.data.objects["Camera"]
  3. cam.rotation_mode = 'XYZ'
  4. cam.location = (1.5,0,3)
  5. cam.rotation_euler = (0.5236,0,1.5707)
  6. alamp = bpy.data.objects["Lamp"]
  7. alamp.location = (1,0,1)
  8. alamp.rotation = (0,0,0)
  9. meshObj = bpy.data.objects["boss"]
  10. meshObj.rotation_mode = 'XYZ'
  11. meshObj.rotation_euler = (0,0,0)
  12. d = meshObj.dimensions
  13.  
  14. # Finding maximum dim of the object
  15. objectScale = 1
  16. if d[1] >= d[2] and d[1] >= d[0]:
  17. objectScale = 1 / d[1]
  18. elif d[2] >= d[1] and d[2] >= d[0]:
  19. objectScale = 1 / d[2]
  20. elif d[0] >= d[1] and d[0] >= d[2]:
  21. objectScale = 1 / d[0]
  22.  
  23. # Normalize object since some of them are bigger
  24. print("Scaling ",objectScale)
  25. meshObj.scale = (objectScale,objectScale,objectScale)
  26.  
  27. # Rotating X axis if object is X -Z Y Convert to X Y Z
  28. rot = meshObj.rotation_euler
  29. if d[1] > d[2]:
  30. print("Rotating X by 90 Degree")
  31. rot[0] = radians(90)
  32. meshObj.rotation_euler = rot;
  33. # Initiating the Rotation/Render Loop
  34. rot[2] = 0 # Start from Z Rotation = 0
  35. meshObj.rotation_euler = rot;
  36. for x in range(1,8):
  37. angle = (x-1)*0.7854
  38. rot[2] = angle
  39. meshObj.rotation_euler = rot;
  40. bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/Boss00%d.png" % (x)
  41. bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement