Commit a05bcfcf authored by Christopher Gearhart's avatar Christopher Gearhart

Minor bug fixes, added support for rendering animations from the LEGOizer

parent e254e5d0
......@@ -42,8 +42,8 @@ from .functions.setupServers import *
def more_menu_options(self, context):
layout = self.layout
layout.separator()
layout.operator("sendFrame", text="Render Image on Servers", icon='RENDER_STILL')
layout.operator("sendAnimation", text="Render Image on Servers", icon='RENDER_ANIMATION')
layout.operator("scene.render_frame_on_servers", text="Render Image on Servers", icon='RENDER_STILL')
layout.operator("scene.render_animation_on_servers", text="Render Image on Servers", icon='RENDER_ANIMATION')
# store keymaps here to access after registration
addon_keymaps = []
......
......@@ -126,7 +126,7 @@ def copyFiles():
writeServersFile(bpy.props.serverPrefs["servers"], scn.serverGroups)
# rsync setup files to host server ('servers.txt', 'blender_p.py', 'blender_task' module)
rsyncCommand = "rsync -qax -e 'ssh -T -oCompression=no -oStrictHostKeyChecking=no -x' --rsync-path='mkdir -p {remotePath} && rsync' '{to_host_server}/' '{login}:{remotePath}'".format(remotePath=bpy.props.serverPrefs["path"], to_host_server=os.path.join(getLibraryPath(), "to_host_server"), login=bpy.props.serverPrefs["login"])
rsyncCommand = "rsync -qax -e 'ssh -T -oCompression=no -oStrictHostKeyChecking=no -x' --exclude='*.zip' --rsync-path='mkdir -p {remotePath} && rsync' '{to_host_server}/' '{login}:{remotePath}'".format(remotePath=bpy.props.serverPrefs["path"], to_host_server=os.path.join(getLibraryPath(), "to_host_server"), login=bpy.props.serverPrefs["login"])
process = subprocess.Popen(rsyncCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
return process
......
......@@ -58,7 +58,7 @@ cgearhar
### BEGIN HOST SERVER ###
john
matt
### END HOST SERVER ###
......
......@@ -22,6 +22,7 @@ Created by Christopher Gearhart
# system imports
import bpy
import random
from bpy.app.handlers import persistent
randomSeed = random.randint(1, 10000)
......@@ -35,3 +36,22 @@ for scene in bpy.data.scenes:
scene.render.use_overwrite = True
if scene.cycles.film_transparent:
scene.render.image_settings.color_mode = 'RGBA'
""" SUPPORT FOR THE LEGOIZER BELOW """
@persistent
def handle_legoizer_animation(scene):
scn = scene
groupsToAdjust = []
for group in bpy.data.groups:
if group.name.startswith("LEGOizer_") and "_bricks_frame_" in group.name:
groupsToAdjust.append(group)
for group in groupsToAdjust:
frame = int(group.name[(group.name.index("_bricks_frame_") + 14):])
onCurF = frame == scn.frame_current
brick = group.objects[0]
if brick.hide == onCurF:
brick.hide = not onCurF
brick.hide_render = not onCurF
bpy.app.handlers.render_pre.append(handle_legoizer_animation)
......@@ -31,12 +31,13 @@ from multiprocessing import Process
class JobHost(threading.Thread):
""" Write tooltip here """
def __init__(self, hostname, jobs_list=None, thread_func=None, kwargs=None, callback=None, timeout=.01, verbose=0, error_callback=None, max_on_host=4, cleanup_when_done=False):
def __init__(self, hostname, jobs_list=None, thread_func=None, kwargs=None, callback=None, timeout=.01, print_connection_issue=False, verbose=0, error_callback=None, max_on_host=4, cleanup_when_done=False):
super(JobHost, self).__init__()
self.verbose = verbose
self.timeout = timeout
self.firstTime = True
self.cleanup_when_done=cleanup_when_done
self.print_connection_issue = print_connection_issue
# The name of the host this object represents
self.hostname = hostname
......@@ -211,7 +212,7 @@ class JobHost(threading.Thread):
self.reachable = True
return True
except Exception as e:
if self.verbose >= 1:
if self.verbose >= 1 and self.print_connection_issue:
print("Encountered following error connecting to '" + str(self.hostname) + "': " + str(e))
if self.reachable:
self.reachable_change = True
......
......@@ -91,7 +91,7 @@ def main():
max_server_load = int(args.max_server_load)
for host in hosts:
jh = JobHost(hostname=host, timeout=float(args.connection_timeout), thread_func=start_tasks, verbose=verbose, max_on_host=max_server_load)
jh = JobHost(hostname=host, timeout=float(args.connection_timeout), thread_func=start_tasks, verbose=verbose, print_connection_issue=args.hosts_online, max_on_host=max_server_load)
if jh.is_reachable():
hosts_online.append(str(host))
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment