帮朋友写的查找选择的父子骨骼。之前我都是用递归,这个好、
---第一种方法。
sel_array=for i in selection collect i ---确保收集的是骨骼
global op = false
global oop=undefined
for j in 1 to sel_array.count do
(
for i in 1 to sel_array.count do
(
if sel_array[j].parent !=sel_array[i] then
(
op= true
oop =sel_array[j] as string
--print oop
)
/*else
(
op= true
if op then
oop =sel_array[j] as string
)*/
)
)
if op then
(
print oop
)
sel_array=#()
---第二种方法
sel_array=for i in selection collect i ---确保收集的是骨骼
boneb=#()
for i in sel_array do
(
case of
(
(i.parent==undefined):
(
append boneb i
)
( findItem sel_array (i.parent)==0 ):
(
append boneb i
)
)---end case
)---end for
select boneb