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)
评论列表
文章目录