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)
def test_assertLocationIs(self): self.assertFalse(transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 1, 0))) self.assertFalse(transforms.assertLocationIs(self.joints[1], pm.dt.Point(0, 3, 0))) self.assertFalse(transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 1, 0))) self.assertTrue(transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 0, 0))) self.assertTrue(transforms.assertLocationIs(self.joints[1], pm.dt.Point(0, 1.0001, 0))) self.assertTrue(transforms.assertLocationIs(self.joints[2], pm.dt.Point(0, 2, 0)))
def test_assertLocationIs(self): self.assertFalse( transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 1, 0))) self.assertFalse( transforms.assertLocationIs(self.joints[1], pm.dt.Point(0, 3, 0))) self.assertFalse( transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 1, 0))) self.assertTrue( transforms.assertLocationIs(self.joints[0], pm.dt.Point(0, 0, 0))) self.assertTrue( transforms.assertLocationIs(self.joints[1], pm.dt.Point(0, 1.0001, 0))) self.assertTrue( transforms.assertLocationIs(self.joints[2], pm.dt.Point(0, 2, 0)))