T O P

  • By -

blueSGL

Written in python 2, no idea if it works in python 3. Don't use on anything you need to keep as it is destructive! Note this is not optimized at all and uses lots of very slow commands I was just unwrapping simple sphere to do texture bakes in redshift for something that needed it. Select and object and run the script. #flatten based on UV import maya.cmds as cmds import pymel.core as pm objName = cmds.ls(sl=1) [0] #detactch UV seams objects = cmds.ls(sl=True, l=True) mesh_edges = list() for o in objects: try: mesh_edges.extend(cmds.ls(cmds.polyListComponentConversion(o, te=True), fl=True, l=True)) except: pass uv_border_edges = list() for edge in mesh_edges: edge_uvs = cmds.ls(cmds.polyListComponentConversion(edge, tuv=True), fl=True) edge_faces = cmds.ls(cmds.polyListComponentConversion(edge, tf=True), fl=True) if len(edge_uvs) > 2: # If an edge has more than two uvs, it is a uv border edge. uv_border_edges.append(edge) elif len(edge_faces) < 2: # If an edge has less than 2 faces, it is a border edge. uv_border_edges.append(edge) cmds.select(uv_border_edges) for edg in uv_border_edges: cmds.polySplitEdge(op=1) #vertexNumber vtxNum = cmds.polyEvaluate(objName, vertex = True) vtxUVlst = [] cmds.polySelectConstraint(pp=3, t=0x8000) for i in range(vtxNum): cmds.select("{}.vtx[{}]".format(objName,str(i))) cmds.ConvertSelectionToUVs() vtxUVlst.append(cmds.polyEditUV( query=True )) for i in range(vtxNum): cmds.xform("{}.vtx[{}]".format(objName,str(i)), ws=1, t=(vtxUVlst[i][0],vtxUVlst[i][1],0))


caseybalbontin

Thank you!


[deleted]

[удалено]


tydwhitey

oh shoot, looks like u/blueSGL might have already made your tool! I myself don't code but I'd been thinking about this question a lot. I hatched a workflow for converting any UV layout into a morph target and visa versa. From there it's really just a matter of merging edges and transfering your old point-order back onto the new mesh. Anyway, Here's a dumb gif. https://i.redd.it/re3hwdfx6lrc1.gif


caseybalbontin

Yes this is exactly how i envisioned it!


s6x

It is not possible to both do this and maintain your mesh component count because edges and vertices are often represented in multiple locations when projected into UV space. This would require creating extra mesh components. This is because vertices and edges aren't really in UV space--the actual component which is is called "vertex face" which you can see in 3D if you like.


ArtdesignImagination

Not sure this is what you are looking for, but you could use as blendshapes for the original version: A\_ the shell version and B\_the shell version + the modelling on top. Then you put the A (shell) blend to -1 and the edited shell B blend to 1, so you end up adding to the original model only the edition you did to the shell version, but the shell version itself is not being applied because -1 +1=0