This is RenderMan 21 Documentation you are viewing. The Rmanwiki home page will redirect you to the current documentation.

Page tree

Contents

from TrEnvHandler import TrEnvHandler
import logging

class projxhandler(TrEnvHandler):
    def __init__(self, name, envkeydict, envkeys):
        self.logger = logging.getLogger("tractor-blade")
        self.logger.info("initializing projxhandler: %s" % (name))
        TrEnvHandler.__init__(self, name, envkeydict, envkeys)

    def initLocalVars(self):
        self.scene = None
        self.shot = None

    def updateEnvironment(self, cmd, env, envkeys):
        self.logger.debug("projxhandler.updateEnvironment: %s" % repr(envkeys))
        # Local vars should be initialized in call to updateEnvironment()
        self.initLocalVars()
        if envkeys and type(envkeys) == type([]):
            for envkey in envkeys:
                key,val = envkey.split("=")
                self.logger.debug("projxhandler.envkey: %s" % envkey)
                if key == "SCENE":
                    self.scene = envkey
                    env["SCENE"] = self.scene
                elif key == "SHOT":
                    self.shot = envkey
                    env["SHOT"] = self.shot

        return TrEnvHandler.updateEnvironment(self, cmd, env, envkeys)

    def remapCmdArgs(self, cmdinfo, launchenv, thisHost):
        self.logger.debug("projxhandler.remapCmdArgs: %s" % self.name)
        argv = TrEnvHandler.remapCmdArgs(self, cmdinfo, launchenv, thisHost)
        self.logger.info("scene: %s, shot:%s" %
            (self.scene, self.shot))

        # indicate command was launched by tractor
        launchenv["TRACTOR"] = "1"

        if argv[0] == "render" and "RMANTREE" in launchenv:
            argv[0] = os.path.join(launchenv["RMANTREE"],"bin","prman"))
            argv.[1:1] = ["-statsfile", "%s-%s" % (self.scene, self.shot))

        # on windows for add the Visual Studio default libs and includes
        p = platform.platform()
        if p.find("Windows") != -1:
            if launchenv.has_key("INCLUDE"):
                launchenv["INCLUDE"] += ";" + launchenv["VCINCLUDE"]
            else:
                launchenv["INCLUDE"] = launchenv["VCINCLUDE"]

            if launchenv.has_key("LIB"):
                launchenv["LIB"] += ";" + launchenv["VCLIB"]
            else:
                launchenv["LIB"] = launchenv["VCLIB"]

        return argv

    def debug(self):
        self.logger.debug("projxhandler.debug: %s" % self.name)
        TrEnvHandler.debug(self)