Skip to content

Instantly share code, notes, and snippets.

@tesfabpel
Created June 19, 2018 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tesfabpel/a34e77154b47ea32eb46e8072a82051b to your computer and use it in GitHub Desktop.
Save tesfabpel/a34e77154b47ea32eb46e8072a82051b to your computer and use it in GitHub Desktop.
Blender script to apply a transformation matrix
import bpy
from bpy import context
import mathutils
from mathutils import Vector,Quaternion,Matrix
import math
#obj = bpy.data.objects["Cube"] # particular object by name
obj = bpy.context.scene.objects.active # active object
# setup whatever matrix
mx = Matrix([[0, 1, 0, 0],
[0, 0, 1, 0],
[1, 0, 0, 0],
[2.94099, -0.32091, 0.92944, 1]])
mx.transpose()
bpy.ops.ed.undo_push()
mesh = obj.data
for vert in mesh.vertices:
vert.co = mx * vert.co
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment