<s> import os <EOL> import subprocess <EOL> import tempfile <EOL> import platform <EOL> from contextlib import contextmanager <EOL> import pymel . core as pm <EOL> from pymel . core . uitypes import CheckBox , TextField <EOL> from pymel . core . general import Attribute <EOL> from pymel . core . system import FileReference <EOL> from anima . edit import Sequence , Media , Video , Track , Clip , File , Rate <EOL> from anima . extension import extends <EOL> from anima . repr import Representation <EOL> default_handle_count = <NUM_LIT:15> <EOL> class MayaExtension ( object ) : <EOL> """<STR_LIT>""" <EOL> @ extends ( Attribute ) <EOL> @ property <EOL> def next_available ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> indices = self . getArrayIndices ( ) <EOL> except TypeError : <EOL> return self <EOL> available_index = <NUM_LIT:0> <EOL> try : <EOL> for i in xrange ( max ( indices ) + <NUM_LIT:2> ) : <EOL> if not self [ i ] . connections ( ) : <EOL> available_index = i <EOL> break <EOL> except ValueError : <EOL> available_index = <NUM_LIT:0> <EOL> return self [ available_index ] <EOL> @ extends ( CheckBox ) <EOL> def value ( self , value = None ) : <EOL> """<STR_LIT>""" <EOL> from pymel . core import checkBox <EOL> if value is not None : <EOL> checkBox ( self , e = <NUM_LIT:1> , v = value ) <EOL> else : <EOL> return checkBox ( self , q = <NUM_LIT:1> , v = <NUM_LIT:1> ) <EOL> @ extends ( TextField ) <EOL> def text ( self , value = None ) : <EOL> """<STR_LIT>""" <EOL> from pymel . core import textField <EOL> if value is not None : <EOL> textField ( self , e = <NUM_LIT:1> , tx = value ) <EOL> else : <EOL> return textField ( self , q = <NUM_LIT:1> , tx = <NUM_LIT:1> ) <EOL> class FileReferenceExtension ( object ) : <EOL> """<STR_LIT>""" <EOL> def path ( self ) : <EOL> """<STR_LIT>""" <EOL> return '<STR_LIT>' <EOL> def replaceWith ( self , path ) : <EOL> """<STR_LIT>""" <EOL> return None <EOL> @ extends ( FileReference ) <EOL> def to_repr ( self , repr_name ) : <EOL> """<STR_LIT>""" <EOL> rep_v = self . find_repr ( repr_name ) <EOL> from stalker import Repository <EOL> if rep_v is not None and rep_v != self . version : <EOL> self . replaceWith ( <EOL> Repository . to_os_independent_path ( rep_v . absolute_full_path ) <EOL> ) <EOL> @ extends ( FileReference ) <EOL> def find_repr ( self , repr_name ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return <EOL> rep = Representation ( version = v ) <EOL> rep_v = rep . find ( repr_name ) <EOL> return rep_v <EOL> @ extends ( FileReference ) <EOL> def list_all_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return [ ] <EOL> rep = Representation ( version = v ) <EOL> return rep . list_all ( ) <EOL> @ extends ( FileReference ) <EOL> def to_base ( self ) : <EOL> """<STR_LIT>""" <EOL> self . to_repr ( Representation . base_repr_name ) <EOL> @ extends ( FileReference ) <EOL> def is_base ( self ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return True <EOL> rep = Representation ( version = v ) <EOL> return rep . is_base ( ) <EOL> @ extends ( FileReference ) <EOL> def has_repr ( self , repr_name ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return False <EOL> rep = Representation ( version = v ) <EOL> return rep . has_repr ( repr_name ) <EOL> @ extends ( FileReference ) <EOL> def is_repr ( self , repr_name ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return False <EOL> rep = Representation ( version = v ) <EOL> return rep . is_repr ( repr_name = repr_name ) <EOL> @ extends ( FileReference ) <EOL> @ property <EOL> def repr ( self ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return None <EOL> rep = Representation ( version = v ) <EOL> return rep . repr <EOL> @ extends ( FileReference ) <EOL> def get_base ( self ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> v = m . get_version_from_full_path ( self . path ) <EOL> if v is None : <EOL> return True <EOL> rep = Representation ( version = v ) <EOL> return rep . find ( rep . base_repr_name ) <EOL> @ extends ( FileReference ) <EOL> @ property <EOL> def version ( self ) : <EOL> """<STR_LIT>""" <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> return m . get_version_from_full_path ( self . path ) <EOL> class SequenceManagerExtension ( object ) : <EOL> """<STR_LIT>""" <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def get_shot_name_template ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> default_template = '<STR_LIT>' <EOL> self . set_shot_name_template ( default_template ) <EOL> return self . shot_name_template . get ( ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def set_shot_name_template ( self , template ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> self . addAttr ( '<STR_LIT>' , dt = '<STR_LIT:string>' ) <EOL> self . shot_name_template . set ( template ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def get_version ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT:version>' ) : <EOL> self . set_version ( '<STR_LIT>' ) <EOL> return self . version . get ( ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def set_version ( self , template ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT:version>' ) : <EOL> self . addAttr ( '<STR_LIT:version>' , dt = '<STR_LIT:string>' ) <EOL> self . version . set ( template ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def create_sequence ( self , name = None ) : <EOL> """<STR_LIT>""" <EOL> sequencer = pm . createNode ( '<STR_LIT>' ) <EOL> if name : <EOL> sequencer . set_sequence_name ( name ) <EOL> sequencer . message >> self . sequences . next_available <EOL> return sequencer <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def from_seq ( self , seq ) : <EOL> """<STR_LIT>""" <EOL> shot_name_template = self . get_shot_name_template ( ) <EOL> seqs = self . sequences . get ( ) <EOL> if seqs : <EOL> seq1 = seqs [ <NUM_LIT:0> ] <EOL> shots = seq1 . shots . get ( ) <EOL> all_clips = [ clip <EOL> for track in seq . media . video . tracks <EOL> for clip in track . clips ] <EOL> deleted_shots = [ ] <EOL> used_shots = [ ] <EOL> for shot in shots : <EOL> shot . anchor = shot . startFrame . get ( ) <EOL> for clip in all_clips : <EOL> for shot in shots : <EOL> if clip . id . lower ( ) == shot . full_shot_name . lower ( ) : <EOL> handle = shot . handle . get ( ) <EOL> track = shot . track . get ( ) <EOL> if shot in used_shots : <EOL> dup_shot = seq1 . create_shot ( shot . shotName . get ( ) ) <EOL> dup_shot . startFrame . set ( shot . startFrame . get ( ) ) <EOL> dup_shot . endFrame . set ( shot . endFrame . get ( ) ) <EOL> dup_shot . handle . set ( shot . handle . get ( ) ) <EOL> dup_shot . sequenceStartFrame . set ( <EOL> shot . sequenceStartFrame . get ( ) <EOL> ) <EOL> dup_shot . set_camera ( shot . get_camera ( ) ) <EOL> dup_shot . anchor = shot . anchor <EOL> shot = dup_shot <EOL> start_frame = clip . in_ - handle + shot . anchor <EOL> end_frame = clip . out - clip . in_ + start_frame - <NUM_LIT:1> <EOL> sequence_start = clip . start <EOL> shot . startFrame . set ( start_frame ) <EOL> shot . endFrame . set ( end_frame ) <EOL> shot . sequenceStartFrame . set ( sequence_start ) <EOL> shot . track . set ( track ) <EOL> used_shots . append ( shot ) <EOL> break <EOL> for shot in seq1 . shots . get ( ) : <EOL> if shot not in used_shots : <EOL> deleted_shots . append ( shot ) <EOL> pm . delete ( deleted_shots ) <EOL> else : <EOL> seq1 = self . create_sequence ( seq . name ) <EOL> media = seq . media <EOL> for i , track in enumerate ( media . video . tracks ) : <EOL> for clip in track . clips : <EOL> shot_name = clip . id . split ( '<STR_LIT:_>' ) [ - <NUM_LIT:2> ] <EOL> shot = seq1 . create_shot ( shot_name ) <EOL> shot . startFrame . set ( clip . in_ ) <EOL> shot . endFrame . set ( clip . out - <NUM_LIT:1> ) <EOL> shot . sequenceStartFrame . set ( clip . start ) <EOL> shot . handle . set ( <NUM_LIT:0> ) <EOL> if clip . file : <EOL> f = clip . file <EOL> pathurl = f . pathurl . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if '<STR_LIT::>' not in pathurl : <EOL> pathurl = '<STR_LIT>' % pathurl <EOL> shot . output . set ( pathurl ) <EOL> shot . track . set ( i + <NUM_LIT:1> ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def from_xml ( self , path ) : <EOL> """<STR_LIT>""" <EOL> if not isinstance ( path , str ) : <EOL> raise TypeError ( <EOL> '<STR_LIT>' % <EOL> ( self . __class__ . __name__ , path . __class__ . __name__ ) <EOL> ) <EOL> from xml . etree import ElementTree <EOL> try : <EOL> tree = ElementTree . parse ( path ) <EOL> except IOError : <EOL> raise IOError ( '<STR_LIT>' ) <EOL> root = tree . getroot ( ) <EOL> seq = Sequence ( ) <EOL> xml_seq = root . getchildren ( ) [ <NUM_LIT:0> ] <EOL> seq . from_xml ( xml_seq ) <EOL> self . from_seq ( seq ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def from_edl ( self , path ) : <EOL> """<STR_LIT>""" <EOL> if not isinstance ( path , str ) : <EOL> raise TypeError ( <EOL> '<STR_LIT>' % <EOL> ( self . __class__ . __name__ , path . __class__ . __name__ ) <EOL> ) <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> fps = m . get_fps ( ) <EOL> import edl <EOL> p = edl . Parser ( str ( fps ) ) <EOL> with open ( path ) as f : <EOL> l = p . parse ( f ) <EOL> seq = Sequence ( ) <EOL> seq . from_edl ( l ) <EOL> self . from_seq ( seq ) <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def to_xml ( self , indentation = <NUM_LIT:2> , pre_indent = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> seq = self . generate_sequence_structure ( ) <EOL> rendered_template = '<STR_LIT>' <EOL> if seq : <EOL> rendered_template = seq . to_xml ( <EOL> indentation = indentation , <EOL> pre_indent = indentation + pre_indent <EOL> ) <EOL> return rendered_template <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def generate_sequence_structure ( self ) : <EOL> """<STR_LIT>""" <EOL> import timecode <EOL> from anima . env . mayaEnv import Maya <EOL> m = Maya ( ) <EOL> fps = m . get_fps ( ) <EOL> sequencers = self . sequences . get ( ) <EOL> if len ( sequencers ) == <NUM_LIT:0> : <EOL> return None <EOL> sequencer = sequencers [ <NUM_LIT:0> ] <EOL> time = pm . PyNode ( '<STR_LIT>' ) <EOL> seq = Sequence ( ) <EOL> seq . name = str ( sequencer . get_sequence_name ( ) ) <EOL> seq . rate = Rate ( timebase = str ( fps ) , ntsc = False ) <EOL> seq . timecode = str ( timecode . Timecode ( <EOL> framerate = seq . rate . timebase , <EOL> frames = time . timecodeProductionStart . get ( ) + <NUM_LIT:1> <EOL> ) ) <EOL> seq . duration = sequencer . duration <EOL> media = Media ( ) <EOL> video = Video ( ) <EOL> media . video = video <EOL> for shot in sequencer . shots . get ( ) : <EOL> clip = Clip ( ) <EOL> clip . id = str ( shot . full_shot_name ) <EOL> clip . name = str ( shot . full_shot_name ) <EOL> clip . duration = shot . duration + <NUM_LIT:2> * shot . handle . get ( ) <EOL> clip . enabled = True <EOL> clip . start = shot . sequenceStartFrame . get ( ) <EOL> clip . end = shot . sequenceEndFrame . get ( ) + <NUM_LIT:1> <EOL> clip . in_ = shot . handle . get ( ) <EOL> clip . out = shot . handle . get ( ) + shot . duration <EOL> clip . type = '<STR_LIT>' <EOL> f = File ( ) <EOL> f . name = os . path . splitext ( <EOL> os . path . basename ( str ( shot . output . get ( ) ) ) <EOL> ) [ <NUM_LIT:0> ] <EOL> f . duration = shot . duration + <NUM_LIT:2> * shot . handle . get ( ) <EOL> f . pathurl = str ( '<STR_LIT>' % shot . output . get ( ) ) <EOL> clip . file = f <EOL> track_number = shot . track . get ( ) - <NUM_LIT:1> <EOL> try : <EOL> track = video . tracks [ track_number ] <EOL> except IndexError : <EOL> track = Track ( ) <EOL> video . tracks . append ( track ) <EOL> track . clips . append ( clip ) <EOL> video . width = shot . wResolution . get ( ) <EOL> video . height = shot . hResolution . get ( ) <EOL> seq . media = media <EOL> return seq <EOL> @ extends ( pm . nodetypes . SequenceManager ) <EOL> def to_edl ( self ) : <EOL> """<STR_LIT>""" <EOL> seq = self . generate_sequence_structure ( ) <EOL> l = seq . to_edl ( ) <EOL> return l <EOL> class SequencerExtension ( object ) : <EOL> """<STR_LIT>""" <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> @ property <EOL> def manager ( self ) : <EOL> """<STR_LIT>""" <EOL> return pm . ls ( self . connections ( ) , type = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def get_sequence_name ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> self . set_sequence_name ( '<STR_LIT>' ) <EOL> return self . sequence_name . get ( ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def set_sequence_name ( self , name ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> self . addAttr ( '<STR_LIT>' , dt = '<STR_LIT:string>' ) <EOL> self . sequence_name . set ( name ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> @ property <EOL> def all_shots ( self ) : <EOL> """<STR_LIT>""" <EOL> return pm . ls ( self . shots . get ( ) , typ = '<STR_LIT>' ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def add_shot ( self , shot ) : <EOL> """<STR_LIT>""" <EOL> if not shot . hasAttr ( '<STR_LIT>' ) : <EOL> shot . set_handle ( handle = default_handle_count ) <EOL> for attr in shot . message . outputs ( p = <NUM_LIT:1> ) : <EOL> if isinstance ( attr . node ( ) , pm . nodetypes . Sequencer ) : <EOL> shot . message // attr <EOL> shot . message >> self . shots . next_available <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def set_shot_handles ( self , handle = default_handle_count ) : <EOL> """<STR_LIT>""" <EOL> for shot in self . all_shots : <EOL> shot . set_handle ( handle ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def mute_shots ( self ) : <EOL> """<STR_LIT>""" <EOL> for shot in self . all_shots : <EOL> shot . mute ( ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def unmute_shots ( self ) : <EOL> """<STR_LIT>""" <EOL> for shot in self . all_shots : <EOL> shot . unmute ( ) <EOL> def create_sequencer_attributes ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def set_shot_names ( self , sequence_name , padding = <NUM_LIT:4> , increment = <NUM_LIT:10> , <EOL> template = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def create_shot ( self , name = '<STR_LIT>' , handle = default_handle_count ) : <EOL> """<STR_LIT>""" <EOL> shot = pm . createNode ( '<STR_LIT>' ) <EOL> shot . shotName . set ( name ) <EOL> shot . set_handle ( handle = handle ) <EOL> shot . set_output ( '<STR_LIT>' ) <EOL> shot . message >> self . shots . next_available <EOL> return shot <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def create_shot_playblasts ( self , output_path , show_ornaments = True ) : <EOL> """<STR_LIT>""" <EOL> movie_files = [ ] <EOL> for shot in self . all_shots : <EOL> movie_files . append ( <EOL> shot . playblast ( <EOL> options = { '<STR_LIT>' : show_ornaments } <EOL> ) <EOL> ) <EOL> return movie_files <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def to_edl ( self , seq ) : <EOL> """<STR_LIT>""" <EOL> return seq . to_edl ( ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def metafuze ( self ) : <EOL> """<STR_LIT>""" <EOL> sm = pm . PyNode ( '<STR_LIT>' ) <EOL> seq = sm . generate_sequence_structure ( ) <EOL> xmls = seq . to_metafuze_xml ( ) <EOL> for i , xml in enumerate ( xmls ) : <EOL> temp_file_path = tempfile . mktemp ( suffix = '<STR_LIT>' ) <EOL> yield i <EOL> with open ( temp_file_path , '<STR_LIT:w>' ) as f : <EOL> f . write ( xml ) <EOL> subprocess . call ( <EOL> [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> temp_file_path ] , <EOL> shell = True <EOL> ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> def convert_to_mxf ( self , path ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> @ extends ( pm . nodetypes . Sequencer ) <EOL> @ property <EOL> def duration ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . maxFrame . get ( ) - self . minFrame . get ( ) + <NUM_LIT:1> <EOL> class ShotExtension ( object ) : <EOL> """<STR_LIT>""" <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def get_camera ( self ) : <EOL> """<STR_LIT>""" <EOL> return pm . PyNode ( pm . shot ( self , q = <NUM_LIT:1> , currentCamera = <NUM_LIT:1> ) ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def set_camera ( self , camera ) : <EOL> """<STR_LIT>""" <EOL> pm . shot ( self , e = <NUM_LIT:1> , currentCamera = camera ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def get_output ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> self . set_output ( '<STR_LIT>' ) <EOL> return self . output . get ( ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def set_output ( self , output ) : <EOL> """<STR_LIT>""" <EOL> if not self . hasAttr ( '<STR_LIT>' ) : <EOL> self . addAttr ( '<STR_LIT>' , dt = '<STR_LIT:string>' ) <EOL> self . output . set ( output ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def mute ( self ) : <EOL> """<STR_LIT>""" <EOL> pm . shot ( self , e = <NUM_LIT:1> , mute = True ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def unmute ( self ) : <EOL> """<STR_LIT>""" <EOL> pm . shot ( self , e = <NUM_LIT:1> , mute = False ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> @ property <EOL> def sequence ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . message . get ( ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> @ property <EOL> @ contextmanager <EOL> def include_handles ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> handle = self . handle . get ( ) <EOL> except AttributeError : <EOL> self . set_handle ( ) <EOL> handle = self . handle . get ( ) <EOL> track = self . track . get ( ) <EOL> self . startFrame . set ( <EOL> self . startFrame . get ( ) - handle <EOL> ) <EOL> self . endFrame . set ( <EOL> self . endFrame . get ( ) + handle <EOL> ) <EOL> self . sequenceStartFrame . set ( <EOL> self . sequenceStartFrame . get ( ) - handle <EOL> ) <EOL> try : <EOL> yield None <EOL> finally : <EOL> self . startFrame . set ( <EOL> self . startFrame . get ( ) + handle <EOL> ) <EOL> self . endFrame . set ( <EOL> self . endFrame . get ( ) - handle <EOL> ) <EOL> self . sequenceStartFrame . set ( <EOL> self . sequenceStartFrame . get ( ) + handle <EOL> ) <EOL> self . track . set ( track ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def playblast ( self , options = None ) : <EOL> """<STR_LIT>""" <EOL> sequence = self . sequence <EOL> try : <EOL> handle = self . handle . get ( ) <EOL> except AttributeError : <EOL> self . set_handle ( ) <EOL> handle = self . handle . get ( ) <EOL> start_frame = self . sequenceStartFrame . get ( ) - handle <EOL> end_frame = self . sequenceEndFrame . get ( ) + handle <EOL> width = self . wResolution . get ( ) <EOL> height = self . hResolution . get ( ) <EOL> extra_frame = <NUM_LIT:0> <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> extra_frame = <NUM_LIT:1> <EOL> track = self . track . get ( ) <EOL> movie_full_path = os . path . join ( <EOL> tempfile . gettempdir ( ) , <EOL> '<STR_LIT>' % self . full_shot_name <EOL> ) . replace ( '<STR_LIT:\\>' , '<STR_LIT:/>' ) <EOL> self . set_output ( movie_full_path ) <EOL> sequence . mute_shots ( ) <EOL> self . unmute ( ) <EOL> default_options = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:50> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : start_frame , <EOL> '<STR_LIT>' : end_frame + extra_frame , <EOL> '<STR_LIT:filename>' : movie_full_path , <EOL> '<STR_LIT>' : [ width , height ] , <EOL> '<STR_LIT>' : True , <EOL> } <EOL> if options : <EOL> if '<STR_LIT>' in options : <EOL> options [ '<STR_LIT>' ] += extra_frame <EOL> default_options . update ( options ) <EOL> with self . include_handles : <EOL> pm . system . dgdirty ( a = True ) <EOL> import pprint <EOL> pprint . pprint ( default_options ) <EOL> result = pm . playblast ( ** default_options ) <EOL> sequence . unmute_shots ( ) <EOL> self . track . set ( track ) <EOL> return result <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def convert_to_mxf ( self , metafuze_xml ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> def set_handle ( self , handle = default_handle_count ) : <EOL> """<STR_LIT>""" <EOL> if not isinstance ( handle , int ) : <EOL> raise TypeError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % <EOL> { <EOL> '<STR_LIT:class>' : self . __class__ . __name__ , <EOL> '<STR_LIT>' : handle . __class__ . __name__ <EOL> } <EOL> ) <EOL> if handle < <NUM_LIT:0> : <EOL> raise ValueError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % <EOL> { <EOL> '<STR_LIT:class>' : self . __class__ . __name__ , <EOL> '<STR_LIT>' : handle <EOL> } <EOL> ) <EOL> try : <EOL> self . addAttr ( '<STR_LIT>' , at = '<STR_LIT>' , k = False , min = <NUM_LIT:0> ) <EOL> except RuntimeError : <EOL> pass <EOL> self . setAttr ( '<STR_LIT>' , handle ) <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> @ property <EOL> def duration ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . sequenceEndFrame . get ( ) - self . sequenceStartFrame . get ( ) + <NUM_LIT:1> <EOL> def add_frames_to_start ( self , shot , frame_count = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def add_frames_to_end ( self , shot , frame_count = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def remove_frames_from_start ( self , shot , frame_count = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def remove_frames_from_end ( self , shot , frame_count = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> @ extends ( pm . nodetypes . Shot ) <EOL> @ property <EOL> def full_shot_name ( self ) : <EOL> """<STR_LIT>""" <EOL> seq = self . sequence <EOL> sm = seq . manager <EOL> camera = self . currentCamera . get ( ) <EOL> version = sm . get_version ( ) <EOL> template = sm . get_shot_name_template ( ) <EOL> template = template . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> rendered_template = template % { <EOL> '<STR_LIT>' : self . shotName . get ( ) , <EOL> '<STR_LIT>' : seq . sequence_name . get ( ) , <EOL> '<STR_LIT:version>' : version , <EOL> '<STR_LIT>' : camera . name ( ) if camera else None <EOL> } <EOL> return rendered_template </s>
