def addStills(self, mayaFile="pyramid.mb", frames=[1, 12, 24]): """Test method to send stills from Maya to an open Flix edit Usage: fromMaya.addStills(self.testInfo, "pyramid.mb", [1, 12, 24]) :param mayaFile: Name of the Maya scene file :param frames: Array of frames for which to send panels from Maya :return: None """ log("##### addStills") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) existingFrames = [] for frame in frames: if mayaSettings["inFrame"] <= frame <= mayaSettings["outFrame"]: existingFrames.append(frame) else: log( "addStills: Frame %s not in Maya scene (In: %s Out: %s); skipping..." % (frame, mayaSettings["inFrame"], mayaSettings["outFrame"]), "error", ) melScriptPath = "%s/addStills.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = "" for frame in existingFrames: # For each frame, set the keyframe, perform mayaAddStill, wait for 3sec scriptBody += "currentTime %s;\n" 'evalDeferred("addStill");\n\n' % frame self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.addStillsCheck(self.testInfo, existingFrames) self.fromMayaCheck.addStillsCheck(existingFrames)
def replaceSequencerShot(self, mayaFile="pyramidSequencer.mb", shotNumber=1): """Test method to replace the currently selected Flix panel with a shot from a Maya sequencer. Usage: fromMaya.replaceSequencerShot(self.testInfo, "pyramidSequencer.mb", 1) :param mayaFile: Name of the Maya scene file :param shotNumber: Position of the shot in the sequencer :return: None """ log("##### replaceSequencerShot") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) if shotNumber > mayaSettings["nShots"]: shot = mayaSettings["shotNames"][0] else: shot = mayaSettings["shotNames"][shotNumber - 1] duration = mayaSettings["outFrame"] - mayaSettings["inFrame"] + 1 melScriptPath = "%s/replaceSequencerShot.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = "select -add %s ;\n" 'evalDeferred("replaceSequencerShot");\n\n' % shot self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.replaceSequencerShotCheck(self.testInfo, duration) self.fromMayaCheck.replaceSequencerShotCheck(duration)
def addSequencerShots(self, mayaFile="pyramidSequencer.mb", nShots=1): """Test method to send a number of sequencer shots from Maya to the current Flix edit Usage: fromMaya.addSequencerShot(self.testInfo, "pyramidSequencer.mb", 3) :param mayaFile: Name of the Maya scene file :param nShots: Number of shots to be sent from Maya to Flix :return: None """ log("##### addSequencerShots") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) if nShots > mayaSettings["nShots"]: shots = mayaSettings["shotNames"][0 : mayaSettings["nShots"]] else: shots = mayaSettings["shotNames"][0:nShots] log("addSequencerShots: shots to be sent to Flix: %s" % shots, "debug") melScriptPath = "%s/addSequencerShot.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = "" duration = 0 for shot in shots: scriptBody += "select -add %s ;\n" % shot duration += mayaSettings["shotDurations"][shots.index(shot)] scriptBody += 'evalDeferred("addSequencerShot");\n\n' self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.addSequencerShotsCheck(self.testInfo, len(shots), duration) self.fromMayaCheck.addSequencerShotsCheck(len(shots), duration)
def replaceStill(self, mayaFile="pyramid.mb", frame=1): """Test method to replace the currently selected Flix panel with a still from Maya. Must make sure the current Flix edit contains at least one panel! Usage: fromMaya.replaceStill(self.testInfo, "pyramid.mb", 15) :param mayaFile: Name of the Maya scene file :param frame: Integer corresponding to the frame from the Maya scene to send to Flix :return: None """ log("##### replaceStill") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) if not mayaSettings["inFrame"] <= frame <= mayaSettings["outFrame"]: log( "addStills: Frame %s not in Maya scene (In: %s Out: %s); stopping test..." % (frame, mayaSettings["inFrame"], mayaSettings["outFrame"]), "error", ) return melScriptPath = "%s/replaceStill.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = "currentTime %s;\n" 'evalDeferred("replaceStill");\n\n' % frame self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.replaceStillCheck(self.testInfo) self.fromMayaCheck.replaceStillCheck()
def publishSequencer(self, mayaFile="pyramidSequencer.mb"): """Test method to publish the current Maya sequencer as a new version of the current Flix sequence. Usage: fromMaya.publishSequencer(self.testInfo, "pyramidSequencer.mb") :param mayaFile: Name of the Maya scene file :return: None """ log("##### publishSequencer") melScriptPath = "%s/publishSequencer.mel" % self.assetsPath mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) # Write Mel actions to execute in Maya scriptBody = 'evalDeferred("publishSequencer");\n\n' self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.publishSequencerCheck(self.testInfo, mayaSettings) self.fromMayaCheck.publishSequencerCheck(mayaSettings)
def replacePlayblast(self, mayaFile="pyramid.mb"): """Test method to replace the currently selected Flix panel with a playblast of the current Maya scene. Must make sure the current Flix edit contains at least one panel! Usage: fromMaya.replacePlayblast(self.testInfo, "pyramid.mb") :param mayaFile: Name of the Maya scene file :return: None """ log("##### replacePlayblast") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) duration = mayaSettings["outFrame"] - mayaSettings["inFrame"] + 1 melScriptPath = "%s/replacePlayblast.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = 'evalDeferred("replacePlayblast");\n\n' self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.replacePlayblastCheck(self.testInfo, duration) self.fromMayaCheck.replacePlayblastCheck(duration)
def addSequencer(self, mayaFile="pyramidSequencer.mb"): """Test method to add all the shots from the Maya sequencer to the current Flix edit. Usage: fromMaya.addSequencer(self.testInfo, "pyramidSequencer.mb") :param mayaFile: Name of the Maya scene file :return: None """ log("##### addSequencer") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) duration = 0 for shotDuration in mayaSettings["shotDurations"]: duration += shotDuration melScriptPath = "%s/addSequencer.mel" % self.assetsPath # Write Mel actions to execute in Maya scriptBody = 'evalDeferred("addSequencer");\n\n' self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) # fromMaya.addSequencerCheck(self.testInfo, mayaSettings["nShots"], duration) self.fromMayaCheck.addSequencerCheck(mayaSettings["nShots"], duration)
def addPlayblast(self, mayaFile="pyramid.mb"): """Test method to send a playblast from the current Maya scene to the current Flix edit Usage: fromMaya.addPlayblast(self.testInfo, "pyramid.mb") :param mayaFile: Name of the Maya scene file :return: None """ log("##### addPlayblast") mayaSettings = checkUtils.readMayaSettings(self.testInfo, mayaFile) melScriptPath = "%s/addPlayblast.mel" % self.assetsPath duration = mayaSettings["outFrame"] - mayaSettings["inFrame"] + 1 # Write Mel actions to execute in Maya scriptBody = 'evalDeferred("addPlayblast");\n\n' # self.__fromMaya("addPlayblast", mayaFile, scriptBody) self.__writeMelScript(melScriptPath, mayaFile, scriptBody) self.__executeMelScript(melScriptPath) self.fromMayaCheck.addPlayblastCheck(duration)