我正在为3dsmax编写一个工具,它要求用户按照在数组中选择顶点的顺序来获取所选顶点,但是到目前为止,传递这个函数会按照顶点的创建顺序返回顶点:
sel = getCurrentSeletion()
selvets = vsel[1].selectedVerts如何使用maxscript按照在3ds max中选择顶点的顺序来获取选定顶点?
如果在maxscript中没有办法,有没有办法在python中做到这一点?
发布于 2019-09-29 21:43:56
如果你只关心顶点的位置,你可以使用pickPoint函数。否则,在选择更改时进行更新的回调,并记录差异。例如(如果当前节点是可编辑多边形):
try destroyDialog selectVerts catch()
rollout selectVerts ""
(
local verts, currentSel
fn collectVerts event nodes =
(
local sel = polyop.getVertSelection $
local newVerts = sel - currentSel
local removedVerts = currentSel - sel
for v in removedVerts do if (local index = findItem verts v) > 0 do deleteItem verts index
for v in newVerts do append verts v
currentSel = sel
)
local callback = nodeEventCallback mouseUp:on enabled:off subobjectSelectionChanged:collectVerts
checkButton chbSwitchCallback "Select verts"
on chbSwitchCallback changed state do
(
if state and isKindOf $ Editable_Poly then
(
verts = #()
currentSel = polyop.getVertSelection $
callback.enabled = on
)
else
(
callback.enabled = off
print verts #noMap
)
)
)
createDialog selectVertshttps://stackoverflow.com/questions/58122403
复制相似问题