Exemplo n.º 1
0
def meshToNurbs(mesh, rebuild=False, spansU=0, spansV=0, prefix=''):
    """
    @param mesh:
    @param rebuild:
    @param spansU:
    @param spansV:
    @param prefix:
    """
    # Check prefix
    if not prefix:
        prefix = glTools.utils.stringUtils.stripSuffix(mesh)

    # Convert poly to subdiv
    subd = cmds.polyToSubdiv(mesh, ch=False, preserveVertexOrdering=True)[0]

    # Full crease corner vertices
    cornerIds = glTools.utils.mesh.getCornerVertexIds(mesh)
    cmds.select([subd + '.vtx[' + str(i) + ']' for i in cornerIds])
    mel.eval('FullCreaseSubdivSurface')

    # Convert subdiv to nurbs
    nurbsConvert = cmds.subdToNurbs(subd, ch=False)[0]
    nurbs = cmds.listRelatives(nurbs, c=True)

    # Cleanup
    cmds.parent(nurbs, w=True)
    cmds.delete(nurbsConvert)
    cmds.delete(subd)

    # Return result
    return nurbs
Exemplo n.º 2
0
def meshToNurbs(mesh, rebuild=False, spansU=0, spansV=0, prefix=''):
    '''
	'''
    # Check prefix
    if not prefix: prefix = glTools.utils.stringUtils.stripSuffix(mesh)

    # Convert poly to subdiv
    subd = mc.polyToSubdiv(mesh, ch=False, preserveVertexOrdering=True)[0]

    # Full crease corner vertices
    cornerIds = glTools.utils.mesh.getCornerVertexIds(mesh)
    mc.select([subd + '.vtx[' + str(i) + ']' for i in cornerIds])
    mm.eval('FullCreaseSubdivSurface')

    # Convert subdiv to nurbs
    nurbsConvert = mc.subdToNurbs(subd, ch=False)[0]
    nurbs = mc.listRelatives(nurbs, c=True)

    # Cleanup
    mc.parent(nurbs, w=True)
    mc.delete(nurbsConvert)
    mc.delete(subd)

    # Return result
    return nurbs
Exemplo n.º 3
0
def setObjectAsCanvas(name):
	cmds.polyEvaluate(f=True)
	subdivSurface = cmds.polyToSubdiv(maxPolyCount=cmds.polyEvaluate(f=True), maxEdgesPerVert=32, ch=False)[0]
	liveSurface = cmds.subdToNurbs(subdivSurface, ot=0, ch=False)
	cmds.delete(subdivSurface)
	cmds.hide(liveSurface)
	cmds.makeLive(liveSurface)

	return liveSurface