def addToControlDict(_dict, _identifier, _control): error.assertStringDict(_dict) error.assertString(_identifier) error.assertString(_control) assert _identifier not in _dict, "%s is already in _dict" %(_identifier) # Check that _control is not already mapped notInDict = True for key, value in _dict.items(): if value == _control: inDict = False break assert notInDict, "%s is already in _dict" %(_control) # Actually add to _dict _dict[_identifier] = _control
def renameControls(_renameMap): error.assertStringDict(_renameMap) errorString = [] for control in _renameMap: #Check that it exists if cmds.objExists(control): actualName = cmds.rename(control, _renameMap[control]) if actualName != _renameMap[control]: errorString.append( "Error -- Couldn't rename %s to %s, instead renamed to %s" \ %(control, _renameMap[control], actualName)) else: errorString.append("Error -- Can't find%s\n" %(control)) print "".join(errorString)
def addDictToControlDict(_destination, _source): error.assertStringDict(_destination) error.assertStringDict(_source) for key, value in _source.items(): addToControlDict(_destination, key, value)