fixed mouseViewRay in BPyWindow, was not applying the objects matrix to the mouse direction correctly.

VCol and Weight gradient work again.
This commit is contained in:
2006-12-14 09:56:56 +00:00
parent c5fba51131
commit 3a739d9bd2
2 changed files with 17 additions and 8 deletions

View File

@@ -105,15 +105,25 @@ def mouseViewRay(screen_x, screen_y, localMatrix=None, useMid = False):
if localMatrix:
localInvMatrix = Matrix(localMatrix)
localInvMatrix.invert()
p = p*localInvMatrix
d = d*localInvMatrix # normalize_v3
p.x += localInvMatrix[3][0]
p.y += localInvMatrix[3][1]
p.z += localInvMatrix[3][2]
localInvMatrix_notrans = localInvMatrix.rotationPart()
p = p * localInvMatrix
d = d * localInvMatrix # normalize_v3
# remove the translation from d
d.x -= localInvMatrix[3][0]
d.y -= localInvMatrix[3][1]
d.z -= localInvMatrix[3][2]
#else: # Worldspace, do nothing
d.normalize()
d.normalize()
'''
# Debugging
me = Blender.Mesh.New()
me.verts.extend([p[0:3]])
me.verts.extend([(p-d)[0:3]])
me.edges.extend([0,1])
ob = Blender.Scene.GetCurrent().objects.new(me)
'''
return True, p, d # Origin, Direction
# Mouse is not in any view, return None.