uv_squares.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ToolPlus 作者: mkbreuer 项目源码 文件源码
def CursorClosestTo(verts, allowedError = 0.025):
    ratioX, ratioY = ImageRatio()

    #any length that is certantly not smaller than distance of the closest
    min = 1000
    minV = verts[0]
    for v in verts:
        if v is None: continue
        for area in bpy.context.screen.areas:
            if area.type == 'IMAGE_EDITOR':
                loc = area.spaces[0].cursor_location
                hyp = hypot(loc.x/ratioX -v.uv.x, loc.y/ratioY -v.uv.y)
                if (hyp < min):
                    min = hyp
                    minV = v

    if min is not 1000: return minV
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号