• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.polyEditUV函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.polyEditUV函数的典型用法代码示例。如果您正苦于以下问题:Python polyEditUV函数的具体用法?Python polyEditUV怎么用?Python polyEditUV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了polyEditUV函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: CentreUVs

def CentreUVs():
	objSel = cmds.ls(sl=True)
	
	try:
		for item, x in enumerate(objSel):
			cmds.select('%s.map[*]' %objSel[item])
			mm.eval("PolySelectConvert 4;")
			mm.eval('TranslateToolWithSnapMarkingMenu')
			objPiv = cmds.getAttr('%s.uvPivot' %objSel[0])
			mm.eval('MarkingMenuPopDown')
			objCenterU = 0.5 - objPiv[0][0]
			objCenterV = 0.5 - objPiv[0][1]
			cmds.polyEditUV(u=objCenterU, v=objCenterV, r=1)
			cmds.select(objSel)
	except ValueError:
	
		objQuery = cmds.listRelatives(objSel[0], ap=True)
		cmds.select('%s.map[*]' %objQuery[0])
		mm.eval("PolySelectConvert 4;")
		mm.eval('TranslateToolWithSnapMarkingMenu')
		objPiv = cmds.getAttr('%s.uvPivot' %objQuery[0])
		mm.eval('MarkingMenuPopDown')
		objCenterU = 0.5 - objPiv[0][0]
		objCenterV = 0.5 - objPiv[0][1]
		cmds.polyEditUV(u=objCenterU, v=objCenterV, r=1)
		cmds.select(objQuery)
开发者ID:kml27,项目名称:ExperimentalCapture,代码行数:26,代码来源:svAutoPipe.py


示例2: setUpClass

    def setUpClass(cls):
        standalone.initialize('usd')
        cmds.loadPlugin('pxrUsd')

        if not UsdMaya.WriteUtil.WriteUVAsFloat2():
            cmds.file(os.path.abspath('UsdExportUVSetsTest.ma'), open=True,
                       force=True)
        else:
            cmds.file(os.path.abspath('UsdExportUVSetsTest_Float.ma'), open=True,
                       force=True)

        # Make some live edits to the box with weird UVs for the
        # testExportUvVersusUvIndexFromIterator test.
        cmds.select("box.map[0:299]", r=True)
        cmds.polyEditUV(u=1.0, v=1.0)

        usdFilePath = os.path.abspath('UsdExportUVSetsTest.usda')
        cmds.usdExport(mergeTransformAndShape=True,
            file=usdFilePath,
            shadingMode='none',
            exportColorSets=False,
            exportDisplayColor=False,
            exportUVs=True)

        cls._stage = Usd.Stage.Open(usdFilePath)
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:25,代码来源:testUsdExportUVSets.py


示例3: unfoldBandUVs

def unfoldBandUVs(object, divisions=1, history=True):
	"""
	This definition unfolds object band UVs.

	:param object: Object. ( String )
	:param divisions: Extrusion divisions. ( Integer )
	:param history: Keep construction history. ( Boolean )
	"""

	edgesCount = cmds.polyEvaluate(object, edge=True)
	edges = cmds.ls(object + ".e[0:" + str(edgesCount - 1) + "]", fl=True, l=True)

	cmds.select(object)
	cmds.polySelectConstraint(m=3, t=0x8000, w=1)
	cmds.polySelectConstraint(m=0)
	for i in range(divisions):
		mel.eval("GrowPolygonSelectionRegion();")
	bandEdges = cmds.ls(sl=True, fl=True, l=True)
	bandFaces = cmds.ls(cmds.polyListComponentConversion(bandEdges, fe=True, tf=True), fl=True)
	cmds.select(bandFaces)
	cmds.polyForceUV(unitize=True)
	cmds.polySelectConstraint(m=3, t=0x8000, sm=1)
	seamsEdges = cmds.ls(sl=True, fl=True, l=True)
	weldEdges = list(set(bandEdges).difference(set(seamsEdges)))
	cmds.polyMapSewMove(weldEdges)
	cmds.polyLayoutUV(bandFaces, scale=1, rotateForBestFit=0, layout=1)
	uvs = cmds.polyListComponentConversion(bandFaces, toUV=1)
	cmds.polyEditUV(uvs, u=1, v=0)

	not history and cmds.delete(object, ch=True)
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:30,代码来源:unfoldBand.py


示例4: layoutUVsToUDIM

 def layoutUVsToUDIM(self, *args):
     sels = cmds.ls(sl=1)
     for i, x in enumerate(sels):
         x = cmds.listRelatives(x,s=True)[0]
         cmds.select('{0}.map[:]'.format(x), r=1)
         cmds.polyEditUV(u=i % 10, v=int(math.floor(i / 10)))
     cmds.select(sels, r=1)
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:7,代码来源:AlignUVs.py


示例5: prescaleUVsShells

def prescaleUVsShells(object):
	"""
	This definition prescales object UVs shells.

	:param objects: Object. ( String )
	:return: Definition succes. ( Boolean )
	"""

	uvs = getUVsFromComponents(object)
	uMin, vMin, uMax, vMax = getComponentsBoundingBox(uvs)
	uCenter, vCenter = (uMin + uMax) / 2.0, (vMin + vMax) / 2.0
	width, height = uMax - uMin, vMax - vMin
	scale = max(width, height)

	cmds.polyMultiLayoutUV(object, lm=0, sc=1, rbf=0, fr=False, ps=0.2, l=2, psc=True)

	currentUMin, currentVMin, currentUMax, currentVMax = getComponentsBoundingBox(uvs)
	currentUCenter, currentVCenter = (currentUMin + currentUMax) / 2.0, (currentVMin + currentVMax) / 2.0
	currentWidth, currentHeight = currentUMax - currentUMin, currentVMax - currentVMin
	currentScale = max(currentWidth, currentHeight)

	scaleFactor = scale / currentScale

	cmds.polyEditUV(uvs, u=uCenter - currentUCenter, v=vCenter - currentVCenter)
	scaleComponentsUVs(uvs, su=scaleFactor, sv=scaleFactor)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:26,代码来源:uvsUtilities.py


示例6: flipUVsByLocal

def flipUVsByLocal(*args):
    sel = cmds.ls(sl=True, fl=True, long=True)
    u = 0.0
    for i in sel:
        uv = cmds.polyEditUV(i, relative=False, q=True, uValue=True)
        u += uv[0]
    uAve = u / len(sel)
    u_tile = int(str(uAve)[0])
    flipAxis = u_tile + 0.5
    cmds.polyEditUV(relative=False, pivotU=flipAxis, scaleU=-1)    
开发者ID:minoue,项目名称:miUV,代码行数:10,代码来源:miUvUtils.py


示例7: moveComponentsUVs

def moveComponentsUVs(components, u=0, v=0):
	"""
	This definition moves given components UVs.

	:param components: Components. ( Tuple / List )
	:param u: U value. ( Float )
	:param v: V value. ( Float )
	:return: Definition succes. ( Boolean )
	"""

	uvs = getUVsFromComponents(components, flatten=False)
	cmds.polyEditUV(uvs, u=u, v=v)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:13,代码来源:uvsUtilities.py


示例8: getUVFaceNormal

def getUVFaceNormal( facepath ):
	uvs = getWindingOrder(facepath)

	if len(uvs) < 3: return (1,0,0) #if there are less than 3 uvs we have no uv area so bail

	#get edge vectors and cross them to get the uv face normal
	uvAPos = cmd.polyEditUV(uvs[0], query=True, uValue=True, vValue=True)
	uvBPos = cmd.polyEditUV(uvs[1], query=True, uValue=True, vValue=True)
	uvCPos = cmd.polyEditUV(uvs[2], query=True, uValue=True, vValue=True)
	uvAB = Vector( [uvBPos[0]-uvAPos[0], uvBPos[1]-uvAPos[1], 0] )
	uvBC = Vector( [uvCPos[0]-uvBPos[0], uvCPos[1]-uvBPos[1], 0] )
	uvNormal = uvAB.cross( uvBC ).normalize()

	return uvNormal
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:14,代码来源:meshUtils.py


示例9: centerComponentsUVs

def centerComponentsUVs(components):
	"""
	This definition centers given components UVs.

	:param components: Components. ( Tuple / List )
	:return: Definition succes. ( Boolean )
	"""

	uvs = getUVsFromComponents(components)
	uMin, vMin, uMax, vMax = getComponentsBoundingBox(uvs)
	uCenter, vCenter = (uMin + uMax) / 2.0, (vMin + vMax) / 2.0
	uTargetCenter, vTargetCenter = math.floor(uCenter), math.floor(vCenter)
	cmds.polyEditUV(uvs, u=uTargetCenter - uCenter + 0.5, v=vTargetCenter - vCenter + 0.5)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:14,代码来源:uvsUtilities.py


示例10: alignUVs

def alignUVs(doU, minU, doV, inV):
    """
    align selected uvs based on the one most on top, bottom, left, right
    """
    # get the selected UVs from current selection
    selectedItems = cmds.filterExpand(ex=False, sm=35) # 35 means UVs
    uvMin = []
    uvMax = []
    # get the 3d bounding box of selection
    uvInfo = cmds.polyEvaluate(bc2=True)
    uvMin[0] = uvInfo[0]
    uvMin[1] = uvInfo[2]
    uvMax[0] = uvInfo[1]
    uvMax[1] = uvInfo[3]

    if doU:
        if minU:
            cmds.polyEditUV(r=False, u=uvMin[0])
        else:
            cmds.polyEditUV(r=False, u=uvMax[0])
    if doV:
        if minV:
            cmds.polyEditUV(r=False, v=uvMin[1])
        else:
            cmds.polyEditUV(r=False, v=uvMax[1])
开发者ID:shrimo,项目名称:dmptools,代码行数:25,代码来源:modeling.py


示例11: mirrorGeometry

def mirrorGeometry(*args, **keywords):
# Mirror geometry together with UV. The UV of character can be splited into a number of U regions.
# usage: select geometry which is present in the +x side and UVs in U=0.5-1 region (and U=1.5-2, U=2.5-3, ...)

	meshes = cmds.listRelatives(s=True, type="mesh", ni=True, f=True)

	if meshes == None:
		raise Exception, "No mesh selected"

	results = []
	for mesh in cmds.listRelatives(meshes, p=True, f=True):
		verticesInRegion = {}

		parent = cmds.listRelatives(mesh, p=True, f=True, pa=True)
		mesh1 = cmds.duplicate(mesh)
		mesh2 = cmds.duplicate(mesh)

		cmds.scale(-1, 1, 1, mesh2, r=True)

		# detect uv regions
		#		scan all vertices

		vertices = cmds.ls(cmds.polyListComponentConversion(mesh2, tuv=True), fl=True)
		for vertex in vertices:
			uv = cmds.polyEditUV(vertex, query=True)
			region = math.ceil(uv[0]) - 1
			if region < 0:
				region = 1
			if not verticesInRegion.has_key(region):
				verticesInRegion[region] = []
			verticesInRegion[region].append(vertex)

		#		choose vertices in regions
		#			flip uv upon middle of regions

		for region,vertices in verticesInRegion.iteritems():
			cmds.select(vertices, r=True)
			cmds.polyEditUV(pu=(region + 0.5), pv=0.5, su=-1, sv=1)

		#	combine objects and merge vertices

		combined = cmds.polyUnite(mesh1, mesh2, ch=False)
		if parent:
			results += cmds.parent(combined, parent)
		else:
			results += combined
		cmds.polyMergeVertex(d=0.005, ch=0)

	cmds.select(results, r=True)
	return results
开发者ID:cgriders,项目名称:jcScripts,代码行数:50,代码来源:character.py


示例12: createFollicle

def createFollicle():

    sel = cmds.ls(sl = True,fl = True)
    
    for i in range(len(sel)):
    
        surfaceTransform = sel[i].split('.')[0]
        surfaceShape = cmds.listRelatives(surfaceTransform,type = 'shape')[0]
        uvPoint = sel[i]
        
        uvValues = cmds.polyEditUV(uvPoint,query = True)
        uValue = uvValues[0]
        vValue = uvValues[1]
        
            
        follicle = cmds.createNode('follicle')
        follicleTransform = cmds.listRelatives(follicle,parent = True)[0]
        cmds.connectAttr('%s.outTranslate'%follicle,'%s.translate'%follicleTransform)
        cmds.connectAttr('%s.outRotate'%follicle,'%s.rotate'%follicleTransform)
        
        cmds.setAttr('%s.parameterU'%follicle,uValue)
        cmds.setAttr('%s.parameterV'%follicle,vValue)
        
        cmds.connectAttr('%s.outMesh'%surfaceShape, '%s.inputMesh'%follicle,f = True)
        cmds.connectAttr('%s.worldMatrix[0]'%surfaceShape, '%s.inputWorldMatrix'%follicle)
开发者ID:Owacle,项目名称:maya-toolbelt,代码行数:25,代码来源:MayaScripts.py


示例13: flatten_marvelous_shells

def flatten_marvelous_shells(shells):
    """
    Usage:
        flatten_marvelous_shells(mc.ls(sl=True))
    """
    for obj in shells:
        start_vert, end_vert = mc.ls(
            mc.polyListComponentConversion(cmds.ls(obj + ".e[0]")[0], fe=True, tv=True), fl=True
        )

        start_scale = distance.euclidean(
            mc.xform(start_vert, q=True, t=True, ws=True), mc.xform(end_vert, q=True, t=True, ws=True)
        )

        for uv in cmds.ls(obj + ".map[:]", fl=True):
            uv_pos = mc.polyEditUV(uv, q=True)
            uv_index = re.findall("\[([0-9]+)\]", uv)[0]
            vertex = mc.polyListComponentConversion(uv, fuv=True, tv=True)[0]
            mc.xform(vertex, t=[uv_pos[0]] + [0] + [uv_pos[1]], ws=True)

        # Finally, scale it
        end_scale = distance.euclidean(
            mc.xform(start_vert, q=True, t=True, ws=True), mc.xform(end_vert, q=True, t=True, ws=True)
        )
        scale_by = start_scale / end_scale

        mc.xform(mc.ls(obj + ".vtx[:]"), s=[scale_by, scale_by, scale_by], ws=True)
开发者ID:AndresMWeber,项目名称:aw,代码行数:27,代码来源:aw_marevelous_flatten.py


示例14: udimFromNode

def udimFromNode(node):
    uPos, vPos = cmds.polyEditUV(node+'.map[1]', q=True)
    uTile = int(math.floor(uPos))
    vTile = int(math.floor(vPos))
    udim = 1000+(uTile+1)+(vTile*10)
    
    return udim, uTile, vTile
开发者ID:jonntd,项目名称:dmptools,代码行数:7,代码来源:mayaCommands.py


示例15: testPolyUVs

    def testPolyUVs(self):
        MayaCmds.polyCube(name = 'cube')
        cubeObj = getObjFromName('cubeShape')
        fnMesh = OpenMaya.MFnMesh(cubeObj)

        # get the name of the current UV set
        uvSetName = fnMesh.currentUVSetName()

        uArray = OpenMaya.MFloatArray()
        vArray = OpenMaya.MFloatArray()
        fnMesh.getUVs(uArray, vArray, uvSetName)

        newUArray = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, -1, -1]
        newVArray = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1 , 0,  1]
        for i in range(0, 14):
            uArray[i] = newUArray[i]
            vArray[i] = newVArray[i]
        fnMesh.setUVs(uArray, vArray, uvSetName)

        self.__files.append(util.expandFileName('polyUvsTest.abc'))
        MayaCmds.AbcExport(j='-uv -root cube -file ' + self.__files[-1])

        # reading test
        MayaCmds.AbcImport(self.__files[-1], mode='open')

        MayaCmds.select('cube.map[0:13]', replace=True)
        uvs = MayaCmds.polyEditUV(query=True)
        for i in range(0, 14):
            self.failUnlessAlmostEqual(newUArray[i], uvs[2*i], 4,
                'map[%d].u is not the same' % i)
            self.failUnlessAlmostEqual(newVArray[i], uvs[2*i+1], 4,
                'map[%d].v is not the same' % i)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:Alembic_uv_test.py


示例16: mirrorComponentsUVs

def mirrorComponentsUVs(components, horizontal=True):
	"""
	This definition mirrors given components UVs.

	:param components: Components. ( Tuple / List )
	:param horizontal: Horizontal mirror. ( Boolean )
	:return: Definition succes. ( Boolean )
	"""

	uvs = getUVsFromComponents(components)
	uCenter, vCenter = (math.floor(value) for value in getComponentsUVsCenter(uvs))
	if horizontal:
		cmds.polyEditUV(uvs, pu=uCenter + 0.5, pv=vCenter + 0.5, su= -1)
	else:
		cmds.polyEditUV(uvs, pu=uCenter + 0.5, pv=vCenter + 0.5, sv= -1)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:16,代码来源:uvsUtilities.py


示例17: rotateComponentsUVs

def rotateComponentsUVs(components, value, clockWise=True):
	"""
	This definition rotates given components UVs.

	:param components: Components. ( Tuple / List )
	:param value: Rotation value. ( Float )
	:param clockWise: Rotation direction. ( Boolean )
	:return: Definition succes. ( Boolean )
	"""

	uvs = getUVsFromComponents(components)
	uCenter, vCenter = getComponentsUVsCenter(uvs)
	if not clockWise:
		value = -value
	cmds.polyEditUV(uvs, pu=uCenter, pv=vCenter, a= -value)
	return True
开发者ID:elanifegnirf,项目名称:Snippets,代码行数:16,代码来源:uvsUtilities.py


示例18: getUVs

	def getUVs(self):
		
		# Getting current uvset
		currUVSet = cmds.polyUVSet( self.name, q=True, currentUVSet=True )[0]
		
		for i, uvSet in enumerate(self.uvSets):
			self.uvs[uvSet] = []
			# Setting uvSet temp
			cmds.polyUVSet( self.name, currentUVSet=True, uvSet=uvSet )
			
			# Get uv maps
			uvMaps = cmds.polyListComponentConversion( self.name, ff=1, tuv=1 )
			# verts = PolyFace.findWindingOrder(self.name)
			
			# print(self.vtxFaceNames)
			# cmds.polyListComponentConversion('pPlane2.vtxFace[2][1]', tuv=1 )

			if( uvMaps ):
				# uvMaps = cmds.filterExpand( uvMaps, expand=True, sm=35 )	
				uvMaps = [cmds.polyListComponentConversion(vtxFace, tuv=1 ) for vtxFace in self.vtxFaceNames ]	

				# Check to make sure there are uv's on this face.				
				for uvMap in uvMaps:
					# Get my uvValues 
					uvCoords = cmds.polyEditUV( uvMap, q=True )
					self.uvs[uvSet].append(uvCoords)
			
		# Returning to orginal uvSet	
		cmds.polyUVSet( self.name, currentUVSet=True, uvSet=currUVSet)	
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:29,代码来源:export_uv.py


示例19: makeFollicle

def makeFollicle():
    selection = cm.ls(sl=True)
    
    for i in range(0, len(selection)):  
        pos = cm.xform(selection[i], q=True, t=True, ws=True)
        follicleShape = cm.createNode('follicle')
        maya.mel.eval('pickWalk -d up;')
        follicle = cm.listRelatives(follicleShape, p=True)
        follicle = follicle[0]
        cm.move(pos[0], pos[1], pos[2], follicleShape, ws=True)
        
        mesh = selection[0].split('.vtx')[0]
        
        cm.connectAttr(mesh+'.outMesh', follicleShape+'.inputMesh', f=True)
        cm.connectAttr(mesh+'.worldMatrix', follicleShape+'.inputWorldMatrix', f=True)
        cm.connectAttr(follicleShape+'.outRotate', follicle+'.rotate', f=True)
        cm.connectAttr(follicleShape+'.outTranslate', follicle+'.translate', f=True)
    
        VtxToUV = cm.polyListComponentConversion(selection[i], fv=True, tuv=True)
        cm.select(VtxToUV)
        UV = cm.polyEditUV( query=True,)
        print UV, mesh
    
        cm.setAttr(follicleShape+'.parameterU', UV[0])
        cm.setAttr(follicleShape+'.parameterV', UV[1])
开发者ID:EllieAnsell,项目名称:FMP_Scripts,代码行数:25,代码来源:follicle_on_vtx.py


示例20: moveComponentsUVs

def moveComponentsUVs(components, u=0, v=0):
	"""
	Moves given components UVs.

	:param components: Components.
	:type components: tuple or list
	:param u: U value.
	:type u: float
	:param v: V value.
	:type v: float
	:return: Definition succes.
	:rtype: bool
	"""

	uvs = getUVsFromComponents(components, flatten=False)
	cmds.polyEditUV(uvs, u=u, v=v)
	return True
开发者ID:KelSolaar,项目名称:Snippets,代码行数:17,代码来源:uvsUtilities.py



注:本文中的maya.cmds.polyEditUV函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.polyEvaluate函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.polyCylinder函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap