[Closed] Convert unwrap edges to mesh
BTW I’m sorry for misunderstanding, I work with Poly, not a Mesh.
And yes, unwrap.GetSelectedGeomEdges doesn’t work on Mesh too.
denisT, thanks for your code but it works slower than my own.
Here is a short gif record of how my script works on “simple” selections. Algorythm is pretty stupid and described in first post (second method).
In many real world cases it works flawlessly. However I’m hoping to improve it.
I have a question.
Can Unwrap edges numeration be somehow reproduces based on uv verts numeration? I mean slowest part of all methods in web is “select unwrap edge > convert to verts” repeated many times in loop. So to remove this step I need to know 2 uv verts of each uv edge or something like this.
I understand that “uv edge” is something that we have only in Unwrap context.
Mesh builded from uv verts have different edges indexation than unwrap. Mesh builded from Channel info uv>poly have different edges indexation.
Here is a part of my script.
fn NS_TransferUvEdgesToPoly = (
local obj = selection[1]
local unwMod = obj.modifiers[Unwrap_UVW]
modPanel.setCurrentObject unwMod
local edgesSel = unwMod.getSelectedEdges()
if not edgesSel.isEmpty then (
ts1=timestamp()
setWaitCursor()
subobjectlevel = 1
unwMod.edgeToVertSelect()
local vertsAll = unwMod.getSelectedGeomVerts()
unwMod.vertToEdgeSelect()
local edgesAll = unwMod.getSelectedEdges()
local edgesExclude = edgesAll - edgesSel
local betterToExclude = edgesExclude.numberset < edgesSel.numberset
local edgesToParse = if betterToExclude then edgesExclude else edgesSel
local edgesToParseArr = edgesToParse as array
local cSelectEdges = unwMod.selectEdges
for i=1 to edgesToParseArr.count do (
ed = edgesToParseArr[i]
cSelectEdges #{ed}
unwMod.edgeToVertSelect()
edgesToParseArr[i] = unwMod.getSelectedGeomVerts()
)
unwMod.selectEdges edgesSel
subobjectlevel = 0
-- END get unwrap edges selection
op = Edit_Poly()
local polyEdges = #{}
local epSetSelection = op.SetSelection
local epConvertSelection = op.ConvertSelection
local epGetSelection = op.GetSelection
modPanel.addModToSelection op ui:on
op.SetOperation #UnhideAllVertex
if betterToExclude then (
epSetSelection #Vertex vertsAll node:obj
epConvertSelection #Vertex #Edge requireAll:true
polyEdges = epGetSelection #Edge node:obj
)
for vPair in edgesToParseArr do (
epSetSelection #Vertex vPair node:obj
epConvertSelection #Vertex #Edge requireAll:true
if betterToExclude then polyEdges -= op.GetSelection #Edge node:obj
else polyEdges += epGetSelection #Edge node:obj
)
epSetSelection #Edge polyEdges node:obj
subobjectlevel = 2
setArrowCursor()
clearlistener()
format "time: % ms
" (timestamp()-ts1)
)
)
NS_TransferUvEdgesToPoly()