I have read so much about Blender rotation in the last two hours that my head is spinning, but I can not understand how to rotate strictly in global coordinates without using
bpy.ops. In reality I will have a large number of objects and do this frequently, so I'd like to use a rotation method of the objects themselves, like one of these:
obj.matrix_world *= some_vector or
but I don't understand how to use them for strictly single global axis rotations like the following example:
import bpy import math half_pi = 0.5 * math.pi group =  for y in [-3, 0, 3]: bpy.ops.mesh.primitive_cylinder_add(location=(0, y, 0)) # ops is OK here, but not in the rotations obj = bpy.context.active_object group.append(obj) zangles = [1, 1.5, 2] # radains for obj, zangle in zip(group, zangles): bpy.ops.object.select_all(action='DESELECT') obj.select = True bpy.ops.transform.rotate(value=half_pi, axis=(1, 0, 0)) # rotate about global X by 90 degrees bpy.ops.transform.rotate(value=zangle, axis=(0, 0, 1)) # rotate about global Z by zangle bpy.ops.object.select_all(action='DESELECT')
ops can rotate globally, but I don't see any methods associated with objects to to global rotation, and I can't figure out how to do that.
A link to a less theoretical, and more "if you want to do this, use this" scripted rotation explanation would also be greatly appreciated. I'm OK with the math, it's the Blender conventions I can not get a handle on.