fn BuildUVEdgeAccordance obj UMod =
(
local EdgesCount = polyOp.getNumEdges obj
local EdgesVerts = polyop.getEdgesVerts obj #{1..EdgesCount}
local ReturnArray = #()
for i = 1 to EdgesCount do
(
UMod.setTVSubObjectMode 2
UMod.setSelectedGeomEdgesByNode #{i} obj
UMod.edgeToVertSelect()
UMod.setTVSubObjectMode 1
local UVEdgeVerts = umod.getSelectedGeomVertsByNode obj
local s = timeStamp()
local j = 1
while ((UVEdgeVerts - (EdgesVerts[j] as BitArray)).numberset != 0) and (j < EdgesCount) do
(
j += 1
if ((timestamp()) - s) / 1000 > 5 then (print "Error in while loop in BuildUVEdgeAccordance" return undefined)
)
ReturnArray[j] = i
)
ReturnArray
)
fn ConvertGeomToUV GeomArray UVArray =
(
(for a in GeomArray collect UVArray[a]) as bitarray
)
fn GetIntSelectionLevel obj =
(
case getSelectionLevel obj of
(
#object: 0
#vertex: 1
#edge: 2
#face: 3
)
)
fn UVWSetSelection UMod obj VertSel EdgeSel FaceSel =
(
UMod.setTVSubObjectMode 1
UMod.setSelectedGeomVertsByNode VertSel obj
/*UMod.setTVSubObjectMode 3
UMod.selectFacesByNode FaceSel obj*/
UMod.setTVSubObjectMode 2
UMod.setSelectedGeomEdgesByNode EdgeSel obj
UMod.setTVSubObjectMode (GetIntSelectionLevel obj)
)
fn MainFunc =
(
local NotificationArr = callbacks.notificationParam()
local obj = NotificationArr[1]
local UMod = NotificationArr[2]
if (selection.count != 1) or (classof UMod != unwrap_uvw) then return 0
modPanel.setCurrentObject UMod
local UVArray = BuildUVEdgeAccordance $ $.modifiers[1]
local VertSel = #{}
local EdgeSel = #{}
local FaceSel = #{}
case (classof obj.baseobject) of
(
Editable_Poly:
(
VertSel = polyop.getVertSelection obj.baseobject
EdgeSel = polyop.getEdgeSelection obj.baseobject
FaceSel = polyop.getFaceSelection obj.baseobject
)
Editable_Mesh:
(
VertSel = getVertSelection obj.mesh
EdgeSel = getEdgeSelection obj.mesh
FaceSel = getFaceSelection obj.mesh
)
)
local ConvertedEdgeSel = ConvertGeomToUV EdgeSel UVArray
UVWSetSelection UMod obj VertSel ConvertedEdgeSel FaceSel
)
TransferUnwrapSelection = MainFunc
callbacks.removeScripts id:#TransferUnwrapSelection
callbacks.addScript #postModifierAdded TransferUnwrapSelection id:#TransferUnwrapSelection
Replies
though it ain't pretty :?
Last time I saw a C++ sintaxis - was in university more than 10 years ago
But thanks anyway I will look at it and hopefully will be able to undersand something.