예제 #1
0
def _bezierConvert(crv):
	""" Convert a curve to bezier non-destructively
	Arguments:
		crv (str): A curve shape or transform
	
	Returns:
		str: A Bezier curve shape
		list: Any temporary objects that need to be deleted later
	"""
	# Get the bezier shapes
	bezShapes = cmds.listRelatives(crv, path=True, type="bezierCurve")
	if bezShapes is not None:
		return bezShapes[0], []

	nurbsShapes = cmds.listRelatives(crv, path=True, type="nurbsCurve")
	if nurbsShapes is not None:
		tfm = cmds.listRelatives(nurbsShapes, path=True, parent=True)
		# nurbsCurveToBezier is *supposed* to take arguments, but always errors
		# So I have to do this with selection. I hate that. A Lot.
		dup = cmds.duplicate(tfm) # duplicates and selects the object
		cmds.select(dup)
		cmds.nurbsCurveToBezier() # Converts selection to bezier
		bezShapes = cmds.listRelatives(dup[0], path=True, type="bezierCurve")
		if bezShapes is not None:
			return bezShapes[0], dup

	return None, []
예제 #2
0
def convertToBezierCurve(curve):
    """
    Check if the parsed curve is a bezier curve, if this is not the case
    convert the curve to a bezier curve.
    
    :param str curve: Name of curve
    """
    # get shape
    curveShape = cmds.listRelatives(curve, s=True)[0]

    # convert to bezier curve
    if cmds.nodeType(curveShape) == "bezierCurve":
        return

    cmds.select(curve)
    cmds.nurbsCurveToBezier()
 def convertToBezier(self):
     dtO = dt.DailyTool()
     dtO.sl(self.curve)
     cmds.nurbsCurveToBezier()
     dtO.delHis(self.curve)
예제 #4
0
def nurbsCurveToBezier(*args, **kwargs):
    res = cmds.nurbsCurveToBezier(*args, **kwargs)
    if not kwargs.get('query', kwargs.get('q', False)):
        res = _factories.maybeConvert(res, _general.PyNode)
    return res