Is there a way to see if an object exists in Maya, but only search for a partial object name?
Example, search for an object that starts with object
, but it's actual name is object_001
.
Is there a way to do this? As it stands I only know how to search for a specific name:
if (objExists('object_001'):
//Do Something
But obviously the obj
stringwould have to be exact to the object e it self.
Pymel
ls
seems to accept directly a regular expression matching names, thus the following should work - provided that matching elements exists, a non-empty list will be returned; and a non-empty list in boolean context will be evaluated asTrue
, whereas an empty will beFalse
.