zbw_rig.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def calibrate_size(xform, scale=0.2, *args):
    """
    will take the bounding box of given transform and return *scale it's longest edge
    or option to do volume and return some portion of that. . .
    just to give scale factor for controls and such
    :param xform:
    :param args:
    :return:
    """
    if not isType(xform, "transform"):
        cmds.warning("zbw_rig.calibrate_size: You didn't pass me a transform ({0})".format(xform))
        return(None)

    box = cmds.exactWorldBoundingBox(xform)  # [xmin, ymin, zmin, xmax, ymax, zmax]
    X = om.MVector(box[0], box[3])
    Y = om.MVector(box[1], box[4])
    Z = om.MVector(box[2], box[5])

    # get bbox lengths along axes
    lenX = (X.y - X.x)
    lenY = (Y.y - Y.x)
    lenZ = (Z.y - Z.x)
    lgst = max([lenX, lenY, lenZ])

    outScale = float(lgst)*float(scale)

    return(outScale)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号