Ejemplo n.º 1
0
def project_curves_onto_mesh(mesh, curves_grp, direction):
    # projected_curves = []
    mesh = mesh
    old_meshes = []
    for i, curve in enumerate(curves_grp.getChildren()):
        try:
            if (not type(curve.getShape()) is pm.NurbsCurve):
                continue
        except:
            continue

        while True:
            nv = len(mesh.vtx)
            mesh = delete_vertex(mesh)
            if (len(mesh.vtx) == nv): break

        projected_curves = pm.polyProjectCurve(mesh,
                                               curve,
                                               direction=direction)[0]
        pm.delete(projected_curves.getChildren()[1:])
        projected_curve = projected_curves.getChildren()[0]

        split_mesh = pm.polySplit(mesh,
                                  detachEdges=0,
                                  projectedCurve=projected_curve)
        # print projected_curve
        split_mesh = split_mesh[0]

        pm.delete(split_mesh, ch=True)
        old_meshes.append(mesh)

        mesh = split_mesh

        if (projected_curves):
            pm.delete(projected_curves)

        # if( i == 10 ) : return

    for old_mesh in old_meshes:
        try:
            pm.delete(old_mesh)
        except:
            pm.warning('Could not delete %s' % (old_mesh))

    pm.polyTriangulate(mesh)
    # pm.polyQuad( mesh )
    # -ver 1 -trm 0 -p 50 -vct 0 -tct 0 -shp 0.5326 -keepBorder 1 -keepMapBorder 1 -keepColorBorder 1 -keepFaceGroupBorder 1 -keepHardEdge 1 -keepCreaseEdge 1 -keepBorderWeight 0.5 -keepMapBorderWeight 0.5 -keepColorBorderWeight 0.5 -keepFaceGroupBorderWeight 0.5 -keepHardEdgeWeight 0.5 -keepCreaseEdgeWeight 0.5 -useVirtualSymmetry 0 -symmetryTolerance 0.01 -sx 0 -sy 1 -sz 0 -sw 0 -preserveTopology 1 -keepQuadsWeight 1 -vertexMapName "" -replaceOriginal 1 -cachingReduce 1 -ch 1
    # pm.polyReduce( mesh, ver=True, trm=False, p=50, replaceOriginal=True, kb=True, kbw=1.0, kmb=True, kmw=1.0, kfb=True, kfw=1.0, kqw=1.0 )
    pm.polySoftEdge(mesh, a=180, ch=True)
    pm.delete(mesh, ch=True)
def project_curves_onto_mesh( mesh, curves_grp, direction ) :
	# projected_curves = []	
	mesh = mesh
	old_meshes = []
	for i, curve in enumerate( curves_grp.getChildren( ) ) :		
		try :
			if( not type(curve.getShape()) is pm.NurbsCurve ) :				
				continue
		except :			
			continue				

		while True :
			nv = len(mesh.vtx)
			mesh = delete_vertex(mesh)
			if( len(mesh.vtx) == nv ) : break

		projected_curves = pm.polyProjectCurve( mesh, curve, direction=direction )[0]
		pm.delete( projected_curves.getChildren()[1:] )
		projected_curve = projected_curves.getChildren()[0]		

		split_mesh = pm.polySplit( mesh, detachEdges=0, projectedCurve=projected_curve )
		# print projected_curve
		split_mesh = split_mesh[0]

		pm.delete( split_mesh, ch=True )
		old_meshes.append( mesh )	

		mesh = split_mesh			

		if( projected_curves ) :
			pm.delete( projected_curves )

		# if( i == 10 ) : return

	for old_mesh in old_meshes :
		try : pm.delete( old_mesh )
		except : 
			pm.warning( 'Could not delete %s' % (old_mesh) )
	

	pm.polyTriangulate( mesh )
	# pm.polyQuad( mesh )
	# -ver 1 -trm 0 -p 50 -vct 0 -tct 0 -shp 0.5326 -keepBorder 1 -keepMapBorder 1 -keepColorBorder 1 -keepFaceGroupBorder 1 -keepHardEdge 1 -keepCreaseEdge 1 -keepBorderWeight 0.5 -keepMapBorderWeight 0.5 -keepColorBorderWeight 0.5 -keepFaceGroupBorderWeight 0.5 -keepHardEdgeWeight 0.5 -keepCreaseEdgeWeight 0.5 -useVirtualSymmetry 0 -symmetryTolerance 0.01 -sx 0 -sy 1 -sz 0 -sw 0 -preserveTopology 1 -keepQuadsWeight 1 -vertexMapName "" -replaceOriginal 1 -cachingReduce 1 -ch 1
	# pm.polyReduce( mesh, ver=True, trm=False, p=50, replaceOriginal=True, kb=True, kbw=1.0, kmb=True, kmw=1.0, kfb=True, kfw=1.0, kqw=1.0 )
	pm.polySoftEdge( mesh, a=180, ch=True )
	pm.delete( mesh, ch=True )
Ejemplo n.º 3
0
 def menuModelerUncreaseAndSoftenSelectedEdges(self, state=None):
     self.mmmmTools.modeler.uncreaseSelectedEdges()
     pm.polySoftEdge(angle=180.0)
Ejemplo n.º 4
0
 def menuModelerCreaseAndHardenSelectedEdges(self, state=None):
     self.mmmmTools.modeler.creaseSelectedEdges()
     pm.polySoftEdge(angle=0.0)
Ejemplo n.º 5
0
     pm.polySoftEdge( angle=0.0 )
 def menuModelerUncreaseAndSoftenSelectedEdges(self, state=None):
     self.mmmmTools.modeler.uncreaseSelectedEdges()
Ejemplo n.º 6
0
     self.mmmmTools.modeler.uncreaseSelectedEdges()
 def menuModelerCreaseAndHardenSelectedEdges(self, state=None):
     self.mmmmTools.modeler.creaseSelectedEdges()