I could not find an example for the Bmesh function:
bmesh.ops.transform(bm, matrix = matrix, space, verts_extrude_b1)
What is the matrix argument and what do you pass it?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
bmesh.ops.transform() expects a 3x3 rotation matrix or 4x4 transformation matrix each for
matrix specifies the desired transformation, which can be anything with a 4x4 matrix (translation, rotation, scaling, skewing, mirroring etc.).
space specifies the space in which this transformation is supposed to happen in. If not specified, the transformation will happen in local space (object space). If you give it the object's
matrix_world, the transformation will happen in global space (world space). But you can give it any desired space if necessary (e.g. to rotate around an arbitrary point in space instead of the object's origin).
Translation in local and global space of an rotated object
bmesh.ops.transform(bm, matrix=Matrix.Translation((0,0,1)), verts=bm.verts)
matrix_worldof the object to perform the transformation in global space:
bmesh.ops.transform(bm, matrix=Matrix.Translation((0,0,1)), space=bpy.context.object.matrix_world, verts=bm.verts)
space-matrix is the same as multiplying the inverse of the transformation space matrix by the transformation matrix and the transformation space matrix:
matrix_world = bpy.context.object.matrix_world bmesh.ops.transform(bm, matrix=matrix_world.inverted() * Matrix.Translation((0,0,1)) * matrix_world, verts=bm.verts)
A matrix is a 2dimensional array (often 4x4) of values that contains the information needed to perform a transform. One matrix can combine location, rotation and scale information to be applied to an object.
Most of the matrix functions are in mathutils. This page should get you started.