(
on execute do
(
local AttachableObjectArray = #()
local SelectedNodes = getCurrentSelection()
local Idx = 1
for object in SelectedNodes[Idx].children do
(
append AttachableObjectArray object
)
for i = 1 to AttachableObjectArray.count do
(
polyop.attach attachableobjectarray[1] attachableobjectarray[i]
for j = 1 to AttachableObjectArray.count do
(
if attachableobjectarray.count <= j do
(
deselect SelectedNodes[Idx]
)
)
)
SelectedNodes = getCurrentSelection()
print SelectedNodes.count
)
这是我当前的脚本它可以工作但是只能在一个层次结构上工作我需要它通过我的选择循环直到所有父母的孩子都附属于 彼此
问题: 父母----儿童 - 儿童 - 父母-----儿童 - 儿童 - 儿童 当前脚本: 家长----附属儿童-----儿童 - 儿童 -
由父母创建一个假人,其盒子与虚拟
相关联提前致谢
答案 0 :(得分:0)
for obj in $/selection/* do -- use just the top-level nodes
(
local children = join #() obj
local childrenToAttach = for i = 2 to children.count where canConvertTo children[i] Mesh collect children[i]
if childrenToAttach.count > 1 do convertToPoly childrenToAttach[1]
for i = 2 to childrenToAttach.count do polyop.attach childrenToAttach[1] childrenToAttach[i]
)