丨脚本丨将物体放入指定图层

将符合条件的物体放入新图层,不符合的物体放入另外的图层

1
2
3
4
5
6
7
8
9
10
11
12
 framerate=25

body = #("boy_rig_end1:surfaceShape", "boy_rig_end1:wheel01Shape", "boy_rig_end1:wheel02Shape", "boy_rig_end1:axisShape", "boy_rig_end1:coatShape", "boy_rig_end1:trousersShape", "boy_rig_end1:hairsShape", "boy_rig_end1:Lshoe_VampShape", "boy_rig_end1:Lshoe_ShoelaceShape", "boy_rig_end1:Lshoe_ringShape", "boy_rig_end1:Lshoe_figureShape", "boy_rig_end1:Lshoe_upperShape", "boy_rig_end1:Lshoe_soleShape", "boy_rig_end1:Rshoe_VampShape", "boy_rig_end1:Rshoe_ShoelaceShape")

NL = LayerManager.newLayerFromName "****小孩动作*****"
NL2 = LayerManager.newLayerFromName "****随小孩导入,勿删****"
NL2.ishidden=true

for b in objects do if (finditem body b.name)!=0 then NL.addNode b else NL2.addNode b

------finditem 返回的值是b.name在body数组中下标,当b.name 在body中不存在时,返回值为0
-----maxscript中只有if...then....else和 if....do... 不存在if....do....else