forked from bartvdbraak/blender
updated py scripts for changes in mathutils
This commit is contained in:
parent
403b62fbcf
commit
3f5e14abef
@ -314,10 +314,7 @@ def process_next_chunk(file, previous_chunk, importedObjects):
|
|||||||
|
|
||||||
|
|
||||||
def putContextMesh(myContextMesh, myContextMeshMaterials):
|
def putContextMesh(myContextMesh, myContextMeshMaterials):
|
||||||
INV_MAT= Blender.Mathutils.Matrix(contextMatrix)
|
contextMesh.transform(contextMatrix.inverted())
|
||||||
|
|
||||||
INV_MAT.invert()
|
|
||||||
contextMesh.transform(INV_MAT)
|
|
||||||
|
|
||||||
materialFaces= set()
|
materialFaces= set()
|
||||||
# Now make copies with assigned materils.
|
# Now make copies with assigned materils.
|
||||||
|
@ -85,9 +85,9 @@ def add_to_NV(old,dir,new):
|
|||||||
|
|
||||||
def get_v(old, *neighbors):
|
def get_v(old, *neighbors):
|
||||||
# compute the direction of the new vert
|
# compute the direction of the new vert
|
||||||
if len(neighbors) == 1: dir = (neighbors[0].co - old.co).normalize()
|
if len(neighbors) == 1: dir = (neighbors[0].co - old.co).normalized()
|
||||||
#dir
|
#dir
|
||||||
else: dir = (neighbors[0].co - old.co).normalize() + (neighbors[1].co-old.co).normalize()
|
else: dir = (neighbors[0].co - old.co).normalized() + (neighbors[1].co-old.co).normalized()
|
||||||
|
|
||||||
# look in NV if this vert already exists
|
# look in NV if this vert already exists
|
||||||
key = tuple(dir)
|
key = tuple(dir)
|
||||||
|
@ -1043,10 +1043,7 @@ def pointInsideMesh(ob, pt):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
obSpacePt = pt*ob.matrixWorld.inverted()
|
||||||
obImvMat = Blender.Mathutils.Matrix(ob.matrixWorld)
|
|
||||||
obImvMat.invert()
|
|
||||||
obSpacePt = pt*obImvMat
|
|
||||||
ray = Vector(0,0,-1)
|
ray = Vector(0,0,-1)
|
||||||
me= ob.getData(mesh=1)
|
me= ob.getData(mesh=1)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ def mouseViewRay(screen_x, screen_y, localMatrix=None, useMid = False):
|
|||||||
# sorry - i cannot explain here what they all do
|
# sorry - i cannot explain here what they all do
|
||||||
# - if you're not familiar with all those matrices take a look at an introduction to OpenGL...
|
# - if you're not familiar with all those matrices take a look at an introduction to OpenGL...
|
||||||
pm = Window.GetPerspMatrix() # the prespective matrix
|
pm = Window.GetPerspMatrix() # the prespective matrix
|
||||||
pmi = Matrix(pm); pmi.invert() # the inverted perspective matrix
|
pmi = pm.inverted() # the inverted perspective matrix
|
||||||
|
|
||||||
if (1.0 - epsilon < pmi[3][3] < 1.0 + epsilon):
|
if (1.0 - epsilon < pmi[3][3] < 1.0 + epsilon):
|
||||||
# pmi[3][3] is 1.0 if the 3dwin is in ortho-projection mode (toggled with numpad 5)
|
# pmi[3][3] is 1.0 if the 3dwin is in ortho-projection mode (toggled with numpad 5)
|
||||||
|
@ -109,7 +109,7 @@ def vertexGradientPick(ob, MODE):
|
|||||||
cross_grad= CrossVecs(DirectionA, OriginA-OriginB)
|
cross_grad= CrossVecs(DirectionA, OriginA-OriginB)
|
||||||
ORTHO= True
|
ORTHO= True
|
||||||
|
|
||||||
cross_grad= cross_grad.normalize() * 100
|
cross_grad= cross_grad.normalized() * 100
|
||||||
|
|
||||||
lineA= (OriginA, OriginA+(DirectionA*100))
|
lineA= (OriginA, OriginA+(DirectionA*100))
|
||||||
lineB= (OriginB, OriginB+(DirectionB*100))
|
lineB= (OriginB, OriginB+(DirectionB*100))
|
||||||
|
@ -74,8 +74,8 @@ class edgeLoop:
|
|||||||
# Use next and prev, nextDist, prevDist
|
# Use next and prev, nextDist, prevDist
|
||||||
|
|
||||||
# Get Loops centre.
|
# Get Loops centre.
|
||||||
fac= 1.0/len(loop)
|
fac= len(loop)
|
||||||
self.centre= reduce(lambda a,b: a+b.co*fac, loop, Mathutils.Vector())
|
self.centre= reduce(lambda a,b: a+b.co/fac, loop, Mathutils.Vector())
|
||||||
|
|
||||||
# Convert Vert loop to Edges.
|
# Convert Vert loop to Edges.
|
||||||
self.edges = []
|
self.edges = []
|
||||||
|
Loading…
Reference in New Issue
Block a user