[Closed] Hit test viewport grid?
I haven’t tested this, but these changes might make it a liiitle bit quicker:
for x in geometry do
dist = 1e+008 --> if tempDist < dist then
This way the dist variable doesn’t need to be tested for undefined for each iteration.
Don’t think it’ll make much difference but it might be worth trying.
Cheers,
Martijn
Thanks Martijn, for dist I had that originaly but changed if for some reason. Maybe I will do a speed test on that and see what it does for me. As for just looping through geo well I didn’t catch that at all, thanks that will make it much faster if used in a big scene.
Hey, here is the way I do it to get a position on the grid:
pixelpos = mouse.pos
gw.mapCPToWorld (mapScreenToCP pixelpos)
CML
Good to know that there is another way. I think that I might go with thePainterInterface now anyway as it looks like it solves one of the main problems. If I use any of the built in mouseTools functions then I don’t have accress so everying thing else as I’m painting. If I write it all using mouse, gw and viewport tools then I run into the problem that the I’m always in selection mode and that just isn’t clean. So thePainterInterface deals with every thing as far as I can tell so far.