Is there any script method to check whether a node is within the region of a path?
Thanks a lot.
For example, below picture has two nodes. How to check which one is wihin/outside the path?
Is there any script method to check whether a node is within the region of a path?
Thanks a lot.
For example, below picture has two nodes. How to check which one is wihin/outside the path?
There is a GSPath.pointInside()
method.
from Foundation import NSPoint
pos = NSPoint(244,345)
for i, path in enumerate(Layer.paths):
if path.pointInside(pos):
print("Yes! Point inside path %i." % i)
else:
print("No! Point outside path %i." % i)
In 2023, this is spelt Layer.bezierPath.containsPoint_(NSPoint(244,345))
.
Note that this applies to all the shapes of the whole layer.