The "Render Time Overview Tool" is a small program that calculates from the number of frames and the render time per frame how long the rendering will take. The result is a duration in hours, as well as the calculated date of completion. If a part has already been rendered, this can also be specified.
Last active
July 5, 2022 11:14
-
-
Save FabianBartl/4ca58d0cd9631ca02a7cdf66c75a521d to your computer and use it in GitHub Desktop.
RTO Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "total_frames": ["25", "50", "100", "250", "300", "500", "750", "1000", "custom"], | |
| "time_per_frame": ["5", "10", "30", "50", "60", "90", "120", "180", "custom"], | |
| "total_frames_index": 3, | |
| "rendered_frames_index": 0, | |
| "time_per_frame_index": 2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import datetime, timedelta | |
| import json | |
| from pick import pick | |
| from colorama import init, Fore, Back | |
| # init | |
| init(autoreset=False) | |
| print(f""" | |
| ┌───────────────────────────┐ | |
| │ {Fore.GREEN}R{Fore.RESET}ender {Fore.GREEN}T{Fore.RESET}ime {Fore.GREEN}O{Fore.RESET}verview Tool │ | |
| └───────────────────────────┘ | |
| """) | |
| # load config | |
| try: | |
| with open("rto_config.json", "r") as file: | |
| config = json.load(file) | |
| print(f"{Fore.BLUE}config loaded\n{Fore.RESET}") | |
| except: | |
| config = dict() | |
| config.setdefault("total_frames", ["50", "250", "500", "custom"]) | |
| config.setdefault("time_per_frame", ["30", "60", "90", "120", "custom"]) | |
| config.setdefault("total_frames_index", 1) | |
| config.setdefault("rendered_frames_index", 1) | |
| config.setdefault("time_per_frame_index", 2) | |
| # user input | |
| title = "Total frames: " | |
| option, index = pick(config["total_frames"], title, indicator="*", default_index=config["total_frames_index"]) | |
| if option == "custom": | |
| print(f"{title}{Fore.CYAN}", end="") | |
| total_frames = int(input()) | |
| else: | |
| total_frames = int(option) | |
| print(f"{title}{Fore.CYAN}{total_frames}") | |
| print(f"{Fore.RESET}", end="") | |
| title = "Already rendered frames: " | |
| option, index = pick(["yes", "no"], title, indicator="*", default_index=config["rendered_frames_index"]) | |
| if option == "yes": | |
| print(f"{title}{Fore.CYAN}", end="") | |
| rendered_frames = int(input()) | |
| else: | |
| rendered_frames = 0 | |
| print(f"{title}{Fore.CYAN}{rendered_frames}") | |
| print(f"{Fore.RESET}", end="") | |
| title = "Time per frame (sec): " | |
| option, index = pick(config["time_per_frame"], title, indicator="*", default_index=config["time_per_frame_index"]) | |
| if option == "custom": | |
| print(f"{title}{Fore.CYAN}", end="") | |
| time_per_frame = float(input()) | |
| else: | |
| time_per_frame = float(option) | |
| print(f"{title}{Fore.CYAN}{time_per_frame}") | |
| print(f"{Fore.RESET}") | |
| # calculate render time | |
| total_render_time_sec = time_per_frame * (total_frames - rendered_frames) | |
| total_render_time_hour = total_render_time_sec / 60 / 60 | |
| total_render_time = datetime.fromtimestamp(total_render_time_sec) | |
| render_date = datetime.now() + timedelta(seconds=total_render_time_sec) | |
| # colorize render time | |
| if total_render_time_hour < 24: | |
| color = Fore.GREEN | |
| elif total_render_time_hour < 48: | |
| color = Fore.YELLOW | |
| elif total_render_time_hour < 96: | |
| color = Fore.RED | |
| else: | |
| color = Back.RED + Fore.WHITE | |
| # display output | |
| print(f"Finished at: {render_date.strftime('%A, %d. %B %Y at %H:%M:%S')}") | |
| print(f"Finished in: {color}{int(total_render_time_hour)}:{total_render_time.strftime('%M:%S hours')}{Back.RESET}\n{Fore.BLUE}") | |
| input(f"Press enter to close . . . ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment