Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- cam = bpy.data.objects["Camera"]
- cam.rotation_mode = 'XYZ'
- cam.location = (1.5,0,3)
- cam.rotation_euler = (0.5236,0,1.5707)
- alamp = bpy.data.objects["Lamp"]
- alamp.location = (1,0,1)
- alamp.rotation = (0,0,0)
- meshObj = bpy.data.objects["boss"]
- meshObj.rotation_mode = 'XYZ'
- meshObj.rotation_euler = (0,0,0)
- d = meshObj.dimensions
- # Finding maximum dim of the object
- objectScale = 1
- if d[1] >= d[2] and d[1] >= d[0]:
- objectScale = 1 / d[1]
- elif d[2] >= d[1] and d[2] >= d[0]:
- objectScale = 1 / d[2]
- elif d[0] >= d[1] and d[0] >= d[2]:
- objectScale = 1 / d[0]
- # Normalize object since some of them are bigger
- print("Scaling ",objectScale)
- meshObj.scale = (objectScale,objectScale,objectScale)
- # Rotating X axis if object is X -Z Y Convert to X Y Z
- rot = meshObj.rotation_euler
- if d[1] > d[2]:
- print("Rotating X by 90 Degree")
- rot[0] = radians(90)
- meshObj.rotation_euler = rot;
- # Initiating the Rotation/Render Loop
- rot[2] = 0 # Start from Z Rotation = 0
- meshObj.rotation_euler = rot;
- for x in range(1,8):
- angle = (x-1)*0.7854
- rot[2] = angle
- meshObj.rotation_euler = rot;
- bpy.context.scene.render.filepath = "/Users/iman/Documents/Render/Boss00%d.png" % (x)
- bpy.ops.render.render(write_still=True, use_viewport=True, scene="Camera")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement