Beispiel #1
0
    def test_import_skin_on_selected_subset(self):
        file_path = self.get_temp_filename("temp.skin")
        skinio.export_skin(file_path, self.shape)
        cmds.skinPercent(
            self.skin,
            "{0}.vtx[0]".format(self.shape),
            transformValue=[(self.joint1, 0.1), (self.joint2, 0.2),
                            (self.joint3, 0.7)],
        )
        cmds.skinPercent(
            self.skin,
            "{0}.vtx[1]".format(self.shape),
            transformValue=[(self.joint1, 0.1), (self.joint2, 0.2),
                            (self.joint3, 0.7)],
        )
        cmds.select("{}.vtx[1]".format(self.shape))
        skinio.import_skin(file_path, to_selected_shapes=True)

        skin = skinio.SkinCluster(self.skin)
        data = skin.gather_data()

        w1 = [0.1, 0.5, 0.5, 0.0, 0.5, 0.0, 0.9, 0.5]
        w2 = [0.2, 0.5, 0.5, 0.5, 0.5, 0.5, 0.1, 0.5]
        w3 = [0.7, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0]
        self.assertListAlmostEqual(w1, data["weights"]["joint1"])
        self.assertListAlmostEqual(w2, data["weights"]["joint2"])
        self.assertListAlmostEqual(w3, data["weights"]["joint3"])
Beispiel #2
0
 def test_import_skin_sets_correct_data(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     cmds.skinPercent(self.skin, '{0}.vtx[0]'.format(self.shape),
                      transformValue=[(self.joint1, 0.1), (self.joint2, 0.2), (self.joint3, 0.7)])
     skinio.import_skin(file_path)
     self.test_skincluster_data_is_correct()
Beispiel #3
0
 def test_import_skin_sets_correct_data(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     cmds.skinPercent(self.skin,
                      '{0}.vtx[0]'.format(self.shape),
                      transformValue=[(self.joint1, 0.1),
                                      (self.joint2, 0.2),
                                      (self.joint3, 0.7)])
     skinio.import_skin(file_path)
     self.test_skincluster_data_is_correct()
Beispiel #4
0
 def test_import_skin(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     cmds.delete(self.skin)
     skinio.import_skin(file_path)
     self.assertTrue(cmds.objExists(self.skin))
Beispiel #5
0
 def test_export_skin(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     self.assertTrue(os.path.exists(file_path))
     self.assertGreater(os.path.getsize(file_path), 0)
Beispiel #6
0
 def test_import_skin(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     cmds.delete(self.skin)
     skinio.import_skin(file_path)
     self.assertTrue(cmds.objExists(self.skin))
Beispiel #7
0
 def test_export_skin(self):
     file_path = self.get_temp_filename('temp.skin')
     skinio.export_skin(file_path, self.shape)
     self.assertTrue(os.path.exists(file_path))
     self.assertGreater(os.path.getsize(file_path), 0)