3dsmax maxscript:如何按照我选择的顺序获得 array/list 个顶点?
3dsmax maxscript: How do I get an array/list of verts in the order I selected them?
我正在为 3dsmax 编写一个工具,它要求用户按照在数组中选择顶点的顺序获取选定的顶点,但到目前为止,这个 returns 顶点是按照它们创建的顺序传递的:
sel = getCurrentSeletion()
selvets = vsel[1].selectedVerts
如何使用 maxscript 以我在 3ds max 中选择的顺序获取选定的顶点?
如果在 maxscript 中没有办法,在 python 中有没有办法做到这一点?
如果你只关心顶点的位置,你可以使用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 selectVerts
我正在为 3dsmax 编写一个工具,它要求用户按照在数组中选择顶点的顺序获取选定的顶点,但到目前为止,这个 returns 顶点是按照它们创建的顺序传递的:
sel = getCurrentSeletion()
selvets = vsel[1].selectedVerts
如何使用 maxscript 以我在 3ds max 中选择的顺序获取选定的顶点?
如果在 maxscript 中没有办法,在 python 中有没有办法做到这一点?
如果你只关心顶点的位置,你可以使用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 selectVerts