bpy scale and rotate tutorial
The modules: bpy and math must be imported because we use
math.radians below to
convert from degrees to radians.
import bpy, math
This code will scale the default cube in blender to [1,2,5]
bpy.data.objects["Cube"].scale.x = 1
bpy.data.objects["Cube"].scale.y = 2
bpy.data.objects["Cube"].scale.z = 5
By default Blender will use euler X,Y,Z rotation, and not quaternion X,Y,Z,W.
Note that the rotation property of the Cube is called
rotation_euler,
and not simply
rotation
bpy.data.objects["Cube"].rotation_euler.x = math.radians(45)
Comments
Post a Comment