按名稱查詢物件

使用 ls() 命令按名稱查詢物件:

freds = cmds.ls("fred") 
#finds all objects in the scene named exactly 'fred', ie [u'fred', u'|group1|fred']

使用*作為萬用字元:

freds = cmds.ls("fred*")
# finds all objects whose name starts with 'fred'
# [u'fred', u'frederick', u'fred2']

has_fred = cmds.ls("*fred*")
# [u'fred', u'alfred', u'fredericka']

ls() 接受多個過濾字串引數:

cmds.ls("fred", "barney") 
# [u'fred', u'|group1|barney']

它也可以接受一個可迭代的引數:

look_for = ['fred', 'barney']
# cmds.ls(look_for)
# [u'fred', u'|group1|barney']