def testXml(self):
     '''
     test serialize to XML and back
     '''
     model1 = self.createSampleModel()
     exporter = XmlExporter()
     xml = exporter.process(model1)
     
     importer = XmlImporter()
     model2 = importer.process(xml)
     
     # make sure unserialized model matches original model
     self.assertModelsEqual(model1, model2)
 def testUnserializeManualXmlInfluences(self):
     xml = """<?xml version="1.0" encoding="UTF-8"?>
                 <ngstLayerData version="1.0">
                     <mirrorInfluenceAssociation destination="b" source="a"/>
                     <mirrorInfluenceAssociation destination="a" source="b"/>
                     <layer enabled="no" mask="1 1 0 0" name="base  layer" opacity="1e-05"/>
                     <layer enabled="yes" mask="1 1 0 0" name="layer 2" opacity="0.9000000000009">
                         <influence index="0" name="root|L_Joint1" weights="0.1 0.2 0.3 0.4"/>
                     </layer>
                 </ngstLayerData>""";
     importer = XmlImporter()
     result = importer.process(xml)
     self.assertDictionariesEqual(result.mirrorInfluenceAssociationOverrides, {'a':'b','b':'a'})
    def testDefectXmlImportIssue(self):
        openMayaFile("defect-xml-import-fails/mirror_association_issues.ma")

        importer = XmlImporter()
        data = importer.process(getTestFileContents("defect-xml-import-fails/mirror_weighting_manual_layers.xml"))
        
        
        mll = MllInterface()
        mll.setCurrentMesh("pSphere1")
        
        
        overrides = mll.listManualMirrorInfluenceAssociations()
        self.assertEqual(len(overrides), 0)
        
        data.saveTo("pSphere1")
        
        overrides = mll.listManualMirrorInfluenceAssociations()
        self.assertEqual(len(overrides), 1)