예제 #1
0
def CombineAndReparent():
    newSelectionList = []
    selectionList = Cmds.ls(sl=True)
    for selection in selectionList:
        if Cmds.nodeType(selection) in ["transform"]:
            children = Cmds.listRelatives(selection, children=True)
            Cmds.select(cl=True)
            for child in children:
                Cmds.select(selection + "|" + child, add=True)
            if (len(children) == 1):
                Cmds.parent(w=True)
                Cmds.delete(selection)
            else:
                Cmds.polyUnite(ch=True, name=selection)
            Cmds.delete(ch=True)
            newName = selection
            print newName
            if not newName.find("LOD") == -1:
                nameParts = newName.split('_', 1)
                newName = "%s_%s" % (nameParts[1], nameParts[0])
            Cmds.rename(newName)
            Cmds.polyQuad(a=30, kgb=True, ktb=True, khe=True, ws=True, ch=True)
            newSelectionList.extend(Cmds.ls(sl=True))

    for selection in newSelectionList:
        Cmds.select(selection, add=True)

    Cmds.group(name="Scene")
    Cmds.delete(ch=True)
def generate(pts):
    """Takes in a list of tuples (set of 3D points) and generates a polygon model"""
    cmds.polyCreateFacet(name="shirt", p=points)
    cmds.polyTriangulate()
    cmds.polyQuad(angle=90)
    cmds.polySubdivideFacet(dv=SUBDIVISIONS)
    cmds.polyTriangulate()
    
    # Center shirt on origin
    centerX = cmds.objectCenter("shirt", x = True, gl = True)
    centerY = cmds.objectCenter("shirt", y = True, gl = True)
    centerZ = cmds.objectCenter("shirt", z = True, gl = True)
    cmds.move(-centerX, -centerY, -centerZ, "shirt", absolute=True)
def generate(pts):
    """Takes in a list of tuples (set of 3D points) and generates a polygon model"""
    cmds.polyCreateFacet(name="shirt", p=points)
    cmds.polyTriangulate()
    cmds.polyQuad(angle=90)
    cmds.polySubdivideFacet(dv=SUBDIVISIONS)
    cmds.polyTriangulate()

    # Center shirt on origin
    centerX = cmds.objectCenter("shirt", x=True, gl=True)
    centerY = cmds.objectCenter("shirt", y=True, gl=True)
    centerZ = cmds.objectCenter("shirt", z=True, gl=True)
    cmds.move(-centerX, -centerY, -centerZ, "shirt", absolute=True)
예제 #4
0
파일: paint.py 프로젝트: pj1138/MayaToolbox
def bakePaintEffects(target=None, reducePolys=0.1, maxPolys=0):
    if not target:
        target = s()
    mel.eval("doPaintEffectsToPoly(1,1,1,1," + str(maxPolys) + ");")
    ch()
    if (reducePolys < 1.0):
        for obj in target:
            obj.setAttr("sampleDensity", reducePolys)
            ch()
        #mc.polyReduce(percentage=10)
        #ch()
    mc.polyQuad()
    ch()
예제 #5
0
def makeFaceWithHole():
    points = []

    # Create the initial square
    points.append((-5, -5, 0))
    points.append((5, -5, 0))
    points.append((5, 5, 0))
    points.append((-5, 5, 0))

    # Add empty point to start a hole
    points.append(())

    for i in range(32):
        theta = (math.pi * 2) / 32 * i
        x = math.cos(theta)
        y = math.sin(theta)
        points.append((2 * x, 2 * y, 0))

    newFace = cmds.polyCreateFacet(p=points)
    cmds.polyTriangulate()
    cmds.polyQuad()  # Generally doesn't hurt anything
예제 #6
0
def polyQuad(*args, **kwargs):
    res = cmds.polyQuad(*args, **kwargs)
    if not kwargs.get('query', kwargs.get('q', False)):
        res = _factories.maybeConvert(res, _general.PyNode)
    return res
예제 #7
0
def autoQuad():
    cmds.polyTriangulate()
    cmds.polyQuad()