def test_rebuildJoints(self): """ Test that a set of rebuilt joints have the same rotate, orient, and scale as they did when originally built """ info = {} preJointAttrs = [] postJointAttrs = [] for j in self.jnts: control.setStorableXformAttrs(j, worldSpace=True) info[j] = control.getStorableXformInfo(j) attrs = {} attrs['r'] = MC.getAttr('%s.r' % j)[0] attrs['t'] = MC.getAttr('%s.t' % j)[0] attrs['s'] = MC.getAttr('%s.s' % j)[0] attrs['o'] = MC.getAttr('%s.jointOrient' % j)[0] preJointAttrs.append(attrs) MC.delete(self.jnts) #first build nodes for jnt in self.jnts: control.makeStorableXform(jnt, createNodeOnly=True, **info[jnt]) #now parent and apply attrs for j in self.jnts: control.makeStorableXform(j, **info[j]) attrs = {} attrs['r'] = MC.getAttr('%s.r' % j)[0] attrs['t'] = MC.getAttr('%s.t' % j)[0] attrs['s'] = MC.getAttr('%s.s' % j)[0] attrs['o'] = MC.getAttr('%s.jointOrient' % j)[0] postJointAttrs.append(attrs) for i, jnt in enumerate(self.jnts): preAttrs = preJointAttrs[i] postAttrs = postJointAttrs[i] for attr in ['r', 't', 's', 'o']: for j in range(3): self.assertAlmostEqual(preAttrs[attr][j], postAttrs[attr][j]) m = MC.xform(jnt, q=1, ws=1, m=1) for j in range(len(m)): self.assertAlmostEqual(m[j], info[jnt]['matrix'][j])