• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.expandFileName函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.expandFileName函数的典型用法代码示例。如果您正苦于以下问题:Python expandFileName函数的具体用法?Python expandFileName怎么用?Python expandFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了expandFileName函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testAnimIKRW

    def testAnimIKRW(self):

        name = createJoints()
        handleName = MayaCmds.ikHandle(sj=name, ee='joint4')[0]
        MayaCmds.currentTime(1, update=True)
        MayaCmds.setKeyframe(handleName, breakdown=0, hierarchy='none', controlPoints=False, shape=False)
        MayaCmds.currentTime(16, update=True)
        MayaCmds.move(-1.040057, -7.278225, 6.498725, r=True)
        MayaCmds.setKeyframe(handleName, breakdown=0, hierarchy='none', controlPoints=False, shape=False)

        self.__files.append(util.expandFileName('testAnimIKRW.abc'))
        self.__files.append(util.expandFileName('testAnimIKRW01_08.abc'))
        self.__files.append(util.expandFileName('testAnimIKRW09-16.abc'))

        # write to files
        MayaCmds.AbcExport(j='-fr 1 8 -root %s -f %s' % (name, self.__files[-2]))
        MayaCmds.AbcExport(j='-fr 9 16 -root %s -f %s' % (name, self.__files[-1]))
        MayaCmds.select(name)
        MayaCmds.group(name='original')

        subprocess.call(self.__abcStitcher + self.__files[-3:])

        # read from file
        MayaCmds.AbcImport(self.__files[-3], mode='import')

        # make sure the translate and rotation are the same
        nodes1 = ["|original|joint1", "|original|joint1|joint2", "|original|joint1|joint2|joint3", "|original|joint1|joint2|joint3|joint4"]
        nodes2 = ["|joint1", "|joint1|joint2", "|joint1|joint2|joint3", "|joint1|joint2|joint3|joint4"]

        for t in range(1, 25):
            MayaCmds.currentTime(t, update=True)
            for i in range(0, 4):
                self.failUnlessAlmostEqual(MayaCmds.getAttr(nodes1[i]+'.tx'), MayaCmds.getAttr(nodes2[i]+'.tx'), 4)
                self.failUnlessAlmostEqual(MayaCmds.getAttr(nodes1[i]+'.ty'), MayaCmds.getAttr(nodes2[i]+'.ty'), 4)
                self.failUnlessAlmostEqual(MayaCmds.getAttr(nodes1[i]+'.tz'), MayaCmds.getAttr(nodes2[i]+'.tz'), 4)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:35,代码来源:joint_test.py


示例2: testSelectionFlag

    def testSelectionFlag(self):
        makeRobot()
        MayaCmds.select('bottom', 'leftArm', 'head')
        self.__files.append(util.expandFileName('selectionTest_partial.abc'))
        MayaCmds.AbcExport(j='-sl -root head -root body -root lower -file ' + 
            self.__files[-1])

        self.__files.append(util.expandFileName('selectionTest.abc'))
        MayaCmds.AbcExport(j='-sl -file ' + self.__files[-1])

        MayaCmds.AbcImport(self.__files[-1], m='open')
        self.failUnless(MayaCmds.objExists("robot|head"))
        self.failUnless(MayaCmds.objExists("robot|body|leftArm"))
        self.failUnless(MayaCmds.objExists("robot|lower|bottom"))

        self.failIf(MayaCmds.objExists("robot|body|rightArm"))
        self.failIf(MayaCmds.objExists("robot|body|chest"))
        self.failIf(MayaCmds.objExists("robot|lower|rightLeg"))
        self.failIf(MayaCmds.objExists("robot|lower|leftLeg"))

        MayaCmds.AbcImport(self.__files[-2], m='open')
        self.failUnless(MayaCmds.objExists("head"))
        self.failUnless(MayaCmds.objExists("body|leftArm"))
        self.failUnless(MayaCmds.objExists("lower|bottom"))

        # we didnt actually select any meshes so there shouldnt
        # be any in the scene
        self.failIf(MayaCmds.ls(type='mesh'))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:28,代码来源:AbcExport_selection_test.py


示例3: setUp

    def setUp(self):
        MayaCmds.file(new=True, force=True)
        self.__files = []

        # write out an animated Alembic file
        createAnimatedSolarSystem()
        self.__files.append(util.expandFileName("testAnimatedSolarSystem.abc"))
        MayaCmds.AbcExport(j="-fr 1 24 -root group1 -root group2 -file " + self.__files[-1])

        # write out a static Alembic file that's different than the static scene
        # created by createStaticSolarSystem()
        MayaCmds.currentTime(12, update=True)
        self.__files.append(util.expandFileName("testStaticSolarSystem.abc"))
        MayaCmds.AbcExport(j="-fr 12 12 -root group1 -root group2 -file " + self.__files[-1])

        # write out an animated mesh with animated parent transform node
        MayaCmds.polyPlane(sx=2, sy=2, w=1, h=1, ch=0, n="polyMesh")
        MayaCmds.createNode("transform", n="group")
        MayaCmds.parent("polyMesh", "group")

        # key the transform node
        MayaCmds.setKeyframe("group", attribute="translate", t=[1, 4])
        MayaCmds.move(0.36, 0.72, 0.36)
        MayaCmds.setKeyframe("group", attribute="translate", t=2)

        # key the mesh node
        MayaCmds.select("polyMesh.vtx[0:8]")
        MayaCmds.setKeyframe(t=[1, 4])
        MayaCmds.scale(0.1, 0.1, 0.1, r=True)
        MayaCmds.setKeyframe(t=2)
        self.__files.append(util.expandFileName("testAnimatedMesh.abc"))
        MayaCmds.AbcExport(j="-fr 1 4 -root group -file " + self.__files[-1])

        MayaCmds.file(new=True, force=True)
开发者ID:keithbcg,项目名称:alembic,代码行数:34,代码来源:AbcImport_connect_test.py


示例4: testNamespaceChild

    def testNamespaceChild(self):
        self.buildScene()
        self.__files.append(util.expandFileName('testNamespace_foo_b.abc'))
        self.__files.append(util.expandFileName('testNamespace_bar_b.abc'))
        self.__files.append(util.expandFileName('testNamespace_b.abc'))

        MayaCmds.AbcExport(j='-root foo:b -fr 1 4 -file ' + self.__files[-3])
        MayaCmds.AbcExport(j='-root bar:b -fr 1 4 -file ' + self.__files[-2])
        MayaCmds.AbcExport(j='-root b -fr 1 4 -file ' + self.__files[-1])

        self.buildStatic()
        MayaCmds.AbcImport(self.__files[-3], connect='foo:a')
        self.failUnless('testNamespace_foo_b_AlembicNode.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|foo:a|foo:b|foo:bShape.inMesh", sfd=True))

        MayaCmds.AbcImport(self.__files[-3], connect='bar:a')
        self.failUnless('testNamespace_foo_b_AlembicNode1.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|bar:a|bar:b|bar:bShape.inMesh", sfd=True))

        MayaCmds.AbcImport(self.__files[-3], connect='a')
        self.failUnless('testNamespace_foo_b_AlembicNode2.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|a|b|bShape.inMesh", sfd=True))

        self.buildStatic()
        MayaCmds.AbcImport(self.__files[-2], connect='foo:a')
        self.failUnless('testNamespace_bar_b_AlembicNode.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|foo:a|foo:b|foo:bShape.inMesh", sfd=True))

        MayaCmds.AbcImport(self.__files[-2], connect='bar:a')
        self.failUnless('testNamespace_bar_b_AlembicNode1.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|bar:a|bar:b|bar:bShape.inMesh", sfd=True))

        MayaCmds.AbcImport(self.__files[-2], connect='a')
        self.failUnless('testNamespace_bar_b_AlembicNode2.outPolyMesh[0]' ==
            MayaCmds.connectionInfo("|a|b|bShape.inMesh", sfd=True))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:35,代码来源:connectNamespace_test.py


示例5: testAnimMeshReload

    def testAnimMeshReload(self):

        MayaCmds.polyCube( name = 'mesh')
        MayaCmds.setKeyframe('meshShape.vtx[0:7]', time=[1, 24])
        MayaCmds.setKeyframe('meshShape.vtx[0:7]')
        MayaCmds.currentTime(12, update=True)
        MayaCmds.select('meshShape.vtx[0:7]')
        MayaCmds.scale(5, 5, 5, r=True)
        MayaCmds.setKeyframe('meshShape.vtx[0:7]', time=[12])
        self.__files.append(util.expandFileName('testAnimMeshReadWrite.abc'))
        MayaCmds.AbcExport(j='-fr 1 24 -root mesh -f ' + self.__files[-1])

        # reading test
        MayaCmds.AbcImport(self.__files[-1], mode='open')

        # save as a maya file
        self.__files.append(util.expandFileName('test.mb'))
        MayaCmds.file(rename=self.__files[-1])
        MayaCmds.file(save=True)

        # reload as a maya file
        MayaCmds.file(self.__files[-1], open=True)
        MayaCmds.AbcImport(self.__files[-2], mode='import')

        retVal = True
        mesh1 = '|mesh|meshShape'
        mesh2 = '|mesh1|meshShape'
        for t in range(1, 25):
            MayaCmds.currentTime(t, update=True)
            if not util.compareMesh( mesh1, mesh2 ):
                self.fail('%s and %s were not equal at frame %d' % (mesh1,
                    mesh2, t))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:mayaReload_test.py


示例6: testAnimCameraReadWrite

    def testAnimCameraReadWrite(self):

        name = createCamera()
        MayaCmds.currentTime(1, update=True)
        MayaCmds.setKeyframe(name[1], attribute='horizontalFilmAperture')
        MayaCmds.setKeyframe(name[1], attribute='focalLength')
        MayaCmds.setKeyframe(name[1], attribute='focusDistance')
        MayaCmds.setKeyframe(name[1], attribute='shutterAngle')
        MayaCmds.currentTime(24, update=True)
        MayaCmds.setKeyframe(name[1], attribute='horizontalFilmAperture',
            value=0.95)
        MayaCmds.setKeyframe(name[1], attribute='focalLength', value=40)
        MayaCmds.setKeyframe(name[1], attribute='focusDistance', value=5.4)
        MayaCmds.setKeyframe(name[1], attribute='shutterAngle', value=174.94)

        self.__files.append(util.expandFileName('testAnimCameraReadWrite.abc'))
        self.__files.append(util.expandFileName('testAnimCameraReadWrite01_14.abc'))
        self.__files.append(util.expandFileName('testAnimCameraReadWrite15-24.abc'))

        # write to files
        MayaCmds.AbcExport(j='-fr 1 14 -root %s -file %s' % (name[0], self.__files[-2]))
        MayaCmds.AbcExport(j='-fr 15 24 -root %s -file %s' % (name[0], self.__files[-1]))

        subprocess.call(self.__abcStitcher + self.__files[-3:])

        # read from file
        MayaCmds.AbcImport(self.__files[-3], mode='import')
        camList = MayaCmds.ls(type='camera')

        for t in range(1, 25):
            MayaCmds.currentTime(t, update=True)
            if not util.compareCamera(camList[0], camList[1]):
                self.fail('%s and %s are not the same at frame %d' %
                    (camList[0], camList[1], t))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:34,代码来源:camera_test.py


示例7: test_agst

    def test_agst(self):

        # animated geometry, static transform node
        nodename = 'agst_node'
        MayaCmds.polyCube(name=nodename)
        MayaCmds.select(nodename+'.vtx[0:8]')
        MayaCmds.setKeyframe(time=1.0)
        MayaCmds.scale(1.5, 1.5, 1.8)
        MayaCmds.setKeyframe(time=5.0)

        self.__files.append(util.expandFileName('agst_motionblur_noSampleGeo_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -step 0.5 -wfg -root %s -file %s' % (
            nodename, self.__files[-1]))

        # frameRange: 1, 2, 3, 4, 5, 6
        self.isFrameRangeTransAndFrameRangeShapeExists(self.__files[-1])

        self.__files.append(util.expandFileName('agst_motionblur_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -step 0.5 -root %s -f %s' % (
            nodename, self.__files[-1]))

        # frameRange: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6
        self.isFrameRangeExists(self.__files[-1])

        self.__files.append(util.expandFileName('agst_noSampleGeo_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -wfg -root %s -f %s' % (nodename,
            self.__files[-1]))

        # frameRange: 1, 2, 3, 4, 5
        self.isFrameRangeExists(self.__files[-1])
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:30,代码来源:AbcExport_subframes_test.py


示例8: testAnimNurbsCurveGrpRW

    def testAnimNurbsCurveGrpRW(self):

        # create Nurbs Curve group
        knotVec = [0,0,0,1,2,2,2]
        curve1CV = [(0, 0, 0), (3, 5, 0), (5, 6, 0), (9, 9, 0), (12, 10, 0)]
        curve2CV = [(0, 0, 3), (3, 5, 3), (5, 6, 3), (9, 9, 3), (12, 10, 3)]
        curve3CV = [(0, 0, 6), (3, 5, 6), (5, 6, 6), (9, 9, 6), (12, 10, 6)]

        MayaCmds.curve(d=3, p=curve1CV, k=knotVec, name='curve1')
        MayaCmds.curve(d=3, p=curve2CV, k=knotVec, name='curve2')
        MayaCmds.curve(d=3, p=curve3CV, k=knotVec, name='curve3')

        MayaCmds.group('curve1', 'curve2', 'curve3', name='group')
        MayaCmds.addAttr('group', longName='riCurves', at='bool', dv=True)

        # frame 1
        MayaCmds.currentTime(1, update=True)
        MayaCmds.select('curve1.cv[0:4]', 'curve2.cv[0:4]', 'curve3.cv[0:4]', replace=True)
        MayaCmds.setKeyframe()
        # frame 24
        MayaCmds.currentTime(24, update=True)
        MayaCmds.select('curve1.cv[0:4]')
        MayaCmds.rotate(0.0, '90deg', 0.0, relative=True )
        MayaCmds.select('curve2.cv[0:4]')
        MayaCmds.move(0.0, 0.5, 0.0, relative=True )
        MayaCmds.select('curve3.cv[0:4]')
        MayaCmds.scale(1.0, 0.5, 1.0, relative=True )
        MayaCmds.select('curve1.cv[0:4]', 'curve2.cv[0:4]', 'curve3.cv[0:4]', replace=True)
        MayaCmds.setKeyframe()

        self.__files.append(util.expandFileName('testAnimNCGrp.abc'))
        self.__files.append(util.expandFileName('testAnimNCGrp01_14.abc'))
        self.__files.append(util.expandFileName('testAnimNCGrp15_24.abc'))

        MayaCmds.AbcExport(j='-fr 1 14 -root %s -file %s' % ('group', self.__files[-2]))
        MayaCmds.AbcExport(j='-fr 15 24 -root %s -file %s' % ('group', self.__files[-1]))

        # use AbcStitcher to combine two files into one
        subprocess.call(self.__abcStitcher + self.__files[-3:])

        # reading test
        MayaCmds.AbcImport(self.__files[-3], mode='import')
        shapeNames = MayaCmds.ls(exactType='nurbsCurve')

        MayaCmds.currentTime(1, update=True)
        for i in range(0, 3):
            self.failUnless(
                util.compareNurbsCurve(shapeNames[i], shapeNames[i+3]))
        MayaCmds.currentTime(12, update=True)
        for i in range(0, 3):
            self.failUnless(
                util.compareNurbsCurve(shapeNames[i], shapeNames[i+3]))
        MayaCmds.currentTime(24, update=True)
        for i in range(0, 3):
            self.failUnless(
                util.compareNurbsCurve(shapeNames[i], shapeNames[i+3]))
开发者ID:ElaraFX,项目名称:alembic,代码行数:56,代码来源:animNurbsCurve_test.py


示例9: testAnimNSurfaceAndPolyDeleteReload

    def testAnimNSurfaceAndPolyDeleteReload(self):

        # create a poly cube and animate
        shapeName = 'pCube'
        MayaCmds.polyCube(name=shapeName)
        MayaCmds.move(5, 0, 0, r=True)
        MayaCmds.setKeyframe(shapeName+'.vtx[2:5]', time=[1, 24])
        MayaCmds.currentTime(12)
        MayaCmds.select(shapeName+'.vtx[2:5]',replace=True)
        MayaCmds.move(0, 4, 0, r=True)
        MayaCmds.setKeyframe(shapeName+'.vtx[2:5]', time=[12])

        # create an animated Nurbs plane
        MayaCmds.nurbsPlane(ch=False, name='nPlane')
        MayaCmds.move(-5, 5, 0, relative=True)
        MayaCmds.select('nPlane.cv[0:3][0:3]', replace=True)
        MayaCmds.setKeyframe(time=1)
        MayaCmds.currentTime(12, update=True)
        MayaCmds.rotate(0, 0, 90, relative=True)
        MayaCmds.setKeyframe(time=12)
        MayaCmds.currentTime(24, update=True)
        MayaCmds.rotate(0, 0, 90, relative=True)
        MayaCmds.setKeyframe(time=24)

        # write it out to Abc file and load back in
        self.__files.append(util.expandFileName('testNSurfaceAndPolyReload.abc'))
        MayaCmds.AbcExport(j='-fr 1 24 -root pCube -root nPlane -file ' + self.__files[-1])
        # load back the Abc file, delete the cube and save to a maya file
        MayaCmds.AbcImport(self.__files[-1], mode='open')
        MayaCmds.delete('pCube')
        self.__files.append(util.expandFileName('test.mb'))
        MayaCmds.file(rename=self.__files[-1])
        MayaCmds.file(save=True)

        # import the saved maya file to compare with the original scene
        MayaCmds.file(self.__files[-1], open=True)
        MayaCmds.select('nPlane', replace=True)
        MayaCmds.group(name='ReloadGrp')
        MayaCmds.AbcImport(self.__files[-2], mode='import')

        shapeList = MayaCmds.ls(type='mesh')
        self.failUnlessEqual(len(shapeList), 1)
        surfaceList = MayaCmds.ls(type='nurbsSurface')
        self.failUnlessEqual(len(surfaceList), 2)

        # test the equality of plane
        surface1 = '|nPlane|nPlaneShape'
        surface2 = '|ReloadGrp|nPlane|nPlaneShape'
        for t in range(1, 25):
            MayaCmds.currentTime(t, update=True)
            if not util.compareNurbsSurface( surface1, surface2 ):
                self.fail('%s and %s are not the same at frame %d' %
                    (surface1, surface2, t))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:53,代码来源:mayaReload_test.py


示例10: testAnimNurbsCurveGrpRW

    def testAnimNurbsCurveGrpRW(self):

        # create Nurbs Curve group
        knotVec = [0, 0, 0, 1, 2, 2, 2]
        curve1CV = [(0, 0, 0), (3, 5, 0), (5, 6, 0), (9, 9, 0), (12, 10, 0)]
        curve2CV = [(0, 0, 3), (3, 5, 3), (5, 6, 3), (9, 9, 3), (12, 10, 3)]
        curve3CV = [(0, 0, 6), (3, 5, 6), (5, 6, 6), (9, 9, 6), (12, 10, 6)]

        MayaCmds.curve(d=3, p=curve1CV, k=knotVec, name="curve1")
        MayaCmds.curve(d=3, p=curve2CV, k=knotVec, name="curve2")
        MayaCmds.curve(d=3, p=curve3CV, k=knotVec, name="curve3")

        MayaCmds.group("curve1", "curve2", "curve3", name="group")
        MayaCmds.addAttr("group", longName="riCurves", at="bool", dv=True)

        # frame 1
        MayaCmds.currentTime(1, update=True)
        MayaCmds.select("curve1.cv[0:4]", "curve2.cv[0:4]", "curve3.cv[0:4]", replace=True)
        MayaCmds.setKeyframe()
        # frame 24
        MayaCmds.currentTime(24, update=True)
        MayaCmds.select("curve1.cv[0:4]")
        MayaCmds.rotate(0.0, "90deg", 0.0, relative=True)
        MayaCmds.select("curve2.cv[0:4]")
        MayaCmds.move(0.0, 0.5, 0.0, relative=True)
        MayaCmds.select("curve3.cv[0:4]")
        MayaCmds.scale(1.0, 0.5, 1.0, relative=True)
        MayaCmds.select("curve1.cv[0:4]", "curve2.cv[0:4]", "curve3.cv[0:4]", replace=True)
        MayaCmds.setKeyframe()

        self.__files.append(util.expandFileName("testAnimNCGrp.abc"))
        self.__files.append(util.expandFileName("testAnimNCGrp01_14.abc"))
        self.__files.append(util.expandFileName("testAnimNCGrp15_24.abc"))

        MayaCmds.AbcExport(j="-fr 1 14 -root %s -file %s" % ("group", self.__files[-2]))
        MayaCmds.AbcExport(j="-fr 15 24 -root %s -file %s" % ("group", self.__files[-1]))

        # use AbcStitcher to combine two files into one
        subprocess.call(self.__abcStitcher + self.__files[-3:])

        # reading test
        MayaCmds.AbcImport(self.__files[-3], mode="import")
        shapeNames = MayaCmds.ls(exactType="nurbsCurve")

        MayaCmds.currentTime(1, update=True)
        for i in range(0, 3):
            self.failUnless(util.compareNurbsCurve(shapeNames[i], shapeNames[i + 3]))
        MayaCmds.currentTime(12, update=True)
        for i in range(0, 3):
            self.failUnless(util.compareNurbsCurve(shapeNames[i], shapeNames[i + 3]))
        MayaCmds.currentTime(24, update=True)
        for i in range(0, 3):
            self.failUnless(util.compareNurbsCurve(shapeNames[i], shapeNames[i + 3]))
开发者ID:poparteu,项目名称:alembic,代码行数:53,代码来源:animNurbsCurve_test.py


示例11: testStaticNurbsSurfaceWithOneCloseCurveTrimOutsideReadWrite

    def testStaticNurbsSurfaceWithOneCloseCurveTrimOutsideReadWrite(self):

        # open - open surface
        self.__files.append(util.expandFileName('testStaticNurbsPlaneWithOneCloseCurveTrimOutside.abc'))
        testStaticNurbsWithOneCloseCurveTrim(self, 0, self.__files[-1], 1)


        # open - periodic surface
        self.__files.append(util.expandFileName('testStaticNurbsSphereWithOneCloseCurveTrimOutside.abc'))
        testStaticNurbsWithOneCloseCurveTrim(self, 1, self.__files[-1], 1)


        # periodic - periodic surface
        self.__files.append(util.expandFileName('testStaticNurbsTorusWithOneCloseCurveTrimOutside.abc'))
        testStaticNurbsWithOneCloseCurveTrim(self, 2, self.__files[-1], 1)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:15,代码来源:staticNurbsSurface_test.py


示例12: testStaticNurbsSurfaceWithoutTrimReadWrite

    def testStaticNurbsSurfaceWithoutTrimReadWrite(self):

        # open - open surface
        self.__files.append(util.expandFileName('testStaticNurbsPlaneWithoutTrim.abc'))
        testStaticNurbsWithoutTrim(self, 0, self.__files[-1])


        # open - periodic surface
        self.__files.append(util.expandFileName('testStaticNurbsSphereWithoutTrim.abc'))
        testStaticNurbsWithoutTrim(self, 1, self.__files[-1])


        # periodic - periodic surface
        self.__files.append(util.expandFileName('testStaticNurbsTorusWithoutTrim.abc'))
        testStaticNurbsWithoutTrim(self, 2 , self.__files[-1])
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:15,代码来源:staticNurbsSurface_test.py


示例13: testPreRollRanges

    def testPreRollRanges(self):
        self.createXformNode()

        # Export (1, 10), [11, 100], (101, 109), [110, 200]
        __builtins__['framesList'] = []
        self.__files.append(util.expandFileName('testPreRollRanges1.abc'))
        MayaCmds.AbcExport(j = '-fr 1 10 -pr -fr 11 100 -fr 101 109 -pr -fr 110 200 -root test -pfc framesList.append(#FRAME#) -file ' + self.__files[-1])

        referenceList = []
        for i in range(11, 101):
            referenceList.append(i)
        for i in range(110, 201):
            referenceList.append(i)
        self.failUnlessEqual(framesList, referenceList)

        # Import
        MayaCmds.AbcImport(self.__files[-1], mode = 'open')

        # Test sampling points
        self.failUnlessXformValuesEqual([(11, 10), (100, 20), (110, 20), (200, 10)])

        # Test not-sampled points
        self.failUnlessXformValuesEqual([(1, 10), (105, 20), (205, 10)])

        # Another pre roll test
        MayaCmds.file(new = True, force = True)
        self.createXformNode()

        # Export [1, 10], (11, 99), [100, 110], (111, 200)
        __builtins__['framesList'] = []
        self.__files.append(util.expandFileName('testPreRollRanges2.abc'))
        MayaCmds.AbcExport(j = '-fr 1 10 -fr 11 99 -pr -fr 100 110 -fr 111 200 -pr -root test -pfc framesList.append(#FRAME#) -file ' + self.__files[-1])

        referenceList = []
        for i in range(1, 11):
            referenceList.append(i)
        for i in range(100, 111):
            referenceList.append(i)
        self.failUnlessEqual(framesList, referenceList)

        # Import
        MayaCmds.AbcImport(self.__files[-1], mode = 'open')

        # Test sampling points
        self.failUnlessXformValuesEqual([(1, 10), (3, 20), (10, 20), (100, 20), (110, 20)])

        # Test not-sampled points
        self.failUnlessXformValuesEqual([(11, 20), (50, 20), (200, 20)])
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:48,代码来源:multipleFrameRange_test.py


示例14: testAnimWFGSimpleNurbsCurveRW

    def testAnimWFGSimpleNurbsCurveRW(self):

        # create the Nurbs Curve
        name = MayaCmds.curve(d=3, p=[(0, 0, 0), (3, 5, 6), (5, 6, 7), (9, 9, 9), (12, 10, 2)], k=[0, 0, 0, 1, 2, 2, 2])

        MayaCmds.select(name + ".cv[0:4]")
        # frame 1
        MayaCmds.currentTime(1, update=True)
        MayaCmds.setKeyframe()
        # frame 24
        MayaCmds.currentTime(24, update=True)
        MayaCmds.setKeyframe()
        # frame 12
        MayaCmds.currentTime(12, update=True)
        MayaCmds.move(3, 0, 0, r=True)
        MayaCmds.setKeyframe()

        self.__files.append(util.expandFileName("testAnimWFGNurbsSingleCurve.abc"))

        MayaCmds.AbcExport(j="-fr 1 24 -wfg -frs -0.25 -frs 0.0 -frs 0.25 -root %s -file %s" % (name, self.__files[-1]))

        MayaCmds.AbcImport(self.__files[-1], mode="import")
        shapeNames = MayaCmds.ls(exactType="nurbsCurve")

        MayaCmds.currentTime(1, update=True)
        self.failUnless(util.compareNurbsCurve(shapeNames[0], shapeNames[1]))
        MayaCmds.currentTime(12, update=True)
        self.failUnless(util.compareNurbsCurve(shapeNames[0], shapeNames[1]))
        MayaCmds.currentTime(24, update=True)
        self.failUnless(util.compareNurbsCurve(shapeNames[0], shapeNames[1]))
开发者ID:poparteu,项目名称:alembic,代码行数:30,代码来源:animNurbsCurve_test.py


示例15: testThreeFrameRanges

    def testThreeFrameRanges(self):
        self.createXformNode()

        # Export 3 frame ranges: [1,3], [10,11], [110, 200]
        __builtins__['framesList'] = []
        self.__files.append(util.expandFileName('testThreeFrameRanges.abc'))
        MayaCmds.AbcExport(j = '-fr 1 3 -fr 10 11 -fr 110 200 -root test -pfc framesList.append(#FRAME#) -file ' + self.__files[-1])

        referenceList = []
        for i in range(1, 4):
            referenceList.append(i)
        for i in range(10, 12):
            referenceList.append(i)
        for i in range(110, 201):
            referenceList.append(i)
        self.failUnlessEqual(framesList, referenceList)

        # Import
        MayaCmds.AbcImport(self.__files[-1], mode = 'open')

        # Test sampling points
        self.failUnlessXformValuesEqual([(1, 10), (3, 20), (10, 20), (11, 10), (110, 20), (200, 10)])

        # Test not-sampled points
        self.failUnlessXformValuesEqual([(7, 20), (60.5, 15)])  # lerp
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:25,代码来源:multipleFrameRange_test.py


示例16: testWholeFrameGeo

    def testWholeFrameGeo(self):
        self.createXformNode()
        self.createCubeNode()

        # Export [2, 4]{-0.2, 0, 0.2}:2 [10, 10]{-0.5, 0, 0.5} -wfg
        # i.e. xform: 1.8, 2, 2.2, 3.8, 4, 4.2, 9.5, 10, 10.5
        #   geometry: 2, 4, 10
        __builtins__['framesList'] = []
        self.__files.append(util.expandFileName('testWholeFrameGeos.abc'))
        MayaCmds.AbcExport(j = '-fr 2 4 -s 2 -frs -0.2 -frs 0 -frs 0.2 -fr 10 10 -frs -0.5 -frs 0 -frs 0.5 -wfg -root test -pfc framesList.append(#FRAME#) -file ' + self.__files[-1])

        self.failUnlessEqual(framesList, [1.8, 2, 2.2, 3.8, 4, 4.2, 9.5, 10, 10.5])

        # Import
        MayaCmds.AbcImport(self.__files[-1], mode = 'open')

        # Test sampling xform points
        self.failUnlessXformValuesEqual([(1.8, 14), (2, 15), (2.2, 16), (3.8, 20), (4, 20), (4.2, 20), (9.5, 20), (10, 20), (10.5, 15)])

        # Test not-sampled xform points
        self.failUnlessXformValuesEqual([(2.8, 17.5), (3, 18), (3.2, 18.5)]) # lerp

        # Test sampling mesh points
        self.failUnlessCubeWidthEqual([(2, 20), (4, 20), (10, 20)])

        # Test not-sampled cube points
        # No subsample for the cube
        self.failUnlessCubeWidthEqual([(2.2, 20), (3.8, 20), (4.2, 20)])
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:28,代码来源:multipleFrameRange_test.py


示例17: testPolyUVs

    def testPolyUVs(self):
        MayaCmds.polyCube(name = 'cube')
        cubeObj = getObjFromName('cubeShape')
        fnMesh = OpenMaya.MFnMesh(cubeObj)

        # get the name of the current UV set
        uvSetName = fnMesh.currentUVSetName()

        uArray = OpenMaya.MFloatArray()
        vArray = OpenMaya.MFloatArray()
        fnMesh.getUVs(uArray, vArray, uvSetName)

        newUArray = [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, -1, -1]
        newVArray = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 1 , 0,  1]
        for i in range(0, 14):
            uArray[i] = newUArray[i]
            vArray[i] = newVArray[i]
        fnMesh.setUVs(uArray, vArray, uvSetName)

        self.__files.append(util.expandFileName('polyUvsTest.abc'))
        MayaCmds.AbcExport(j='-uv -root cube -file ' + self.__files[-1])

        # reading test
        MayaCmds.AbcImport(self.__files[-1], mode='open')

        MayaCmds.select('cube.map[0:13]', replace=True)
        uvs = MayaCmds.polyEditUV(query=True)
        for i in range(0, 14):
            self.failUnlessAlmostEqual(newUArray[i], uvs[2*i], 4,
                'map[%d].u is not the same' % i)
            self.failUnlessAlmostEqual(newVArray[i], uvs[2*i+1], 4,
                'map[%d].v is not the same' % i)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:Alembic_uv_test.py


示例18: testSubD

    def testSubD(self):
        trans = MayaCmds.polyPlane(n='plane', sx=1, sy=1, ch=False)[0]
        shape = MayaCmds.pickWalk(d='down')[0]
        MayaCmds.addAttr(attributeType='bool', defaultValue=1, keyable=True,
            longName='SubDivisionMesh')
        MayaCmds.select(trans+'.vtx[0:3]', r=True)
        MayaCmds.move(0, 1, 0, r=True)
        MayaCmds.currentTime(1, update=True)
        MayaCmds.setKeyframe()
        MayaCmds.currentTime(2, update=True)
        MayaCmds.move(0, 5, 0, r=True)
        MayaCmds.setKeyframe()

        self.__files.append(util.expandFileName('testSubDInterpolation.abc'))
        MayaCmds.AbcExport(j='-fr 1 2 -root %s -file %s' % (trans, self.__files[-1]))
        MayaCmds.AbcImport(self.__files[-1], mode='open')

        MayaCmds.currentTime(1.004, update=True)
        ty = MayaCmds.getAttr(shape+'.vt[0]')[0][1]
        self.failUnlessAlmostEqual(1.02, ty)

        setTime = MayaCmds.currentTime(1.422, update=True)
        alpha = (setTime - 1) / (2 - 1)
        ty = MayaCmds.getAttr(shape+'.vt[0]')[0][1]
        self.failUnlessAlmostEqual(ty, (1-alpha)*1.0+alpha*6.0, 3)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:25,代码来源:interpolation_test.py


示例19: testStaticVisibility

    def testStaticVisibility(self):
        poly1  = MayaCmds.polyPlane(sx=2, sy=2, w=1, h=1, ch=0)[0]
        group1 = MayaCmds.group()
        group2 = MayaCmds.createNode("transform")
        MayaCmds.select(group1, group2)
        group3 = MayaCmds.group()

        group4 = (MayaCmds.duplicate(group1, rr=1))[0]
        group5 = MayaCmds.group()

        MayaCmds.select(group3, group5)
        root = MayaCmds.group(name='root')

        MayaCmds.setAttr(group1 + '.visibility', 0)
        MayaCmds.setAttr(group2 + '.visibility', 0)
        MayaCmds.setAttr(group5 + '.visibility', 0)

        self.__files.append(util.expandFileName('staticVisibilityTest.abc'))
        MayaCmds.AbcExport(j='-wv -root %s -file %s' % (root, self.__files[-1]))

        MayaCmds.AbcImport(self.__files[-1], m='open')
        self.failIf(MayaCmds.getAttr(group1+'.visibility'))
        self.failIf(MayaCmds.getAttr(group2+'.visibility'))
        self.failIf(MayaCmds.getAttr(group5+'.visibility'))

        self.failUnless(MayaCmds.getAttr(group1+'|'+poly1+'.visibility'))
        self.failUnless(MayaCmds.getAttr(group4+'|'+poly1+'.visibility'))
        self.failUnless(MayaCmds.getAttr(group3+'.visibility'))
        self.failUnless(MayaCmds.getAttr(group4+'.visibility'))
        self.failUnless(MayaCmds.getAttr(root+'.visibility'))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:30,代码来源:visibility_test.py


示例20: testCamera

    def testCamera(self):
        # create an animated camera and write out
        name = MayaCmds.camera()
        MayaCmds.setAttr(name[1]+'.horizontalFilmAperture', 0.962)
        MayaCmds.setAttr(name[1]+'.verticalFilmAperture', 0.731)
        MayaCmds.setAttr(name[1]+'.focalLength', 50)
        MayaCmds.setAttr(name[1]+'.focusDistance', 5)
        MayaCmds.setAttr(name[1]+'.shutterAngle', 144)

        # animate the camera
        MayaCmds.currentTime(1, update=True)
        MayaCmds.setKeyframe(name[1], attribute='horizontalFilmAperture')
        MayaCmds.setKeyframe(name[1], attribute='focalLength')
        MayaCmds.setKeyframe(name[1], attribute='focusDistance')
        MayaCmds.setKeyframe(name[1], attribute='shutterAngle')

        MayaCmds.currentTime(6, update=True)
        MayaCmds.setKeyframe(name[1], attribute='horizontalFilmAperture', value=0.95)
        MayaCmds.setKeyframe(name[1], attribute='focalLength', value=40)
        MayaCmds.setKeyframe(name[1], attribute='focusDistance', value=5.4)
        MayaCmds.setKeyframe(name[1], attribute='shutterAngle', value=174.94)

        self.__files.append(util.expandFileName('testCameraInterpolation.abc'))
        MayaCmds.AbcExport(j='-fr 1 6 -root %s -f %s' % (name[0], self.__files[-1]))
        MayaCmds.AbcImport(self.__files[-1], mode='import')
        camList = MayaCmds.ls(type='camera')

        t = 1.004
        MayaCmds.currentTime(t, update=True)
        self.failUnlessAlmostEqual(MayaCmds.getAttr(camList[0]+'.horizontalFilmAperture'), 0.962, 3)

        setTime = MayaCmds.currentTime(1.422, update=True)
        alpha = (setTime - 1) / (2 - 1)
        if not util.compareCamera(camList[0], camList[1]):
            self.fail('%s and %s are not the same at frame %d' % (camList[0], camList[1], t))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:35,代码来源:interpolation_test.py



注:本文中的util.expandFileName函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.expandpath函数代码示例发布时间:2022-05-27
下一篇:
Python util.exec_remote_command函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap