Esempio n. 1
0
def pnghack(filepath, width=1024, height=768):
    #Workaround if cmd.png() doesn't work
    cmd.set('ray_trace_frames', 1)  # Frames are raytraced before saving an image.
    cmd.set('ray_shadows', 0)
    cmd.viewport(width, height)  # Set resolution
    cmd.mpng(filepath, 1, 1)  # Use batch png mode with 1 frame only
    cmd.mplay()  # cmd.mpng needs the animation to 'run'
Esempio n. 2
0
    def png_workaround(filepath, width=1200, height=800):
        """Workaround for (a) severe bug(s) in PyMOL preventing ray-traced images to be produced in command-line mode.
        Use this function in case neither cmd.ray() or cmd.png() work.
        """
        sys.stdout = sys.__stdout__
        cmd.feedback('disable', 'movie', 'everything')
        cmd.viewport(width, height)
        cmd.zoom('visible', 1.5)  # Adapt the zoom to the viewport
        cmd.set('ray_trace_frames',
                1)  # Frames are raytraced before saving an image.
        cmd.mpng(filepath, config.MODEL,
                 config.MODEL)  # Use batch png mode with 1 frame only
        cmd.mplay()  # cmd.mpng needs the animation to 'run'
        cmd.refresh()
        originalfile = "".join([
            filepath,
            (4 - len(str(config.MODEL))) * '0' + str(config.MODEL) + '.png'
        ])
        newfile = "".join([filepath, '.png'])

        #################################################
        # Wait for file for max. 1 second and rename it #
        #################################################

        attempts = 0
        while not os.path.isfile(originalfile) and attempts <= 10:
            sleep(0.1)
            attempts += 1
        if os.name == 'nt':  # In Windows, make sure there is no file of the same name, cannot be overwritten as in Unix
            if os.path.isfile(newfile):
                os.remove(newfile)
        os.rename(originalfile, newfile)  # Remove frame number in filename

        #  Check if imagemagick is available and crop + resize the images
        if subprocess.call("type convert",
                           shell=True,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE) == 0:
            attempts, ecode = 0, 1
            # Check if file is truncated and wait if that's the case
            while ecode != 0 and attempts <= 10:
                ecode = subprocess.call(['convert', newfile, '/dev/null'],
                                        stdout=open('/dev/null', 'w'),
                                        stderr=subprocess.STDOUT)
                sleep(0.1)
                attempts += 1
            trim = 'convert -trim ' + newfile + ' -bordercolor White -border 20x20 ' + newfile + ';'  # Trim the image
            os.system(trim)
            getwidth = 'w=`convert ' + newfile + ' -ping -format "%w" info:`;'  # Get the width of the new image
            getheight = 'h=`convert ' + newfile + ' -ping -format "%h" info:`;'  # Get the hight of the new image
            newres = 'if [ "$w" -gt "$h" ]; then newr="${w%.*}x$w"; else newr="${h%.*}x$h"; fi;'  # Set quadratic ratio
            quadratic = 'convert ' + newfile + ' -gravity center -extent "$newr" ' + newfile  # Fill with whitespace
            os.system(getwidth + getheight + newres + quadratic)
        else:
            sys.stderr.write(
                'Imagemagick not available. Images will not be resized or cropped.'
            )
Esempio n. 3
0
    def test(self, use_shaders, cgo_shader_ub, rep="cartoon"):
        self._setup_movie(rep)

        cmd.set("use_shaders", use_shaders)
        cmd.set("cgo_shader_ub_color", cgo_shader_ub)
        cmd.set("cgo_shader_ub_flags", cgo_shader_ub)
        cmd.set("cgo_shader_ub_normal", cgo_shader_ub)

        with testing.mkdtemp() as tempdir, self.timing():
            cmd.mpng(os.path.join(tempdir, "f"))
Esempio n. 4
0
    def test(self, use_shaders, cgo_shader_ub, rep="cartoon"):
        self._setup_movie(rep)

        cmd.set("use_shaders", use_shaders)
        cmd.set("cgo_shader_ub_color", cgo_shader_ub)
        cmd.set("cgo_shader_ub_flags", cgo_shader_ub)
        cmd.set("cgo_shader_ub_normal", cgo_shader_ub)

        with testing.mkdtemp() as tempdir, self.timing():
            cmd.mpng(os.path.join(tempdir, "f"))
def png_workaround(filepath, width=1024, height=768):
    """Workaround for (a) severe bug(s) in PyMOL preventing ray-traced images to be produced in command-line mode.
    Use this function in case neither cmd.ray() or cmd.png() work.
    """
    cmd.set('ray_trace_frames', 1)  # Frames are raytraced before saving an image.
    cmd.viewport(width, height)  # Set resolution
    ### Workaround for raytracing in command-line mode
    cmd.mpng(filepath, 1, 1)  # Use batch png mode with 1 frame only
    cmd.mplay()  # cmd.mpng needs the animation to 'run'
    os.rename("".join([filepath[:-4], '0001.png']), "".join([filepath[:-4], '.png']))  # Remove frame number in filename
def png_workaround(filepath, width=1024, height=768):
    """Workaround for (a) severe bug(s) in PyMOL preventing ray-traced images to be produced in command-line mode.
    Use this function in case neither cmd.ray() or cmd.png() work.
    """
    cmd.set('ray_trace_frames',
            1)  # Frames are raytraced before saving an image.
    cmd.viewport(width, height)  # Set resolution
    ### Workaround for raytracing in command-line mode
    cmd.mpng(filepath, 1, 1)  # Use batch png mode with 1 frame only
    cmd.mplay()  # cmd.mpng needs the animation to 'run'
    os.rename("".join([filepath[:-4], '0001.png']),
              "".join([filepath[:-4],
                       '.png']))  # Remove frame number in filename
Esempio n. 7
0
def color_L1(arg0, arg1, arg2, arg3, arg4=1, MOVIE=0, bgcol='hydrogen'):
    '''
DESCRIPTION

    Brief description: Colors the identified L1 features 
    '''
    # Running on pymol cmdline
    #run ./pymol_scripts/color_L1.py
    #color_L1 pdb/1ruz.pdb, 78 137 158 188 241 292 573, green, 2
    filename = arg0

    cmd.load(filename)
    cmd.hide('everything')
    #cmd.cartoon('rectangle')
    cmd.show('cartoon')

    cmd.set('reflect', 0.5)

    Feature_set = [int(j) for j in np.array(arg1.split())]
    col = arg2
    L = int(arg3)

    #reset color to gray
    if arg4 == '1':
        print('coloring gray')
        cmd.do('color ' + bgcol)

    print(arg4)

    F = np.array([np.arange(i - L, i + L + 1) for i in Feature_set]).flatten()
    for feature in F:
        print("resi " + str(feature))
        cmd.color(col, "resi " + str(feature))

    cmd.viewport("2560,1920")

    if MOVIE == "0":
        MOVIE = False

    if MOVIE:
        cmd.show('surface')
        cmd.mset('1 x 10')
        cmd.util.mroll(1, 10, 1)

        cmd.mplay
        cmd.viewport("2560,1920")
        cmd.set("ray_trace_frames", 1)
        cmd.set("cache_frames", 0)
        cmd.mclear
        cmd.mpng('zXXXmov')
Esempio n. 8
0
def gen_frames(pdb):
    cmd.reinitialize()
    pdb_filename = "./pdbs/n" + pdb + ".pdb"
    cmd.load(pdb_filename)
    cmd.orient()
    cmd.show_as("cartoon")
    cmd.color("marine")
    cmd.set("opaque_background", 0)
    cmd.bg_color("white")
    cmd.mset("1 x90")
    cmd.util.mroll(1, 90, 1)
    frame_folder_path = "./frames/" + pdb + "/"
    frame_prefix = frame_folder_path + "frame"
    cmd.mpng(frame_prefix)
    final_frame = frame_prefix + "0090.png"
    while not os.path.exists(final_frame):
        time.sleep(0.1)
Esempio n. 9
0
def draw_interp(out_dir, selection='*', width=1000, height=1000, antialias=2, dpi=-1):

    structs = []
    interp_prefixes = []
    for obj in cmd.get_names('objects'):
        m = re.match(r'^.*lig(_gen)?(_fit)?(_add)?$', obj)
        if m:
            structs.append(obj)
        m = re.match(r'^(.*_lig_gen)_surfaces$', obj)
        if m and fnmatch.fnmatch(obj, selection):
            interp_prefixes.append(m.group(1))

    # try to infer the job_name from working directory
    job_name = os.path.basename(os.getcwd())

    # once we have a job_name, we can correctly parse the prefixes
    interp_re = re.compile(
        '^' + '_'.join([
            r'(?P<job_name>{})'.format(job_name),
            r'(?P<array_idx>\d+)',
            r'(?P<interp_name>(.+)_to_(.+))',
            r'(?P<grid_type>lig(_gen)?(_fit)?)'
        ]) + '$'
    )

    for interp_prefix in interp_prefixes:
        
        m = interp_re.match(interp_prefix)
        if not m:
            continue

        interp_name = m.group('interp_name')
        interp_dir = os.path.join(out_dir, job_name, interp_name)
        os.makedirs(interp_dir, exist_ok=True)

        density = interp_prefix + '_surfaces'
        struct = interp_prefix + '_fit_add'

        # hide everything except the grouped surface objects,
        # since their visibility is controlled by the group object
        cmd.disable('all')
        cmd.enable('*_surface')

        # density only
        cmd.enable(density)
        cmd.set('transparency', 0.2, density)
        im_prefix = os.path.join(interp_dir, interp_prefix) + '_density_'
        cmd.mpng(im_prefix, first=0, last=0, mode=1, width=width, height=height)

        # density and struct
        cmd.enable(struct)
        cmd.set('transparency', 0.5, density)
        im_prefix = os.path.join(interp_dir, interp_prefix) + '_both_'
        cmd.mpng(im_prefix, first=0, last=0, mode=1, width=width, height=height)

        cmd.disable(density)
        im_prefix = os.path.join(interp_dir, interp_prefix) + '_struct_'
        cmd.mpng(im_prefix, first=0, last=0, mode=1, width=width, height=height)

    print('Done')
Esempio n. 10
0
    def test_scenes(self):
        self._load_example()

        cmd.scene('s1', 'store')
        cmd.enable('g1')
        cmd.scene('s2', 'store')
        cmd.mset('1x4')
        cmd.mview('store', 1, scene='s2')
        cmd.mview('store', 4, scene='s1')

        with testing.mkdtemp() as tempdir:
            # export
            prefix = os.path.join(tempdir, 'frame')
            cmd.mpng(prefix, width=100, height=100)

            img = self.get_imagearray(prefix + '0002.png')
            self.assertImageHasColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0003.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)
Esempio n. 11
0
    def testMpng(self, modal):
        import glob, os

        shape2 = (100, 100)
        cmd.mset("1x4")
        cmd.mdo(1, 'bg_color red')
        cmd.mdo(3, 'bg_color blue')

        with testing.mkdtemp() as dirname:
            cmd.mpng(os.path.join(dirname, 'image'), width=shape2[0], height=shape2[1])
            filenames = glob.glob(os.path.join(dirname, 'image*.png'))
            filenames.sort()

            self.assertEqual(4, len(filenames))

            img = self.get_imagearray(filenames[0])
            self.assertEqual(img.shape[:2], shape2)
            self.assertImageHasColor('red', img)

            img = self.get_imagearray(filenames[-1])
            self.assertEqual(img.shape[:2], shape2)
            self.assertImageHasColor('blue', img)
Esempio n. 12
0
    def test_scenes(self):
        self._load_example()

        cmd.scene('s1', 'store')
        cmd.enable('g1')
        cmd.scene('s2', 'store')
        cmd.mset('1x4')
        cmd.mview('store', 1, scene='s2')
        cmd.mview('store', 4, scene='s1')

        with testing.mkdtemp() as tempdir:
            # export
            prefix = os.path.join(tempdir, 'frame')
            cmd.mpng(prefix, width=100, height=100)

            img = self.get_imagearray(prefix + '0002.png')
            self.assertImageHasColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0003.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)
Esempio n. 13
0
    def testMpng(self, modal):
        import glob, os

        shape2 = (100, 100)
        cmd.mset("1x4")
        cmd.mdo(1, 'bg_color red')
        cmd.mdo(3, 'bg_color blue')

        with testing.mkdtemp() as dirname:
            cmd.mpng(os.path.join(dirname, 'image'),
                     width=shape2[0],
                     height=shape2[1])
            filenames = glob.glob(os.path.join(dirname, 'image*.png'))
            filenames.sort()

            self.assertEqual(4, len(filenames))

            img = self.get_imagearray(filenames[0])
            self.assertEqual(img.shape[:2], shape2)
            self.assertImageHasColor('red', img)

            img = self.get_imagearray(filenames[-1])
            self.assertEqual(img.shape[:2], shape2)
            self.assertImageHasColor('blue', img)
Esempio n. 14
0
    def test_mdo(self):
        self._load_example()

        cmd.mset('1x3')
        cmd.mdo(1, 'disable m1')
        cmd.mdo(2, 'enable m1')
        cmd.mdo(3, 'enable g1')

        with testing.mkdtemp() as tempdir:
            # export
            prefix = os.path.join(tempdir, 'frame')
            cmd.mpng(prefix, width=100, height=100)

            img = self.get_imagearray(prefix + '0001.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0002.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0003.png')
            self.assertImageHasColor('red', img)
            self.assertImageHasColor('blue', img)
Esempio n. 15
0
    def test_mdo(self):
        self._load_example()

        cmd.mset('1x3')
        cmd.mdo(1, 'disable m1')
        cmd.mdo(2, 'enable m1')
        cmd.mdo(3, 'enable g1')

        with testing.mkdtemp() as tempdir:
            # export
            prefix = os.path.join(tempdir, 'frame')
            cmd.mpng(prefix, width=100, height=100)

            img = self.get_imagearray(prefix + '0001.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0002.png')
            self.assertImageHasNotColor('red', img)
            self.assertImageHasColor('blue', img)

            img = self.get_imagearray(prefix + '0003.png')
            self.assertImageHasColor('red', img)
            self.assertImageHasColor('blue', img)
Esempio n. 16
0
def pnghack(filepath, width=1024, height=768):
    """Workaround if cmd.png() doesn't work"""
    cmd.viewport(width, height)  # Set resolution
    cmd.mpng(filepath, 1, 1)  # Use batch png mode with 1 frame only
    cmd.mplay()  # cmd.mpng needs the animation to 'run'
Esempio n. 17
0
cmd.frame(150)
cmd.set_view(
    (-0.175534308, -0.331560850, -0.926960170, 0.541812420, 0.753615797,
     -0.372158051, 0.821965039, -0.567564785, 0.047358301, -0.000067875,
     0.000017881, -55.406421661, 54.029174805, 26.956727982, 77.124832153,
     2.592475891, 108.227416992, -20.000000000))
cmd.mview()
cmd.frame(200)
cmd.scene('S1')
cmd.mview()
cmd.frame(350)
cmd.scene('S1')
cmd.set_view(
    (0.395763457, -0.173441306, 0.901825786, 0.915456235, 0.152441502,
     -0.372427106, -0.072881661, 0.972972929, 0.219108686, 0.000070953,
     0.000013039, -37.689743042, 57.748500824, 14.325904846, 77.241867065,
     -15.123448372, 90.511535645, -20.000000000))

cmd.mview()
cmd.frame(351)
cmd.scene('S2')
cmd.mview()

cmd.frame(500)
cmd.scene('S2')
cmd.mview()
cmd.mplay()
cmd.mpng('p53_1tup')

cmd.quit()
Esempio n. 18
0
def save_movie_mpeg1(filename,
                     mode='',
                     first=0,
                     last=0,
                     preserve=0,
                     fps=25,
                     twopass=1,
                     vbitrate=16000,
                     quiet=1,
                     exe='mencoder'):
    '''
DESCRIPTION

    Save movie as MPEG1

    This will not be the best quality possible for the file size, but
    we were successfull to play those movies in PowerPoint.

    Requires mencoder executable from http://mplayerhq.hu

ARGUMENTS

    filename = string: Filename, should end on '.mpeg'

    mode = normal | draw | ray

    first, last = integer: first and last frame number

    preserve = 0 or 1: delete temporary images if 0 {default: 0}

    fps = integer: frames per second {default: 25}

    twopass = 0 or 1: two pass mode encoding (improves quality) {default: 1}

    vbitrate = integer: average video bitrate {default: 16000}
    WARNING: 4-16000 (in kbit), 16001-24000000 (in bit)

SEE ALSO

    cmd.movie.produce, http://www.freemol.org
    '''
    import os, subprocess, tempfile

    first, last, quiet = int(first), int(last), int(quiet)
    fps, twopass, vbitrate = int(fps), int(twopass), int(vbitrate)

    if cmd.is_string(mode):
        if mode == '':
            if cmd.pymol.invocation.options.no_gui \
                    or cmd.get_setting_boolean('ray_trace_frames'):
                mode = 'ray'
            else:
                mode = 'draw'
        mode = produce_mode_sc.auto_err(mode, 'mode')
        mode = produce_mode_dict[mode]
    mode = int(mode)

    try:
        subprocess.call([exe])
    except OSError:
        print(' Error: Cannot execute "%s"' % (exe))
        raise CmdException

    if not quiet:
        print(' save_movie: Rendering frames...')

    tmp_path = tempfile.mkdtemp()
    prefix = os.path.join(tmp_path, 'frame')
    cmd.mpng(prefix, first, last, preserve, mode=mode)

    mpeg1line = '-mf type=png:fps=%d -ovc lavc -forceidx -noskip -of rawvideo' \
            + ' -mpegopts format=mpeg1 -lavcopts vcodec=mpeg1video:vbitrate=%d' \
            + ':vhq:trell:keyint=25'
    mpeg1line = mpeg1line % (fps, vbitrate)
    cmdline = exe + ' -quiet mf://' + prefix + '* ' + mpeg1line

    if not quiet:
        print(' save_movie: Running mencoder...')

    if twopass:
        if not quiet:
            print(' save_movie: First pass...')
            cmdline1 = cmdline + ':vpass=1'
        subprocess.call(cmdline1.split() + ['-o', os.devnull])
        if not quiet:
            print(' save_movie: Second pass...')
        cmdline = cmdline + ':vpass=2'

    subprocess.call(cmdline.split() + ['-o', filename])

    if not preserve:
        import shutil
        shutil.rmtree(tmp_path)
    elif not quiet:
        print(' save_movie: Not deleting temporary directory: ' + tmp_path)

    if not quiet:
        print(' save_movie: Done')
Esempio n. 19
0
              0.541812420,    0.753615797,   -0.372158051,
              0.821965039,   -0.567564785,    0.047358301,
              -0.000067875,    0.000017881,  -55.406421661,
              54.029174805,   26.956727982,   77.124832153,
              2.592475891,  108.227416992,  -20.000000000))
cmd.mview()
cmd.frame(200)
cmd.scene('S1')
cmd.mview()
cmd.frame(350)
cmd.scene('S1')
cmd.set_view((0.395763457,   -0.173441306,    0.901825786,
              0.915456235,    0.152441502,   -0.372427106,
             -0.072881661,    0.972972929,    0.219108686,
              0.000070953,    0.000013039,  -37.689743042,
             57.748500824,   14.325904846,   77.241867065,
             -15.123448372,   90.511535645,  -20.000000000))

cmd.mview()
cmd.frame(351)
cmd.scene('S2')
cmd.mview()

cmd.frame(500)
cmd.scene('S2')
cmd.mview()
cmd.mplay()
cmd.mpng('p53_1tup')

cmd.quit()
Esempio n. 20
0
def mping(event):
    cmd.mpng(name_mov.get(), first=0, last=0 )
Esempio n. 21
0
def save_movie_mpeg1(filename, mode='', first=0, last=0, preserve=0,
        fps=25, twopass=1, vbitrate=16000, quiet=1, exe='mencoder'):
    '''
DESCRIPTION

    Save movie as MPEG1

    This will not be the best quality possible for the file size, but
    we were successfull to play those movies in PowerPoint.

    Requires mencoder executable from http://mplayerhq.hu

ARGUMENTS

    filename = string: Filename, should end on '.mpeg'

    mode = normal | draw | ray

    first, last = integer: first and last frame number

    preserve = 0 or 1: delete temporary images if 0 {default: 0}

    fps = integer: frames per second {default: 25}

    twopass = 0 or 1: two pass mode encoding (improves quality) {default: 1}

    vbitrate = integer: average video bitrate {default: 16000}
    WARNING: 4-16000 (in kbit), 16001-24000000 (in bit)

SEE ALSO

    cmd.movie.produce, http://www.freemol.org
    '''
    import os, subprocess, tempfile

    first, last, quiet = int(first), int(last), int(quiet)
    fps, twopass, vbitrate = int(fps), int(twopass), int(vbitrate)

    if cmd.is_string(mode):
        if mode == '':
            if cmd.pymol.invocation.options.no_gui \
                    or cmd.get_setting_boolean('ray_trace_frames'):
                mode = 'ray'
            else:
                mode = 'draw'
        mode = produce_mode_sc.auto_err(mode, 'mode')
        mode = produce_mode_dict[mode]
    mode = int(mode)

    try:
        subprocess.call([exe])
    except OSError:
        print ' Error: Cannot execute "%s"' % (exe)
        raise CmdException

    if not quiet:
        print ' save_movie: Rendering frames...'

    tmp_path = tempfile.mkdtemp()
    prefix = os.path.join(tmp_path, 'frame')
    cmd.mpng(prefix, first, last, preserve, mode=mode)

    mpeg1line = '-mf type=png:fps=%d -ovc lavc -forceidx -noskip -of rawvideo' \
            + ' -mpegopts format=mpeg1 -lavcopts vcodec=mpeg1video:vbitrate=%d' \
            + ':vhq:trell:keyint=25'
    mpeg1line = mpeg1line % (fps, vbitrate)
    cmdline = exe + ' -quiet mf://' + prefix + '* ' + mpeg1line

    if not quiet:
        print ' save_movie: Running mencoder...'

    if twopass:
        if not quiet:
            print ' save_movie: First pass...'
            cmdline1 = cmdline + ':vpass=1'
        subprocess.call(cmdline1.split() + ['-o', os.devnull])
        if not quiet:
            print ' save_movie: Second pass...'
        cmdline = cmdline + ':vpass=2'

    subprocess.call(cmdline.split() + ['-o', filename])

    if not preserve:
        import shutil
        shutil.rmtree(tmp_path)
    elif not quiet:
        print ' save_movie: Not deleting temporary directory:', tmp_path

    if not quiet:
        print ' save_movie: Done'
OUTPUT_DIR = "glycosylase_oscillation"

# Load structure and remove water
cmd.load(INPUT_STRUCTURE)

# Add secondary structure
cmd.dss()

# Define colors
cmd.set_color("biotite_lightgreen", [111 / 255, 222 / 255, 76 / 255])

# Set overall colors
cmd.color("biotite_lightgreen", "chain A")

# Set view
cmd.set_view(
    (0.605540633, 0.363677770, -0.707855821, -0.416691631, 0.902691007,
     0.107316799, 0.678002179, 0.229972601, 0.698157668, 0.000000000,
     0.000000000, -115.912551880, 32.098876953, 31.005725861, 78.377349854,
     89.280677795, 142.544403076, -20.000000000))

# Prepare output video frames
cmd.mset()
cmd.set("ray_shadows", 0)
if not isdir(OUTPUT_DIR):
    os.mkdir(OUTPUT_DIR)
cmd.mpng(join(OUTPUT_DIR, "img_"), mode=2, width=600, height=600)

# Render animated GIF
# convert -delay 3 -loop 0 -dispose 2 glycosylase_oscillation/*.png glycosylase_oscillation.gif
Esempio n. 23
0
print "render.py: session:" + session + " name: " + name
print "Session directory:" + sessiondir
print "This is renderer: " + str(renderer_num) + " Responsible for frames: " + str(start_frame) + "-" + str(end_frame)
os.chdir(sessiondir)
cmd.load(session)

### Movie commands go here.
cmd.set("cartoon_ring_mode", 3)
cmd.mset("1 x%i" %(frames))
util.mroll(1, frames, 1, 'y')
## End movie commands.

cmd.viewport("800","800")
cmd.set("hash_max", 255)
cmd.set("cache_frames", 0)
cmd.set("ray_trace_fog", 0)
cmd.set("ray_trace_frames", 1)
cmd.set("ray_shadows", 0)
cmd.set("antialias", 0)
cmd.set("auto_zoom", 0)
cmd.mclear
for frame in range(start_frame, end_frame):
    print "Rendering frame: " + str(frame)
    filename = name + str("%04d" % frame) + ".png"
    print "FILENAME: " + filename
    if not os.path.exists(filename):
        cmd.mpng(name, frame, frame)
    else:
        print str(filename) + " already exists."
    cmd.mclear
Esempio n. 24
0
print "This is renderer: " + str(
    renderer_num) + " Responsible for frames: " + str(start_frame) + "-" + str(
        end_frame)
os.chdir(sessiondir)
cmd.load(session)

### Movie commands go here.
cmd.set("cartoon_ring_mode", 3)
cmd.mset("1 x%i" % (frames))
util.mroll(1, frames, 1, 'y')
## End movie commands.

cmd.viewport("800", "800")
cmd.set("hash_max", 255)
cmd.set("cache_frames", 0)
cmd.set("ray_trace_fog", 0)
cmd.set("ray_trace_frames", 1)
cmd.set("ray_shadows", 0)
cmd.set("antialias", 0)
cmd.set("auto_zoom", 0)
cmd.mclear
for frame in range(start_frame, end_frame):
    print "Rendering frame: " + str(frame)
    filename = name + str("%04d" % frame) + ".png"
    print "FILENAME: " + filename
    if not os.path.exists(filename):
        cmd.mpng(name, frame, frame)
    else:
        print str(filename) + " already exists."
    cmd.mclear
Esempio n. 25
0
frames = int(os.environ["FRAMES"])
renderers = int(os.environ["RENDERERS"])
renderer_num = int(os.environ["PBS_ARRAYID"])
renderer_num = renderer_num - 1
print "STEP 1 open session."
cmd.load(session)
cmd.set("orthoscopic", 1)
cmd.set("ray_shadows", 1)
cmd.set("depth_cue", 1)
cmd.set("ray_trace_fog", 1)
cmd.set("antialias", 1.0)
cmd.set("cartoon_ring_mode", 3)
print "STEP 2 init movie"
cmd.mset("1 x%i" %(frames))
print "STEP 3 roll the movie."
#movie.roll(1, frames, 1, 'y')
util.mroll(1, frames, 1, 'y')
frames_per_renderer = frames / renderers
start_frame = 1 + (renderer_num * frames_per_renderer)
end_frame = start_frame + frames_per_renderer
print "TESTME FRAMES PER RENDERER: " + str(frames_per_renderer)
print "TESTME START FRAME THIS JOB: " + str(start_frame)
print "TESTME END FRAME THIS JOB: " + str(end_frame)
cmd.set("cache_frames", 0)
cmd.set("ray_trace_fog", 1)
cmd.set("ray_trace_frames", 1)
cmd.mpng(session, start_frame, end_frame)