你发布的代码只是进行导入。你在寻找你在循环的每一步导入的对象?
隔离导入对象的简单方法是在导入时指定命名空间。然后,可以使用新的命名空间快速定位对象:
for eachfile in list_of_files:
# make a namespace. In production you might want to double
# check to make sure the same namespace does not already exist
import_ns = os.path.splitex(os.path.basename(eachfile))[0]
cmds.file(eachfile, i=True, ns = import_ns)
# this gets all of the imported stuff:
imported_objects = cmds.ls (import_ns + ":*")
# now you can loop over it and rename as needed.
您只能从
imported_objects
通过使用类型标志向ls添加第二个调用,即
imported_shapes = cmds.ls(imported_objects, type='shape')