I have been writing a python script that needs to fill in faces as part of the program and I tried to use Blender.Geometry.PolyFill() to do this. However, PolyFill isn’t working the way I thought it would work and the program I am writing does not work right when I use PolyFill.
I created a sample python script here which shows the problem. The script is supposed to fill in the mesh in the first picture. The result of the script is the second picture. However, when I pushed Shift+F (Edit > Faces > Fill) on the mesh in the first picture, was filled the way I wanted it to, which is the third picture.
Is Blender.Geometry.PolyFill supposed to work the same way as Edit > Faces > Fill (Shift+F)? If not, is there a way to do what Shift+F does from a python script?
import Blender
from Blender import Mathutils
Vector = Blender.Mathutils.Vector
p1 = [Vector(1,1,0),Vector(-1,1,0),Vector(-1,-1,0),Vector(1,-1,0)]
p2 = [Vector(0.5,0.5,0),Vector(-0.5,0.5,0),Vector(-0.5,-0.5,0),Vector(0.5,-0.5,0)]
p3 = [Vector(4,1,0),Vector(2,1,0),Vector(2,-1,0),Vector(4,-1,0)]
#p3 = [Vector(3,1,0),Vector(1,1,0),Vector(1,-1,0),Vector(3,-1,0)]
#p4 = [Vector(3.5,0.5,0),Vector(2.5,0.5,0),Vector(2.5,-0.5,0),Vector(3.5,-0.5,0)]
fill = Blender.Geometry.PolyFill([p1,p2,p3])
m = Blender.Mesh.New("Mesh")
for i in [p1,p2,p3]:
m.verts.extend(i)
m.faces.extend(fill)
scn = Blender.Scene.GetCurrent()
o = scn.objects.new(m)
Blender.Redraw()


