import Blender tex = Blender.Texture.GetCurrentPytex() coords = tex.getPytexCoords() def magnitude( a ): return ( a[0]**2 + a[1]**2 + a[2]**2)**0.5 def scale( a ): return a / 1.4142 a = scale( magnitude( coords ) ) tex.setPytexIntensity(a)