Created
June 19, 2018 15:04
-
-
Save tesfabpel/a34e77154b47ea32eb46e8072a82051b to your computer and use it in GitHub Desktop.
Blender script to apply a transformation matrix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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