Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. #Code buggé pour get la position des UVs qui seront utilisés comme référence.
  2. import maya.cmds as cmds
  3. import math
  4. cmds.circle( degree=1, sections=3)
  5. cmds.rotate( 90, 0, 0)
  6. cmds.planarSrf()
  7. cmds.nurbsToPoly(name='Cone')
  8. cmds.polyReduce(keepBorder=True, percentage=99)
  9. cmds.polyListComponentConversion(toFace=True)
  10. cmds.polyExtrudeFacet(offset=0.5)
  11. cmds.polyListComponentConversion(toVertex=True)
  12. cmds.polyMergeVertex(distance=0.1)
  13. cmds.select('Cone.vtx[3]')
  14. cmds.xform(translation=[0.0, 1.41421367030, 0.0])
  15. cmds.polySoftEdge()
  16. cmds.polyAutoProjection()
  17. cmds.unfold()
  18. def getInitialUvLocation (object, *args):
  19.     global initialUvDict
  20.     object = cmds.ls(selection = True)
  21.     faceList = cmds.polyListComponentConversion (object, toFace=True)
  22.     cmds.select(faceList[0])
  23.     initial_face = (faceList[0])
  24.     cmds.select(initial_face)
  25.     print(initial_face)
  26.     uvList = cmds.polyListComponentConversion (initial_face, toUV=True)
  27.     print(uvList)
  28.     cmds.ls (uvList)
  29.     print(uvList[0])
  30.     initialUvDict = {"Uv1_Location" : uvList[0], "Uv2_Location" : uvList[1], "Uv3_Location" : uvList[2]}
  31. getInitialUvLocation (object)
  32.  
  33. #Version où les UVs sont tous dans la même liste
  34. def getTargetUvsLocation (object, *args)
  35.     object = cmds.ls(selection = True)
  36.     faceList = cmds.polyListComponentConversion( object, toFace=True)
  37.     cmds.ls( object, selection=True)
  38.     print(faceList)
  39.     otherFaces = (faceList[1:])
  40.     print(otherFaces)
  41.     UVs = cmds.polyListComponentConversion(otherFaces, toUV=True)
  42. getTargetUvsLocation('Cone')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement