Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Select 从MaxScript中的对象列表创建数组,并将其添加到新图层_Select_Layer_3dsmax_3ds - Fatal编程技术网

Select 从MaxScript中的对象列表创建数组,并将其添加到新图层

Select 从MaxScript中的对象列表创建数组,并将其添加到新图层,select,layer,3dsmax,3ds,Select,Layer,3dsmax,3ds,我是Maxscript的新手,希望自动化一个过程,我一直在看一些教程,但我遇到了一个选择问题。我想做的是,我有一个字符串列表(我可能必须添加到其中),这些字符串表示max文件中我要选择的对象(如果该文件中存在),然后添加到新层 例如: /* I have a big long list of objects I want to mass select, this has to be hardcoded because its a similar list that exists in a ton

我是Maxscript的新手,希望自动化一个过程,我一直在看一些教程,但我遇到了一个选择问题。我想做的是,我有一个字符串列表(我可能必须添加到其中),这些字符串表示max文件中我要选择的对象(如果该文件中存在),然后添加到新层

例如:

/* I have a big long list of objects I want to mass select, this has to be hardcoded because its a similar list that exists in a ton of max files */
rObj1 = "testObj1"
rObj2 = "sampleObj2"
""
rObj99 = "newObj90"

/*I want to then add it to an array
removeList = #(rObj***)

/* Then run through each entry in the array to make sure it exists and then add it to my selection
for i in removeList do
    (
    if i != undefined then select (i)   
    )

/*Then Add what I have selected to a new layer

newLayer = LayerManager.newLayerFromName "removed_list"
for obj in selection do newLayer.addNode obj

当涉及到选择时,我不断遇到一个错误,作为Max的新手,我不知道该怎么办。

您正在尝试选择字符串,您应该在其中选择(或添加到层)对象:

newLayer = LayerManager.newLayerFromName "removed_list"
for objName in removeList where isValidNode (getNodeByName objName) do
    newLayer.addNode (getNodeByName objName)