Beispiel #1
0
    def _check_in_png(my, snapshot, sobject, render, pat, final_pat,
                      render_dir, filenames):
        icon_path = final_path = ''
        icon_creator = None

        file_range = my.render_context.get_frame_range()

        for name in filenames:
            if pat.match(name):
                final_name = pat.sub(final_pat, name)
                shutil.move(render_dir + "/" + name,
                            render_dir + "/" + final_name)
                final_path = "%s/%s" % (render_dir, final_name)
                icon_creator = IconCreator(final_path)
                icon_creator.create_icons()
        if icon_creator:
            icon_path = icon_creator.get_icon_path()
        gen_icon_path = re.sub("(.*_icon\.)(\d{4})(\.png)", r"\1####\3",
                               icon_path)
        gen_final_path = re.sub("(.*\.)(\d{4})(\.png)", r"\1####\3",
                                final_path)
        types = ["main", "icon"]
        paths = [gen_final_path, gen_icon_path]

        # check that all the files exist
        try:
            for path in paths:
                FileGroup.check_paths(path, file_range)
        except FileException, e:
            print( "The frame range of layer [%s] probably\
                does not match the shot's frame range [%s]. %s" \
                %(sobject.get_value('name'), file_range.get_key(), e))

            # FIXME: this is a little redundant, but it works
            count = 0
            file_paths = FileGroup.expand_paths(paths[0], file_range)
            for file_path in file_paths:
                if not os.path.exists(file_path):
                    break
                count += 1
            file_range.frame_end = count
Beispiel #2
0
    def _check_in_png(my, snapshot, sobject, render, pat, final_pat, render_dir, filenames):
        icon_path = final_path = ''
        icon_creator = None

        file_range = my.render_context.get_frame_range()
        
        for name in filenames:
            if pat.match(name):
                final_name = pat.sub(final_pat, name)
                shutil.move(render_dir + "/" + name, render_dir + "/" + final_name)
                final_path = "%s/%s" % (render_dir, final_name)
                icon_creator = IconCreator(final_path)
                icon_creator.create_icons()
        if icon_creator:
            icon_path = icon_creator.get_icon_path()
        gen_icon_path = re.sub("(.*_icon\.)(\d{4})(\.png)", r"\1####\3", icon_path) 
        gen_final_path = re.sub("(.*\.)(\d{4})(\.png)", r"\1####\3", final_path)  
        types = ["main", "icon"]
        paths = [gen_final_path, gen_icon_path]
        
        # check that all the files exist
        try:
            for path in paths:
                FileGroup.check_paths(path, file_range)    
        except FileException, e:
            print( "The frame range of layer [%s] probably\
                does not match the shot's frame range [%s]. %s" \
                %(sobject.get_value('name'), file_range.get_key(), e))
           
            # FIXME: this is a little redundant, but it works
            count = 0
            file_paths = FileGroup.expand_paths(paths[0], file_range)
            for file_path in file_paths:
                if not os.path.exists(file_path):
                    break
                count += 1
            file_range.frame_end = count