示例#1
0
    def test_build_joint_chain(self):
        reg_node, chain = utils.build_joint_chain(name='temp',
                                                  crv=self.crv,
                                                  order='xyz',
                                                  num=10,
                                                  loc=self.loc)

        # Confirm right number of joints
        self.assertEqual(len(chain), 10)

        # Confirm expected names
        self.assertEqual([x.name() for x in chain],
                         ['temp_Jnt_%s' % (x+1) for x in range(10)])

        # Check positions match input curves'
        for jnt, pos in zip(chain, self.positions):
            self.assertTrue(transforms.assertLocationIs(jnt, pm.dt.Point(pos)))

        # Check aim axis is x
        for jnt in chain[:-1]:
            self.assertTrue(joints.assertAimAxis(jnt, 'x'))

        # Check for reg_node connection
        self.assertEqual(reg_node.temp_chain_root.listConnections()[0],
                         chain[0])

        # Check y axis pointing backwards (x, y, -1)
        for jnt in chain:
            loc = pm.spaceLocator()
            pm.delete(pm.parentConstraint(jnt, loc, mo=0))
            pm.move(loc, 0, 0, -1, r=1)
            pos = pm.xform(loc, q=1, ws=1, rp=1)
            self.assertAlmostEqual(pos[-1], -1)
            pm.delete(loc)
示例#2
0
    def test_assertAimAxis(self):
        pm.joint(self.joints[0], e=1, oj='yzx')
        self.assertFalse(joints.assertAimAxis(self.joints[0], 'x'))
        pm.joint(self.joints[0], e=1, oj='xyz')
        self.assertFalse(joints.assertAimAxis(self.joints[0], 'y'))
        pm.joint(self.joints[0], e=1, oj='xyz')
        self.assertFalse(joints.assertAimAxis(self.joints[0], 'z'))

        pm.joint(self.joints[0], e=1, oj='xyz')
        self.assertTrue(joints.assertAimAxis(self.joints[0], 'x'))
        pm.joint(self.joints[0], e=1, oj='yxz')
        self.assertTrue(joints.assertAimAxis(self.joints[0], 'y'))
        pm.joint(self.joints[0], e=1, oj='zyx')
        self.assertTrue(joints.assertAimAxis(self.joints[0], 'z'))
    def test_assertAimAxis(self):
        pm.joint(self.joints[0], e=1, oj="yzx")
        self.assertFalse(joints.assertAimAxis(self.joints[0], "x"))
        pm.joint(self.joints[0], e=1, oj="xyz")
        self.assertFalse(joints.assertAimAxis(self.joints[0], "y"))
        pm.joint(self.joints[0], e=1, oj="xyz")
        self.assertFalse(joints.assertAimAxis(self.joints[0], "z"))

        pm.joint(self.joints[0], e=1, oj="xyz")
        self.assertTrue(joints.assertAimAxis(self.joints[0], "x"))
        pm.joint(self.joints[0], e=1, oj="yxz")
        self.assertTrue(joints.assertAimAxis(self.joints[0], "y"))
        pm.joint(self.joints[0], e=1, oj="zyx")
        self.assertTrue(joints.assertAimAxis(self.joints[0], "z"))