Exemple #1
0
 def test_func(meshes, joints):
     results = []
     for geo in meshes:
         pm.select(geo, r=True)
         pm.select(joints, add=True)
         try:
             pc = pm.skinCluster()
             results.append(pc)
         except RuntimeError:
             pass
     return results
Exemple #2
0
 def run_test(use_wrapper=False):
     '''test function with wrapper'''
     pm.select(self.genObRoots)
     test_wrapper = partial(
         test_func, sl=use_wrapper)
     if use_wrapper:
         test_results = test_wrapper()
     else:
         test_results = test_wrapper(self.genObRoots[:-1], self.genObRoots[-1])
     self.general_test(pm.ls(type='parentConstraint'), test_results)
     return test_results
Exemple #3
0
 def run_test(use_wrapper=False):
     '''test function with wrapper'''
     pm.select(self.genObRoots)
     test_wrapper = partial(
         test_func, sl=use_wrapper)
     if use_wrapper:
         test_results = test_wrapper()
     else:
         test_results = [
             test_wrapper(o, pm.selected()[id+1])
             for id, o in enumerate(pm.selected())
             if not id%2]
     self.general_test(pm.ls(type='parentConstraint'), test_results)
     return test_results
Exemple #4
0
 def run_test(use_wrapper=False):
     '''test function with wrapper'''
     pm.select(self.selected)
     test_wrapper = partial(
         test_func, sl=use_wrapper)
     if use_wrapper:
         test_results = test_wrapper()
     else:
         test_results = map(test_wrapper, pm.selected())
     self.general_test(self.selected, test_results)
     for ob in self.selected:
         self.assertTrue(
             ob.name().count('newTestSphere'),
             'result for %s do not match expected'%ob)
     return test_results
Exemple #5
0
 def run_test(use_wrapper=False):
     '''test function with wrapper'''
     pm.select(self.genObRoots)
     test_wrapper = partial(
         test_func, sl=use_wrapper)
     if use_wrapper:
         test_results = test_wrapper()
     else:
         test_results = map(
             test_wrapper,
             pm.selected() + [oc for o in pm.selected()
                              for oc in o.getChildren(
                                  type='transform', ad=True)])
     self.general_test(self.selected, test_results)
     for ob in self.selected:
         self.assertTrue(
             ob.name().count('newTestSphere'),
             'result for %s do not match expected'%ob)
     return test_results
Exemple #6
0
        def run_test(use_wrapper=False):
            joints = []
            locs = []
            count = len(self.genObRoots)
            for i in range(count):
                pm.select(cl=True)
                joints.append(pm.joint(p=[0, i, 0]))
                loc = pm.spaceLocator()
                locs.append(loc)
            sph = pm.polySphere(radius=10)
            pm.select(cl=True)
            for i in range(count):
                i += 1
                pm.select(sph[0].getShape().vtx[i], add=True)
            pm.select(locs, add=True)
            pm.select(joints, add=True)
            test_wrapper = partial(
                test_func, sl=use_wrapper)
            if use_wrapper:
                test_results = test_wrapper()
            else:
                test_results = test_wrapper(pm.selected())
            self.assertTrue(
                pm.ls(type='parentConstraint'),
                'Joint and Loc did not connect, No Parent Constraint in Scene')
            self.assertTrue(
                pm.ls(type='pointOnPolyConstraint'),
                'Loc did not connect to mesh, no PointOnPoly Constraint in Scene')
            for j, l in zip(joints, locs):
                self.assertTrue(
                    j.inputs(type='parentConstraint'),
                    '%s do not have any Parent Constraint Connection'%j)
                self.assertTrue(
                    l.outputs(type='parentConstraint'),
                    '%s do not have any Parent Constraint Connection'%l)
                self.assertTrue(
                    l.inputs(type='pointOnPolyConstraint'),
                    '%s do not have any Point On Poly Constraint Connection'%l)

            return test_results
Exemple #7
0
        def run_test(use_wrapper=False):
            '''test function with wrapper'''
            pm.select(cl=True)
            joints = []
            for i in range(5):
                joints.append(pm.joint(p=[0, i, 0]))
            pm.select(self.selected, r=True)
            pm.select(joints, add=True)
            test_wrapper = partial(
                test_func, sl=use_wrapper)
            if use_wrapper:
                test_results = test_wrapper()
            else:
                test_results = [
                    test_wrapper(m,js) for m, js in zip(
                        [o for o in pm.selected() if ul.get_type(o) == 'mesh'],
                        [o for o in pm.selected() if ul.get_type(o) == 'joint'])]
            self.general_test(pm.ls(type='skinCluster'), test_results)
            for skinClter in pm.ls(type='skinCluster'):
                self.general_test(skinClter.getInfluence(), joints)

            return test_results