def __init__(self): global destpath global destname #XXX - Find a newer version calls for these 4 values... display = Blender210.getDisplaySettings() self.startFrame = display.startFrame; self.endFrame = display.endFrame; self.x = display.xResolution self.y = display.yResolution self.mesh_objs = [] self.lamp_objs = [] self.cam_objs = [] #Pre-cache the meshes in the mesh_objs #as we'll leak memory otherwise... #XXX-No worky! #self.meshes = [] print "---------TMOD Export---------" for o in Blender.Object.Get(): try: if (o.data != None): if (type(o.data) == Blender.Types.NMeshType): print "Found mesh object '%s'" % o.name ignore = 0 for ig in no_save_prefix: if o.name.startswith(ig): ignore = 1 if (ignore): print ("Ignoring object '%s' matching no_save_prefix list" % o.name) else: self.mesh_objs.append(o) #self.meshes.append(Blender.NMesh.GetRawFromObject(o.name)) elif (type(o.data) == Blender.Types.BlockType): if o.data.block_type == "Camera": self.cam_objs.append(o) print "Found camera object '%s'" % o.name elif o.data.block_type == "Lamp": self.lamp_objs.append(o) print "Found lamp object '%s'" % o.name else: print ("Ignoring object '%s' of unknown type '%s'" % (o.name,o.data.block_type)) else: print "Ignoring object '%s' with null data" % o.name except: print "Ignoring object '%s' lacking data field" % o.name #if len(self.mesh_objs) == 0: #print "\nWarning!! No meshes found." if len(self.cam_objs) == 0: print "\nWarning!! No camera found." if len(self.cam_objs) > 1: print "\nWarning!! More than one camera found. Using first one!!!" print "-----------------------------"
def LocalPosition(P, Obj): # # Prende un punto nelle coordinate globali # E lo trasporta in coordinate locali a un ggetto (Vertice di Mesh) # if (BL_VERSION<=223): m = Blender210.getObject(Obj.name).inverseMatrix else: m = Obj.getInverseMatrix() PX = P[0]*m[0][0] + P[1]*m[1][0] + P[2]*m[2][0] + m[3][0] PY = P[0]*m[0][1] + P[1]*m[1][1] + P[2]*m[2][1] + m[3][1] PZ = P[0]*m[0][2] + P[1]*m[1][2] + P[2]*m[2][2] + m[3][2] return (PX, PY, PZ)
def LocalPosition(P, Obj): if (BL_VERSION<=223): m = Blender210.getObject(Obj.name).inverseMatrix else: m = Obj.getInverseMatrix() return mulmatvec4x3(P, m)