本文整理汇总了Python中util.expandFileName函数的典型用法代码示例。如果您正苦于以下问题:Python expandFileName函数的具体用法?Python expandFileName怎么用?Python expandFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expandFileName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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'))
示例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)
示例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))
示例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))
示例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))
示例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])
示例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]))
示例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))
示例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]))
示例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)
示例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])
示例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)])
示例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]))
示例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