Exemplo n.º 1
0
		def saveRigData(self):
			"""
				Saves registered rig Data
			"""
			
			self.UI.getFilePath()  
			filePath = (str(self.UI.filePath) + "rigData.txt")
			writeData = ""
			tab = "\t"
			
			# Get container data
			moduleList = self.getModules()
			# for each module
			for module in moduleList:
				# get registered Attributeibutes
				writeData += (module + "\n")
				inputData = []
				outputData = []
				connectionsData = []
				regData = []
				registeredAttrs = self.Modules[module].getRegisteredAttributes()
				
				# save container data
				for regAttr in registeredAttrs:
					writeLine = ""
					Attribute = (self.Modules[module].container + "." + regAttr )
					AttributeType = cmds.getAttr(Attribute, type = True)
					AttributeData = ""
					if AttributeType != "message":
						AttributeData = cmds.getAttr(Attribute)
					
					# if Attribute == message store Attributeibute name and type
					if AttributeType == "message":
						writeLine += ( tab +  Attribute + " " + AttributeType ) 
					# if Attribute == string store Attributeibute name and data
					elif AttributeType == "stringArray":
						writeLine += ( tab + Attribute + " " + AttributeType)
						for data in AttributeData:
							writeLine+= (" " + data)
					# if Attribute == etc store Attributeibute name and data
					else:
						writeLine += ( tab +  Attribute + " " + AttributeType + " " + AttributeData ) 
					writeLine += ("\n")
					
					if regAttr.startswith("input"):
						inputData.append(writeLine)
					elif regAttr.startswith("output"):
						outputData.append(writeLine)
					elif regAttr.startswith("connection"):
						connectionsData.append(writeLine)
					else:
						regData.append(writeLine)
				
				# Save transforms
				if "regRigTransform" in registeredAttrs:
					regTransFilePath = (str(self.UI.filePath) + module + "RigTransData.txt")
					Util.saveTransforms(regTransFilePath, module,  Util.getRegisteredObjects(module,"regRigTransform") )
				# Save shapes
				if "regRigShapes" in registeredAttrs:
					regTransFilePath = (str(self.UI.filePath) + module + "RigShapeData.txt")
					Util.saveShapes(regTransFilePath, module,  Util.getRegisteredObjects(module,"regRigShapes") )
				
				writeData += (tab + "Inputs:\n")
				for data in inputData:
					writeData += (tab + data)
				writeData += (tab + "Outputs:\n")
				for data in outputData:
					writeData += (tab + data)
				writeData += (tab + "Connections:\n")
				for data in connectionsData:
					writeData += (tab + data)
				writeData += (tab + "RegisteredAttr:\n")
				for data in regData:
					writeData += (tab + data)
			
			print ("Saving blueprint data to : " + filePath)
			FILE = open(filePath,"wb")
			blueprintData = FILE.write(writeData)
			FILE.close()
			print ("Blue print data successfully saved!")