Esempio n. 1
0
def test4():
    print ''
    print 'TEST 4 ' + ('=' * 80)

    # New Scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create shaders
    mayaUtils.createShaderAsset('redPaint',
                                nodeType='blinn',
                                color=(0.7, 0.2, 0.2))
    mayaUtils.createShaderAsset('bluePaint',
                                nodeType='blinn',
                                color=(0.2, 0.2, 0.7))
    mayaUtils.createShaderAsset('grey',
                                nodeType='lambert',
                                color=(0.5, 0.5, 0.5))
    mayaUtils.createShaderAsset('glass',
                                nodeType='phong',
                                color=(1.0, 1.0, 1.0))
    mayaUtils.saveTestFile('test4_before')

    # do checks
    lib.run()

    # save the scene
    mayaUtils.saveTestFile('test4_after')
    return
Esempio n. 2
0
def test1():
    print ''
    print 'TEST 1 ' + ('=' * 80)

    # time
    start = 1001
    end = 1010
    middle = start + ((end - start) * 0.5)

    # New scene
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create camera
    tfm, shp = mayaUtils.createCameraAsset('renderCamera')
    maya.cmds.setAttr(shp + '.renderable', 1)
    maya.cmds.setKeyframe(tfm, at='translateX', t=start, v=0.0)
    maya.cmds.setKeyframe(tfm, at='translateY', t=end, v=5.0)
    maya.cmds.setKeyframe(tfm, at='translateZ', t=middle, v=-10.0)
    mayaUtils.saveTestFile('test1_before')

    # do checks
    ctx = context.Context()
    lib.run(ctx=ctx)

    # save the scene
    mayaUtils.saveTestFile('test1_after')
    return
Esempio n. 3
0
 def test_run(self):
     print 'Test Name:', self.id()
     root = self.rootPath()
     data = {'someData': 42}
     stdUtils.createGenericAsset(name='myAsset', root=root, data=data)
     ctx = context.Context(root=root)
     lib.run(ctx=ctx)
     return
Esempio n. 4
0
def test8():
    print ''
    print 'TEST 8 ' + ('=' * 80)
    testBaseDir = config.getTestBaseDir()

    # New Scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create camera
    for i in xrange(100):
        tfm, shp = mayaUtils.createCameraAsset('renderCamera1')
        maya.cmds.setAttr(shp + '.renderable', 1)
        maya.cmds.setKeyframe(tfm, at='translateZ', t=start, v=4.0)
        maya.cmds.setKeyframe(tfm, at='translateZ', t=end, v=6.0)
        maya.cmds.setKeyframe(tfm, at='rotateX', t=start, v=0.0)
        maya.cmds.setKeyframe(tfm, at='rotateX', t=end, v=-5.0)

        # create geometry
        sphere = maya.cmds.polySphere()[0]
        geomSet = mayaUtils.createGeometryAsset(name='sphereGeom1',
                                                geomList=[sphere])

        # create cube rig
        cube = maya.cmds.polyCube()[0]
        ctrl = maya.cmds.circle(nr=(0, 1, 0), radius=2)[0]
        mayaUtils.createRigAsset(name='characterCubeName',
                                 geomList=[cube],
                                 ctrlList=[ctrl])
        maya.cmds.setKeyframe(ctrl, at='translateX', t=start, v=-1.0)
        maya.cmds.setKeyframe(ctrl, at='translateX', t=end, v=1.0)
        maya.cmds.setKeyframe(ctrl, at='rotateY', t=start, v=-45.0)
        maya.cmds.setKeyframe(ctrl, at='rotateY', t=end, v=45.0)

        # create shaders
        uvShd, uvShdGrp = mayaUtils.createShaderAsset('uvTest',
                                                      nodeType='lambert',
                                                      color=(0.5, 0.5, 0.5))
        # mayaUtils.assignShaderAsset([cube], uvShdGrp)
        mayaUtils.assignObjectListToShader(objList=[cube], shader=uvShd)
        mayaUtils.assignObjectListToShader(objList=[sphere], shader=uvShd)

        # create uv shader textures
        testUvs = os.path.join(testBaseDir, 'uvTestTexture.jpg')
        uvTx = mayaUtils.createTextureAsset('uvTestTexture1', path=testUvs)
        mayaUtils.connectTextureToShader(uvTx, uvShd, 'color')

    # save scene before test
    mayaUtils.saveTestFile('test8_before')

    # do checks
    lib.run()

    # save the scene
    mayaUtils.saveTestFile('test8_after')
    return
Esempio n. 5
0
    def test_geometryValidator(self):
        print 'Test Name:', self.id()
        root = self.rootPath()

        name = 'geom'
        data = {'shapes': [], 'faceNum': -1, 'vertNum': -1}
        cam = stdUtils.createGeometryAsset(root=root, name=name, data=data)

        ctx = context.Context(root=root)
        lib.run(ctx=ctx)
        return
Esempio n. 6
0
    def test_runSimpleAssets(self):
        print 'Test Name:', self.id()
        root = self.rootPath()

        renderCam = stdUtils.createRenderCameraAsset(root=root)
        plateA = stdUtils.createPlateAsset(name='A', root=root)
        trackCamA = stdUtils.createTrackCameraAsset(subName='A', root=root)
        geom = stdUtils.createSphereGeomAsset(root=root)

        ctx = context.Context(root=root)
        lib.run(ctx=ctx)
        return
Esempio n. 7
0
def test5():
    print ''
    print 'TEST 5 ' + ('=' * 80)
    testBaseDir = config.getTestBaseDir()

    # New Scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create shaders
    uvShd, uvShdGrp = mayaUtils.createShaderAsset('uvTest',
                                                  nodeType='lambert',
                                                  color=(0.5, 0.5, 0.5))
    woodShd, woodShdGrp = mayaUtils.createShaderAsset('wood',
                                                      nodeType='blinn',
                                                      color=(0.5, 0.5, 0.5))

    # create uv shader textures
    testUvs = os.path.join(testBaseDir, 'uvTestTexture.jpg')
    uvTx = mayaUtils.createTextureAsset('uvTestTexture',
                                        nodeType='file',
                                        path=testUvs)
    mayaUtils.connectTextureToShader(uvTx, uvShd, 'color')

    # create wood shader textures
    woodColorPath = os.path.join(testBaseDir, 'WD025/WD025_Square.jpg')
    woodSpecPath = os.path.join(testBaseDir, 'WD025/WD025_Square_Spec.jpg')
    woodNormPath = os.path.join(testBaseDir, 'WD025/WD025_Square_NORM.jpg')
    woodBumpPath = os.path.join(testBaseDir, 'WD025/WD025_Square_Bump.jpg')
    woodColorTx = mayaUtils.createTextureAsset('woodColor',
                                               nodeType='file',
                                               path=woodColorPath)
    woodSpecTx = mayaUtils.createTextureAsset('woodSpec',
                                              nodeType='file',
                                              path=woodSpecPath)
    woodNormTx = mayaUtils.createTextureAsset('woodNorm',
                                              nodeType='file',
                                              path=woodNormPath)
    woodBumpTx = mayaUtils.createTextureAsset('woodBump',
                                              nodeType='file',
                                              path=woodBumpPath)
    mayaUtils.connectTextureToShader(woodColorTx, woodShd, 'color')
    mayaUtils.connectTextureToShader(woodSpecTx, woodShd, 'specularColor')
    mayaUtils.saveTestFile('test5_before')

    # do checks
    lib.run()

    # save the scene
    mayaUtils.saveTestFile('test5_after')
    return
Esempio n. 8
0
    def test_cameraValidator(self):
        print 'Test Name:', self.id()
        root = self.rootPath()

        name = 'camera'
        data = {
            'focalLength': 50.0,
            'filmBackWidth': 42.0,
            'filmBackHeight': 42.0
        }
        cam = stdUtils.createCameraAsset(root=root, name=name, data=data)

        ctx = context.Context(root=root)
        lib.run(ctx=ctx)
        return
Esempio n. 9
0
    def test_three(self):
        print 'Test Name:', self.id()
        root = self.rootPath()

        renderCam = stdUtils.createRenderCameraAsset(root=root)

        plateA = stdUtils.createPlateAsset(name='A', root=root)
        plateB = stdUtils.createPlateAsset(name='B', root=root)

        trackCamA = stdUtils.createTrackCameraAsset(subName='A', root=root)
        trackCamB = stdUtils.createTrackCameraAsset(subName='B', root=root)

        geom = stdUtils.createSphereGeomAsset(root=root)

        metalShd = stdUtils.createMetalShaderAsset(root=root)
        woodShd = stdUtils.createWoodShaderAsset(root=root)

        # do checks
        ctx = context.Context(root=root)
        lib.run(ctx=ctx)
        return
Esempio n. 10
0
    def run(self):
        self.resetLogText()

        self.updateFindMode()
        self.__context = context.Context(find=self.__find_mode)

        doValidators = self.getRunValidatorsValue()
        doFixers = self.getRunFixersValue()
        doReporters = self.getRunReportersValue()

        # Run...
        lib.run(ctx=self.__context,
                doCollectors=True,
                doValidators=doValidators,
                doFixers=doFixers,
                doReporters=doReporters,
                progressCb=self.progressCb)

        # Update UI
        self.updateInfoText()
        self.updateTree()
        return
Esempio n. 11
0
def test3():
    print ''
    print 'TEST 3 ' + ('=' * 80)

    # New Scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create camera
    tfm, shp = mayaUtils.createCameraAsset('renderCamera')
    maya.cmds.setAttr(shp + '.renderable', 1)
    maya.cmds.setKeyframe(tfm, at='rotateX', t=start, v=0.0)
    maya.cmds.setKeyframe(tfm, at='rotateY', t=start, v=-0.0)
    maya.cmds.setKeyframe(tfm, at='rotateZ', t=start, v=-0.0)

    # create cube rig
    cube = maya.cmds.polyCube()[0]
    ctrl = maya.cmds.circle(nr=(0, 1, 0), radius=2)[0]
    mayaUtils.createRigAsset(name='characterCubeName',
                             geomList=[cube],
                             ctrlList=[ctrl])
    maya.cmds.setKeyframe(ctrl, at='translateX', t=start, v=1.0)
    maya.cmds.setKeyframe(ctrl, at='translateY', t=start, v=-3.0)
    maya.cmds.setKeyframe(ctrl, at='translateZ', t=start, v=-4.0)
    maya.cmds.setKeyframe(ctrl, at='translateX', t=end, v=-1.0)
    maya.cmds.setKeyframe(ctrl, at='translateY', t=end, v=3.0)
    maya.cmds.setKeyframe(ctrl, at='translateZ', t=end, v=4.0)

    # save file
    mayaUtils.saveTestFile('test3_before')

    # do checks
    ctx = context.Context()
    lib.run(ctx=ctx)

    # save the scene
    mayaUtils.saveTestFile('test3_after')
    return
Esempio n. 12
0
def test7():
    print ''
    print 'TEST 7 ' + ('=' * 80)

    # new scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create geometry
    sphere = maya.cmds.polySphere()[0]
    geomList = [sphere]
    geomSet = mayaUtils.createGeometryAsset(name='sphereGeom',
                                            geomList=geomList)
    mayaUtils.saveTestFile('test7_before')

    # do checks
    ctx = context.Context()
    lib.run(ctx=ctx)

    # save the scene
    mayaUtils.saveTestFile('test7_after')
    return
Esempio n. 13
0
def test2():
    print ''
    print 'TEST 2 ' + ('=' * 80)

    # New Scene
    start = 1001
    end = 1010
    mayaUtils.reinitializeScene(frameRange=(start, end))

    # create cameras
    tfm1, shp1 = mayaUtils.createCameraAsset('camera1')
    tfm2, shp2 = mayaUtils.createCameraAsset('camera2')
    tfm3, shp3 = mayaUtils.createCameraAsset('camera3')
    tfm4, shp4 = mayaUtils.createCameraAsset('camera4')
    maya.cmds.setAttr(shp1 + '.renderable', 1)
    maya.cmds.setAttr(shp2 + '.renderable', 1)
    maya.cmds.setAttr(shp3 + '.renderable', 0)
    maya.cmds.setAttr(shp4 + '.renderable', 1)
    maya.cmds.setAttr(shp4 + '.horizontalFilmAperture', 1.0)
    maya.cmds.setAttr(shp4 + '.verticalFilmAperture', 1.0)
    maya.cmds.setAttr('persp.renderable', 0)
    maya.cmds.setKeyframe(tfm1, at='rotateX', t=start, v=0.0)
    maya.cmds.setKeyframe(tfm1, at='rotateY', t=start, v=-0.0)
    maya.cmds.setKeyframe(tfm1, at='rotateZ', t=start, v=-0.0)

    # create sphere rig
    sphere = maya.cmds.polySphere()[0]
    ctrl = maya.cmds.circle(nr=(0, 1, 0), radius=2)[0]
    mayaUtils.createRigAsset(name='characterSphereName',
                             geomList=[sphere],
                             ctrlList=[ctrl])

    # create cube rig
    cube = maya.cmds.polyCube()[0]
    ctrl = maya.cmds.circle(nr=(0, 1, 0), radius=2)[0]
    mayaUtils.createRigAsset(name='characterCubeName',
                             geomList=[cube],
                             ctrlList=[ctrl])

    # save scene before test
    mayaUtils.saveTestFile('test2_before')

    # Manually specify the plugins...
    mgr = register.PluginManager()

    # camera
    mgr.registerPlugin(cameraCollector.CameraCollector)
    mgr.registerPlugin(cameraRenderableValidator.CameraRenderableValidator)
    mgr.registerPlugin(
        cameraKeyframeCountValidator.CameraKeyframeCountValidator)
    mgr.registerPlugin(cameraFilmbackValidator.CameraFilmbackValidator)

    # rig
    mgr.registerPlugin(rigCollector.RigCollector)
    mgr.registerPlugin(rigValidator.RigValidator)

    # reporters
    mgr.registerPlugin(assignShadersReporter.AssignShadersReporter)
    mgr.registerPlugin(viewportRenderReporter.ViewportRenderReporter)

    # check context
    ctx = context.Context(pluginManager=mgr)

    # run check
    lib.run(ctx=ctx)

    # save the scene
    mayaUtils.saveTestFile('test2_after')
    return