def pasteCtlShape(*args): '''Assigns the control's shape from the ctlShapeClipboard global variable to the selected controls''' sel = mc.ls(sl=1, fl=1) for each in sel: manager.setShape(each, ctlShapeClipboard) mc.select(sel)
def _flipCtlShape(crv=None, axis=[-1, -1, -1]): '''Scales the points of the crv argument by the axis argument. This function is not meant to be called directly. Look at the flipCtlShape instead.''' shapes = manager.getShape(crv) newShapes = [] for shape in shapes: for i, each in enumerate(shape["points"]): shape["points"][i] = [ each[0] * axis[0], each[1] * axis[1], each[2] * axis[2] ] newShapes.append(shape) manager.setShape(crv, newShapes) mc.select(crv)
def mirrorCtlShapes(*args): '''Mirrors the selected control's shape to the other control on the other side''' sel = mc.ls(sl=1, fl=1) for ctl in sel: if ctl[0] not in ["L", "R"]: continue search = "R_" replace = "L_" if ctl[0] == "L": search = "L_" replace = "R_" shapes = manager.getShape(ctl) for shape in shapes: shape.pop("colour") manager.setShape(ctl.replace(search, replace), shapes) _flipCtlShape(ctl.replace(search, replace)) mc.select(sel)
def assignControlShape(*args): '''Assigns args[0] as the shape of the selected curves''' sel = mc.ls(sl=1, fl=1) for each in sel: manager.setShape(each, manager.loadFromLib(args[0])) mc.select(sel)