Problems with gw.polyline ignoring gw.setTransform in some scenes


I have a little gw function that draws a text integer and a polyline

	fn GW_DisplaySidesInteger = (
		gw.setColor #line (color 0 255 0)
		for edge in this.theEdges do (
			gw.setTransform (this.GetTM edge)
			gw.htext ((gw.hTransPoint [0,0,0]) + [0,10,0]) (this.sides as string) color:green
			points = GetCapPoints edge ends:true
			gw.polyline points false
		gw.enlargeUpdateRect #whole  

So basically this.getTM() gets the position and orientation I want for the drawing
GetCapPoints() gets an array of point positions relative to the this.getTM() matrix.
Ive checked the return of both of these with debug prints and they’re both working as intended.

gw.htext is correctly drawn at the transform position. gw.polyline, however, is not. Its drawn at matrix3 1 (scene 0,0,0)

The drawing works fine on an empty scene, but if i load one of my existing scenes it doesnt work. Ive tried deleting all objects, materials, and references from my existing scene in an attempt to see if going back to a “blank” scene would fix it, but it still doesnt work.

Any ideas?

I did some more testing with more explicit values:

	gw.setTransform (matrix3 [0,1,0] [1,0,0] [0,0,1] [0,0,10])
	gw.htext ((gw.hTransPoint [0,0,0]) + [0,10,0]) (this.sides as string) color:green
	gw.marker [0,0,0] #asterisk
	gw.polyline #([0,0,0], [0,1,0], [1,1,0]) true rgb:#(green,green,green)
	gw.polygon #([0,0,0], [0,10,0], [10,10,0]) #(red,red,red) #([0,0,0],[0,0,0],[0,0,0])

They’re all drawn in correct positions except gw.polyline()


Managed to figure this one out. Did some more tests and realized that if theres multiple edges, its the last polyline that doesnt get drawn correctly, so I added a gw.setTransform (matrix3 1) after the for loop, and for some reason that makes the lines get drawn in the correct places.