davegimo

comandi-utili-blender

Mar 22nd, 2020
150
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Comandi utili per blender
  2.  
  3. #Render immagine
  4.  
  5. bpy.context.scene.render.filepath = 'path-immagine/filename.jpg'
  6. bpy.context.scene.render.resolution_x = w #perhaps set resolution in code
  7. bpy.context.scene.render.resolution_y = h
  8. bpy.ops.render.render(write_still = True)
  9.  
  10.  
  11. #Rotazione oggetto
  12.  
  13. bpy.ops.transform.rotate(value=-1.57293, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True,snap_point=(VETTORE del  nodo interessato))
  14.  
  15.  
  16. #Esempio su cubo:
  17.  
  18. bpy.ops.transform.rotate(value=-1.57293, orient_axis='Z', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False, release_confirm=True,snap_point=bpy.data.objects["Cube"].data.vertices[0].co)
  19.  
  20.  
  21.  
  22. #spostare oggetto su (location. x,y,z   ecc..):
  23.  
  24. bpy.data.objects["Cube"].location.x += 2
  25.  
  26.  
  27. #per cambiare l'active_object (selezione)
  28.  
  29. bpy.context.view_layer.objects.active = bpy.data.objects['Sphere']
  30.  
  31.  
  32. #per cambiare la selezione nel viewport
  33.  
  34. bpy.data.objects["Cube"].select_set(True)
  35.  
  36. #rotazione_axis
  37.  
  38. petalo.rotation_euler.rotate_axis('X', radians(-180))
  39.  
  40.  
  41. # rotazione su asse locale
  42.  
  43. for i in range(30):
  44.     bpy.context.scene.render.filepath = 'C:/Users/ghedi/Desktop/A' + str(i) + '.jpg'
  45.     bpy.data.objects["Plane"].rotation_euler.rotate_axis('Y', radians(3))
  46.     bpy.ops.render.render(write_still = True)
RAW Paste Data