Beispiel #1
0
def do_render2(src, frame=None, vfb=True, wait=None, sequence=None, renderMode="production"):
    if sequence:
        start, end, _ = sequence

    cmd = "vray -sceneFile={0}".format(src)

    if sequence:
        sequence = " -frames={0}-{1}".format(start, end)
        cmd += sequence
    else:
        cmd += " -frames={0}".format(frame)

    cmd += " -display={0}".format(1 if vfb else 0)
    cmd += " -verboseLevel=3"
    cmd += " -showProgress=1"
    cmd += " -progressUpdateFreq=5000"

    rt = 0
    print "render mode {0}".format(renderMode)
    if renderMode == "rtCpu":
        rt = 1
    elif renderMode == "rtGpu":
        rt = 5

    cmd += " -rtEngine={0}".format(rt)

    cmd += " -distributed={0}".format(1 if sequence is None else 0)

    print cmd

    mode = EXEC_MODE.LOGGED if wait >= 0 else EXEC_MODE.BACKGROUND
    shell(cmd, mode=mode)
Beispiel #2
0
def main():
    os.environ[envvars.VRAY_VERSION] = "34003"

    cmd = "C:/work/T00N3Kit/test/misc/subp_child.sh"
    system.shell([cmd], mode=system.EXEC_MODE.BACKGROUND)

    print os.environ[envvars.VRAY_VERSION]
Beispiel #3
0
def main(img):
    base = 'C:\work\scenes\maya\image_plane_gen.ma'

    infos = get_infos(img)

    print infos

    source = open(base, 'r')
    dest = NamedTemporaryFile(delete=False, suffix='.py')

    for row in source:
        dest.write(patch(row, infos))

    source.close()
    dest.close()

    editSource(dest.name)

    cmd = 'Render -r sw {0}'.format(dest.name)
    shell(cmd, mode=EXEC_MODE.LOGGED)
Beispiel #4
0
def main_sh():
    cmd = 'sh.exe C:/work/T00N3Kit/test/misc/shell_script.sh plop 1'
    log.debug('call')
    print system.shell(cmd)
    log.debug('logged')
    print system.shell(cmd, mode=system.EXEC_MODE.LOGGED)
    log.debug('background')
    print system.shell(cmd, mode=system.EXEC_MODE.BACKGROUND)
    log.debug('DONE !')
Beispiel #5
0
    def render(self, live=True, wait=None, sequence=None):
        if sequence:
            start, end, step = sequence
        if live:
            output = getattr(self.renderer.plugins, "vraySettingsOutput")
            frame = output.frames if hasattr(output, 'frames') else None
            if frame:
                if isinstance(frame[0], float):
                    frame = frame[0]
                else:
                    frame = frame[0][0]
            else:
                frame = 1
            self.renderer.time = frame

            self.renderer.start()
            if wait:
                wait *= 1000
            if sequence:
                sequence = [{'start': start, 'end': end, 'step': step}]
                self.renderer.renderSequence(sequence)
                if wait:
                    self.renderer.waitForSequenceDone(wait)
                else:
                    self.renderer.waitForSequenceDone()
            else:
                if wait:
                    self.renderer.waitForImageReady(wait)
                else:
                    self.renderer.waitForImageReady()
        else:
            cmd = "vray -sceneFile={0}".format(self._path)
            if sequence:
                sequence = " -frames {0}-{1},{2}".format(start, end, step)
                cmd += sequence
            shell(cmd, mode=EXEC_MODE.BACKGROUND)
Beispiel #6
0
def test_shell():
    log.info("single call")
    log.info("got: {0}", system.shell(__file__ + ' "single result" 2'))
    log.info("multi call")

    cmd = __file__ + ' "multi result 1" 2; '
    cmd += __file__ + ' "multi result 2" 2 err'
    for out in system.shell(cmd):
        log.info("got: {0}", out)

    log.info("single background call")
    cmd = __file__ + ' "background result" 2'
    log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.BACKGROUND))
    log.info("multi background call")
    cmd = __file__ + ' "background result 1" 2; '
    cmd += __file__ + ' "background result 2" 3 err'
    log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.BACKGROUND))
    log.info("single streamed call")
    cmd = __file__ + ' "single streamed" 2'
    log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.LOGGED))
    log.info("multi streamed call")
    cmd = __file__ + ' "streamed 1" 2; ' + __file__ + ' "streamed 2" 2 err'
    log.info("got: {0}", system.shell(cmd, system.EXEC_MODE.LOGGED))
Beispiel #7
0
# AUTOMATICALLY GENERATED FILE TO BE USED BY MAGIC HOTBOX
#
# NAME: Mocha
#
#----------------------------------------------------------------------------------------------------------

from cgev.common import environment
from cgev.common import system
#import win32gui

dirPath = nuke.selectedNode().knob('file').value()
dirPath = dirPath.split('/')[0:-1]
dirPath = '/'.join(dirPath)

if os.path.isdir(dirPath):

    def windowEnumerationHandler(hwnd, top_windows):
        top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))

    mocha_path = environment.getBinPath().replace(
        '\\', '//') + '/mochaProV2/bin/mochapro.exe'

    filename = nuke.selectedNode().knob('file').value()
    filename = filename.split('.')
    size = len(filename[-2])
    filename[-2] = str(nuke.selectedNode().firstFrame()).zfill(size)
    filename = '.'.join(filename)

    system.shell(mocha_path + ' ' + filename, mode=system.EXEC_MODE.BACKGROUND)
else:
    nuke.message('You have to batch your shot before you can open it !')
Beispiel #8
0
    def handleButton(self):
        os.environ[envvars.CGEV_FAKE_APP] = ''
        vrayVersion = self.listProjects[self.projectTable.currentRow()][1]
        print(vrayVersion)
        # Remplacer par requette ftrack pour identifier le VRAY_VERSION
        os.environ[envvars.VRAY_VERSION] = str(vrayVersion)
        # Remplacer par scene maya a charger
        # cmd3 = os.path.join("\"C:\\", "Program Files", "Autodesk",
                            # "Maya2016", "bin", "maya.exe\"%*")

        cmd4 = "\"C:\\Program Files\\Autodesk\\Maya2016\\bin\\maya.exe\" %*"

        try:
            system.shell([cmd4], mode=system.EXEC_MODE.BACKGROUND)
        except:
            pass
        # os.system(cmd3)
        self.close()
"""

if __name__ == "__main__":

    os.environ[envvars.VRAY_VERSION] = "34003"
    cmd4 = '"C:\\Program Files\\Autodesk\\Maya2016\\bin\\maya.exe"'
    system.shell([cmd4], mode=system.EXEC_MODE.BACKGROUND)

    """app = QtGui.QApplication(sys.argv)
    ml = MayaLauncher()

    sys.exit(app.exec_())"""
Beispiel #9
0
def test_kill():
    pid = system.shell(__file__ + ' "running for 3s" 3',
                       system.EXEC_MODE.BACKGROUND)
    time.sleep(1)
    system.kill(pid)
Beispiel #10
0
def compile_py():
    os.chdir(os.path.dirname(qrc_file))
    cmd = 'pyside-rcc {0} -o {1}'.format(qrc_file, py_file)
    shell(cmd, mode=EXEC_MODE.LOGGED)
Beispiel #11
0
#
# NAME: Mocha
#
#----------------------------------------------------------------------------------------------------------

from cgev.common import environment
from cgev.common import system
import os

#import win32gui


def windowEnumerationHandler(hwnd, top_windows):
    top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))


mocha_path = 'C:/Program Files/Imagineer Systems Ltd/mocha Pro V5/bin/mochapro.exe'
if os.path.exists(mocha_path):
    mocha_path = "\"C:\\Program Files\\Imagineer Systems Ltd\\mocha Pro V5\\bin\\mochapro.exe\" "
else:
    mocha_path = environment.getBinPath().replace(
        '\\', '//') + '/mochaProV2/bin/mochapro.exe '

filename = nuke.selectedNode().knob('file').value()
filename = filename.split('.')
size = len(filename[-2])
filename[-2] = str(nuke.selectedNode().firstFrame()).zfill(size)
filename = '.'.join(filename)

system.shell([mocha_path + filename], mode=system.EXEC_MODE.BACKGROUND)