def reportInfo(self): self.getMatchedParents() self.getMatchedChildren() self.returnIterator() print(guiFactory.doPrintReportStart()) print("baseName is '%s'" % self.nameBase) print("shortName is '%s'" % self.nameShort) print("longName is '%s'" % self.nameLong) print(guiFactory.doPrintReportBreak()) if self.parentNameCnt: print('%i parents found:' % self.parentNameCnt) for o in self.matchedParents: print("'%s'" % o) else: print('No name parents') print(guiFactory.doPrintReportBreak()) if self.childNameCnt: print('%i children found:' % self.childNameCnt) for o in self.matchedChildren: print("'%s'" % o) else: print('No name children') print(guiFactory.doPrintReportBreak()) if self.isObjectNameLinked: print("Name link object is %s" % self.nameLinkObject) if self.matchObjectList: print("%i match objects: " % len(self.matchObjectList)) for o in self.matchObjectList: print("'%s'" % o) else: print('No match objects found') print(guiFactory.doPrintReportBreak()) if self.claimedIterators: print("%s are claimed iterators" % self.claimedIterators) print("Object's Base iterator is %i" % self.baseIterator) print('First open iterator is %i' % self.firstOpenIterator) print("Final iterator is %i" % self.iterator) print(guiFactory.doPrintReportEnd())
def reportInfo(self): self.getMatchedParents() self.getMatchedChildren() self.returnIterator() log.info (guiFactory.doPrintReportStart()) log.info ("baseName is '%s'" %self.nameBase) log.info ("shortName is '%s'" %self.nameShort) log.info ("longName is '%s'" %self.nameLong) log.info(guiFactory.doPrintReportBreak()) if self.parentNameCnt: log.info ('%i parents found:' %self.parentNameCnt) for o in self.matchedParents: log.info ("'%s'" % o) else: log.info ('No name parents') log.info(guiFactory.doPrintReportBreak()) if self.childNameCnt: log.info ('%i children found:' %self.childNameCnt) for o in self.matchedChildren: log.info ("'%s'" % o) else: log.info ('No name children') log.info(guiFactory.doPrintReportBreak()) if self.isObjectNameLinked: log.info ("Name link object is %s" %self.nameLinkObject) if self.matchObjectList: log.info ("%i match objects: "%len(self.matchObjectList)) for o in self.matchObjectList: log.info ("'%s'" % o) else: log.info ('No match objects found') log.info(guiFactory.doPrintReportBreak()) if self.claimedIterators: log.info ("%s are claimed iterators" %self.claimedIterators) log.info ("Object's Base iterator is %i" %self.baseIterator) log.info ('First open iterator is %i' %self.firstOpenIterator) log.info ("Final iterator is %i" %self.iterator ) log.info (guiFactory.doPrintReportEnd())
def doCopyTo(self, target, targetAttrName=None, debug=True, *a, **kw): """ Replacement for Maya's since maya's can't handle shapes....blrgh... Copy attributes from one object to another as well as other options. If the attribute already exists, it'll copy the values. If it doesn't, it'll make it. If it needs to convert, it can. It will not make toast. Keywords: toObject(string) - obj to copy to targetAttrName(string) -- name of the attr to copy to . Default is None which will create an attribute oft the fromAttr name on the toObject if it doesn't exist convertToMatch(bool) -- whether to convert if necessary.default True values(bool) -- copy values. default True inputConnections(bool) -- default False outGoingConnections(bool) -- default False keepSourceConnections(bool)-- keeps connections on source. default True copyAttrSettings(bool) -- copy the attribute state of the fromAttr (keyable,lock,hidden). default True connectSourceToTarget(bool) useful for moving attribute controls to another object. default False RETURNS: success(bool) """ assert mc.objExists(target), "'%s' doesn't exist" % target assert mc.ls(target, long=True) != [self.obj.nameShort ], "Can't transfer to self!" functionName = 'doCopyTo' convertToMatch = kw.pop('convertToMatch', True) values = kw.pop('values', True) inputConnections = kw.pop('inputConnections', False) outgoingConnections = kw.pop('outgoingConnections', False) keepSourceConnections = kw.pop('keepSourceConnections', True) copyAttrSettings = kw.pop('copyAttrSettings', True) connectSourceToTarget = kw.pop('connectSourceToTarget', False) connectTargetToSource = kw.pop('connectTargetToSource', False) if debug: guiFactory.doPrintReportStart(functionName) guiFactory.report("AttrFactory instance: '%s'" % self.nameCombined) guiFactory.report("convertToMatch: '%s'" % convertToMatch) guiFactory.report("targetAttrName: '%s'" % targetAttrName) guiFactory.report("inputConnections: '%s'" % inputConnections) guiFactory.report("outgoingConnections: '%s'" % outgoingConnections) guiFactory.report("keepSourceConnections: '%s'" % keepSourceConnections) guiFactory.report("copyAttrSettings: '%s'" % copyAttrSettings) guiFactory.report("connectSourceToTarget: '%s'" % connectSourceToTarget) guiFactory.report("keepSourceConnections: '%s'" % keepSourceConnections) guiFactory.report("connectTargetToSource: '%s'" % connectTargetToSource) guiFactory.doPrintReportBreak() copyTest = [ values, inputConnections, outgoingConnections, keepSourceConnections, connectSourceToTarget, copyAttrSettings ] if sum(copyTest) < 1: guiFactory.warning( "You must have at least one option for copying selected. Otherwise, you're looking for the 'doDuplicate' function." ) return False if '.' in list(target): targetBuffer = target.split('.') if len(targetBuffer) == 2: attributes.doCopyAttr( self.obj.nameShort, self.nameLong, targetBuffer[0], targetBuffer[1], convertToMatch=convertToMatch, values=values, inputConnections=inputConnections, outgoingConnections=outgoingConnections, keepSourceConnections=keepSourceConnections, copyAttrSettings=copyAttrSettings, connectSourceToTarget=connectSourceToTarget) else: guiFactory.warning( "Yeah, not sure what to do with this. Need an attribute call with only one '.'" ) else: attributes.doCopyAttr(self.obj.nameShort, self.nameLong, target, targetAttrName, convertToMatch=convertToMatch, values=values, inputConnections=inputConnections, outgoingConnections=outgoingConnections, keepSourceConnections=keepSourceConnections, copyAttrSettings=copyAttrSettings, connectSourceToTarget=connectSourceToTarget) if debug: guiFactory.doPrintReportEnd(functionName)
def doCopyTo(self,target, targetAttrName = None, debug = True,*a,**kw): """ Replacement for Maya's since maya's can't handle shapes....blrgh... Copy attributes from one object to another as well as other options. If the attribute already exists, it'll copy the values. If it doesn't, it'll make it. If it needs to convert, it can. It will not make toast. Keywords: toObject(string) - obj to copy to targetAttrName(string) -- name of the attr to copy to . Default is None which will create an attribute oft the fromAttr name on the toObject if it doesn't exist convertToMatch(bool) -- whether to convert if necessary.default True values(bool) -- copy values. default True incomingConnections(bool) -- default False outGoingConnections(bool) -- default False keepSourceConnections(bool)-- keeps connections on source. default True copyAttrSettings(bool) -- copy the attribute state of the fromAttr (keyable,lock,hidden). default True connectSourceToTarget(bool) useful for moving attribute controls to another object. default False RETURNS: success(bool) """ assert mc.objExists(target),"'%s' doesn't exist"%target assert mc.ls(target,long=True) != [self.obj.nameShort], "Can't transfer to self!" functionName = 'doCopyTo' convertToMatch = kw.pop('convertToMatch',True) values = kw.pop('values',True) incomingConnections = kw.pop('incomingConnections',False) outgoingConnections = kw.pop('outgoingConnections',False) keepSourceConnections = kw.pop('keepSourceConnections',True) copyAttrSettings = kw.pop('copyAttrSettings',True) connectSourceToTarget = kw.pop('connectSourceToTarget',False) connectTargetToSource = kw.pop('connectTargetToSource',False) if debug: guiFactory.doPrintReportStart(functionName) guiFactory.report("AttrFactory instance: '%s'"%self.nameCombined) guiFactory.report("convertToMatch: '%s'"%convertToMatch) guiFactory.report("targetAttrName: '%s'"%targetAttrName) guiFactory.report("incomingConnections: '%s'"%incomingConnections) guiFactory.report("outgoingConnections: '%s'"%outgoingConnections) guiFactory.report("keepSourceConnections: '%s'"%keepSourceConnections) guiFactory.report("copyAttrSettings: '%s'"%copyAttrSettings) guiFactory.report("connectSourceToTarget: '%s'"%connectSourceToTarget) guiFactory.report("keepSourceConnections: '%s'"%keepSourceConnections) guiFactory.report("connectTargetToSource: '%s'"%connectTargetToSource) guiFactory.doPrintReportBreak() copyTest = [values,incomingConnections,outgoingConnections,keepSourceConnections,connectSourceToTarget,copyAttrSettings] if sum(copyTest) < 1: guiFactory.warning("You must have at least one option for copying selected. Otherwise, you're looking for the 'doDuplicate' function.") return False if '.' in list(target): targetBuffer = target.split('.') if len(targetBuffer) == 2: attributes.doCopyAttr(self.obj.nameShort, self.nameLong, targetBuffer[0], targetBuffer[1], convertToMatch = convertToMatch, values=values, incomingConnections = incomingConnections, outgoingConnections=outgoingConnections, keepSourceConnections = keepSourceConnections, copyAttrSettings = copyAttrSettings, connectSourceToTarget = connectSourceToTarget) else: guiFactory.warning("Yeah, not sure what to do with this. Need an attribute call with only one '.'") else: attributes.doCopyAttr(self.obj.nameShort, self.nameLong, target, targetAttrName, convertToMatch = convertToMatch, values=values, incomingConnections = incomingConnections, outgoingConnections=outgoingConnections, keepSourceConnections = keepSourceConnections, copyAttrSettings = copyAttrSettings, connectSourceToTarget = connectSourceToTarget) if debug: guiFactory.doPrintReportEnd(functionName)