maya Finding scene objects Find objects by name


Use the ls() commands to find objects by name:

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

Use * as a wildcard:

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

has_fred ="*fred*")
# [u'fred', u'alfred', u'fredericka']

ls() takes multiple filter string arguments:"fred", "barney") 
# [u'fred', u'|group1|barney']

It can also accept an iterable argument:

look_for = ['fred', 'barney']
# [u'fred', u'|group1|barney']