Exemple #1
0
    def testNewLocator(self):

        m = IECore.M44f.createScaled(IECore.V3f(
            1, 2, 3)) * IECore.M44f.createTranslated(IECore.V3f(10, 20, 30))
        coordSys = IECore.CoordinateSystem("myNamedCoordSys",
                                           IECore.MatrixTransform(m))

        parent = maya.cmds.createNode("transform")
        self.failUnless(
            IECoreMaya.ToMayaLocatorConverter(coordSys).convert(parent))

        locators = maya.cmds.listRelatives(parent,
                                           children=True,
                                           fullPath=True,
                                           type="locator")
        self.assertEqual(len(locators), 1)
        self.assertEqual(locators[0].split("|")[-1], "myNamedCoordSys")
        self.assertEqual(
            maya.cmds.getAttr(locators[0] + ".localPosition")[0], (10, 20, 30))
        self.assertEqual(
            maya.cmds.getAttr(locators[0] + ".localScale")[0], (1, 2, 3))

        newCoordSys = IECoreMaya.FromMayaLocatorConverter(
            locators[0]).convert()
        self.assertEqual(coordSys.getName(), newCoordSys.getName())
        self.assertEqual(coordSys.getTransform(), newCoordSys.getTransform())
    def testConstructor(self):

        converter = IECoreMaya.FromMayaLocatorConverter("myLocator")
        camera = converter.convert()
        self.assert_(
            camera.isInstanceOf(IECore.CoordinateSystem.staticTypeId()))