Commit f6d40588 authored by bblanimation's avatar bblanimation

Bug fixes

parent 57cb8f50
No preview for this file type
......@@ -2,3 +2,5 @@ __pycache__/
.DS_Store
servers.txt
to_host_server/blender_task.zip
testing/
error_log/
......@@ -39,7 +39,7 @@ import bpy
from bpy.types import Operator
from bpy.props import *
#Rebrickr imports
# Render Farm imports
from .ui import *
from .buttons import *
from .functions.setupServers import *
......@@ -50,13 +50,16 @@ addon_keymaps = []
def more_menu_options(self, context):
layout = self.layout
layout.separator()
layout.operator("scene.render_frame_on_servers", text="Render Image on Servers", icon='RENDER_STILL')
layout.operator("scene.render_animation_on_servers", text="Render Animation on Servers", icon='RENDER_ANIMATION')
layout.operator("render_farm.render_frame_on_servers", text="Render Image on Servers", icon='RENDER_STILL')
layout.operator("render_farm.render_animation_on_servers", text="Render Animation on Servers", icon='RENDER_ANIMATION')
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_render.append(more_menu_options)
bpy.props.render_farm_module_name = __name__
bpy.props.render_farm_version = str(bl_info["version"])[1:-1].replace(", ", ".")
bpy.types.Scene.showAdvanced = BoolProperty(
name="Show Advanced",
description="Display advanced remote server settings",
......@@ -152,14 +155,14 @@ def register():
kc = wm.keyconfigs.addon
if kc:
km = kc.keymaps.new(name='Object Mode', space_type='EMPTY')
kmi = km.keymap_items.new("scene.render_frame_on_servers", 'F12', 'PRESS', alt=True)
kmi = km.keymap_items.new("scene.render_animation_on_servers", 'F12', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("scene.open_rendered_image", 'O', 'PRESS', shift=True)
kmi = km.keymap_items.new("scene.open_rendered_animation", 'O', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("scene.list_frames", 'M', 'PRESS', shift=True)
kmi = km.keymap_items.new("scene.set_to_missing_frames", 'M', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("scene.refresh_num_available_servers", 'R', 'PRESS', ctrl=True)
kmi = km.keymap_items.new("scene.edit_servers_dict", 'E', 'PRESS', ctrl=True)
kmi = km.keymap_items.new("render_farm.render_frame_on_servers", 'F12', 'PRESS', alt=True)
kmi = km.keymap_items.new("render_farm.render_animation_on_servers", 'F12', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("render_farm.open_rendered_image", 'O', 'PRESS', shift=True)
kmi = km.keymap_items.new("render_farm.open_rendered_animation", 'O', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("render_farm.list_frames", 'M', 'PRESS', shift=True)
kmi = km.keymap_items.new("render_farm.set_to_missing_frames", 'M', 'PRESS', alt=True, shift=True)
kmi = km.keymap_items.new("render_farm.refresh_num_available_servers", 'R', 'PRESS', ctrl=True)
kmi = km.keymap_items.new("render_farm.edit_servers_dict", 'E', 'PRESS', ctrl=True)
addon_keymaps.append(km)
def unregister():
......
......@@ -19,4 +19,4 @@ Created by Christopher Gearhart
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
__all__ = ["editRemoteServersDict", "missingFramesActions", "openRenderInUI", "refreshNumAvailableServers", "sendAnimation", "sendFrame"]
__all__ = ["editRemoteServersDict", "missingFramesActions", "openRenderInUI", "refreshNumAvailableServers", "reportError", "sendAnimation", "sendFrame"]
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class editRemoteServersDict(Operator):
"""Edit the remote servers dictionary in a text editor""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.edit_servers_dict" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.edit_servers_dict" # unique identifier for buttons and menu items to reference.
bl_label = "Edit Remote Servers" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class listMissingFrames(Operator):
"""List the output files missing from the render dump folder""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.list_frames" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.list_frames" # unique identifier for buttons and menu items to reference.
bl_label = "List Missing Frames" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -56,23 +56,13 @@ class listMissingFrames(Operator):
return{"FINISHED"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
class setToMissingFrames(Operator):
"""Set frame range to frames missing from the render dump folder""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.set_to_missing_frames" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.set_to_missing_frames" # unique identifier for buttons and menu items to reference.
bl_label = "Set to Missing Frames" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -89,16 +79,5 @@ class setToMissingFrames(Operator):
return{"FINISHED"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class openRenderedImageInUI(Operator):
"""Open rendered image""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.open_rendered_image" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.open_rendered_image" # unique identifier for buttons and menu items to reference.
bl_label = "Open Rendered Image" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -56,24 +56,13 @@ class openRenderedImageInUI(Operator):
return{"FINISHED"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
class openRenderedAnimationInUI(Operator):
"""Open rendered animation""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.open_rendered_animation" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.open_rendered_animation" # unique identifier for buttons and menu items to reference.
bl_label = "Open Rendered Animation" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -105,16 +94,5 @@ class openRenderedAnimationInUI(Operator):
return{"FINISHED"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class refreshNumAvailableServers(Operator):
"""Attempt to connect to all servers through host server""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.refresh_num_available_servers" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.refresh_num_available_servers" # unique identifier for buttons and menu items to reference.
bl_label = "Refresh Available Servers" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -124,7 +124,7 @@ class refreshNumAvailableServers(Operator):
return{"PASS_THROUGH"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def execute(self, context):
......@@ -155,20 +155,9 @@ class refreshNumAvailableServers(Operator):
return{"RUNNING_MODAL"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
def cancel(self, context):
wm = context.window_manager
wm.event_timer_remove(self._timer)
......
"""
Copyright (C) 2017 Bricks Brought to Life
http://bblanimation.com/
chris@bblanimation.com
Created by Christopher Gearhart
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
# System imports
import time
import os
# Blender imports
import bpy
props = bpy.props
# Render Farm imports
from ..functions import *
class reportError(bpy.types.Operator):
"""Report a bug via an automatically generated issue ticket"""
bl_idname = "render_farm.report_error"
bl_label = "Report Error"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
try:
# set up file paths
libraryServersPath = os.path.join(getLibraryPath(), "error_log")
# write necessary debugging information to text file
writeErrorToFile(libraryServersPath, 'Render_Farm_log', bpy.props.render_farm_version)
# open error report in UI with text editor
changeContext(context, "TEXT_EDITOR")
try:
bpy.ops.text.open(filepath=os.path.join(libraryServersPath, "Render_Farm_error_report.txt"))
bpy.context.space_data.show_word_wrap = True
self.report({"INFO"}, "Opened 'Render_Farm_error_report.txt'")
bpy.props.needsUpdating = True
except:
self.report({"ERROR"}, "ERROR: Could not open 'Render_Farm_error_report.txt'. If the problem persists, try reinstalling the add-on.")
except:
self.report({"ERROR"}, "ERROR: Could not generate error report. Please use the 'Report a Bug' button in the Render Farm Preferences (found in Add-On User Preferences)")
return{"FINISHED"}
class closeReportError(bpy.types.Operator):
"""Deletes error report from blender's memory (still exists in file system)"""
bl_idname = "render_farm.close_report_error"
bl_label = "Close Report Error"
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
def execute(self, context):
try:
txt = bpy.data.texts['Render_Farm_log']
bpy.data.texts.remove(txt, True)
except:
handle_exception()
return{"FINISHED"}
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class sendAnimation(Operator):
"""Render animation on remote servers""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.render_animation_on_servers" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.render_animation_on_servers" # unique identifier for buttons and menu items to reference.
bl_label = "Render Animation" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -179,7 +179,7 @@ class sendAnimation(Operator):
return{"PASS_THROUGH"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def execute(self, context):
......@@ -252,20 +252,9 @@ class sendAnimation(Operator):
return{"RUNNING_MODAL"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
def cancel(self, context):
print("process cancelled")
cleanupCancelledRender(self, context, bpy.types.Scene.killPython)
......@@ -35,7 +35,7 @@ from ..functions.jobIsValid import *
class sendFrame(Operator):
"""Render current frame on remote servers""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "scene.render_frame_on_servers" # unique identifier for buttons and menu items to reference.
bl_idname = "render_farm.render_frame_on_servers" # unique identifier for buttons and menu items to reference.
bl_label = "Render Current Frame" # display name in the interface.
bl_options = {"REGISTER", "UNDO"} # enable undo for the operator.
......@@ -211,7 +211,7 @@ class sendFrame(Operator):
return{"PASS_THROUGH"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def execute(self, context):
......@@ -286,20 +286,9 @@ class sendFrame(Operator):
return{"RUNNING_MODAL"}
except:
self.handle_exception()
handle_exception()
return{"CANCELLED"}
def handle_exception(self):
errormsg = print_exception('LEGOizer_log')
# if max number of exceptions occur within threshold of time, abort!
curtime = time.time()
print('\n'*5)
print('-'*100)
print("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)")
print('-'*100)
print('\n'*5)
showErrorMessage("Something went wrong. Please start an error report with us so we can fix it! (press the 'Report a Bug' button under the 'Render on Servers' dropdown menu of the Render Farm Client)", wrap=240)
def cancel(self, context):
print("process cancelled")
cleanupCancelledRender(self, context, bpy.types.Scene.killPython)
......@@ -28,7 +28,7 @@ import os
import subprocess
import sys
from .setupServers import *
from .common_functions import *
from .common import *
try:
import httplib
except:
......@@ -73,9 +73,10 @@ def getFrames(projectName, archiveFiles=False, frameRange=False):
f.close()
else:
includeDict = ""
archiveRsyncCommand = "rsync -aqx --rsync-path='mkdir -p {dumpLocation}/backups/ && rsync' --remove-source-files {includeDict} --exclude='{nameOutputFiles}_????.???' --exclude='backups/' '{dumpLocation}/' '{dumpLocation}/backups/';".format(includeDict=includeDict, dumpLocation=dumpLocation, nameOutputFiles=getNameOutputFiles(), imExtension=bpy.props.imExtension)
archiveRsyncCommand = "rsync -aqx --rsync-path='mkdir -p {dumpLocation}/backups/ && rsync' --remove-source-files {includeDict} --exclude='{nameOutputFiles}_????.???' --exclude='backups/' '{dumpLocation}/' '{dumpLocation}/backups/';".format(includeDict=includeDict, dumpLocation=dumpLocation.replace(" ", "\\ "), nameOutputFiles=getNameOutputFiles(), imExtension=bpy.props.imExtension)
else:
archiveRsyncCommand = "mkdir -p {dumpLocation};".format(dumpLocation=dumpLocation)
archiveRsyncCommand = "mkdir -p {dumpLocation};".format(dumpLocation=dumpLocation.replace(" ", "\\ "))
print(archiveRsyncCommand)
# rsync files from host server to local directory
fetchRsyncCommand = "rsync -ax --progress --remove-source-files --exclude='*.blend' --exclude='*_average.???' -e 'ssh -T -oCompression=no -oStrictHostKeyChecking=no -x' '{login}:{remotePath}{projectName}/results/' '{dumpLocation}/';".format(login=bpy.props.serverPrefs["login"], remotePath=bpy.props.serverPrefs["path"], projectName=projectName, dumpLocation=dumpLocation)
......
......@@ -26,14 +26,14 @@ from bpy.app.handlers import persistent
scn = bpy.context.scene
""" BEGIN SUPPORT FOR THE LEGOIZER """
""" BEGIN SUPPORT FOR REBRICKR """
@persistent
def handle_legoizer_animation(scene):
print("Adjusting frame")
groupsToAdjust = {}
for group in bpy.data.groups:
if group.name.startswith("LEGOizer_") and "_bricks_frame_" in group.name:
if group.name.startswith("Rebrickr") and "_bricks_frame_" in group.name:
sourceName = group.name[9:(group.name.index("_bricks_frame_"))]
if sourceName not in groupsToAdjust.keys():
groupsToAdjust[sourceName] = [group.name]
......@@ -57,7 +57,7 @@ handle_legoizer_animation(scn)
bpy.app.handlers.render_pre.append(handle_legoizer_animation)
bpy.app.handlers.frame_change_pre.append(handle_legoizer_animation)
""" END SUPPORT FOR THE LEGOIZER """
""" END SUPPORT FOR REBRICKR """
randomSeed = random.randint(1, 10000)
for scene in bpy.data.scenes:
......
......@@ -52,14 +52,14 @@ class renderOnServersPanel(Panel):
col = layout.column(align=True)
row = col.row(align=True)
availableServerString = "Available Servers: {available} / {total}".format(available=str(scn.availableServers),total=str(scn.availableServers + scn.offlineServers))
row.operator("scene.refresh_num_available_servers", text=availableServerString, icon="FILE_REFRESH")
row.operator("render_farm.refresh_num_available_servers", text=availableServerString, icon="FILE_REFRESH")
# Render Buttons
row = col.row(align=True)
row.alignment = "EXPAND"
row.active = scn.availableServers > 0 or not scn.render.engine == "CYCLES"
row.operator("scene.render_frame_on_servers", text="Render", icon="RENDER_STILL")
row.operator("scene.render_animation_on_servers", text="Animation", icon="RENDER_ANIMATION")
row.operator("render_farm.render_frame_on_servers", text="Render", icon="RENDER_STILL")
row.operator("render_farm.render_animation_on_servers", text="Animation", icon="RENDER_ANIMATION")
col = layout.column(align=True)
row = col.row(align=True)
row.prop(scn, "serverGroups")
......@@ -77,9 +77,19 @@ class renderOnServersPanel(Panel):
# display buttons to view render(s)
row = layout.row(align=True)
if "image" in scn.renderType:
row.operator("scene.open_rendered_image", text="View Image", icon="FILE_IMAGE")
row.operator("render_farm.open_rendered_image", text="View Image", icon="FILE_IMAGE")
if "animation" in scn.renderType:
row.operator("scene.open_rendered_animation", text="View Animation", icon="FILE_MOVIE")
row.operator("render_farm.open_rendered_animation", text="View Animation", icon="FILE_MOVIE")
if bpy.data.texts.find('Render_Farm_log') >= 0:
split = layout.split(align=True, percentage=0.9)
col = split.column(align=True)
row = col.row(align=True)
row.operator("render_farm.report_error", text="Report Error", icon="URL")
col = split.column(align=True)
row = col.row(align=True)
row.operator("render_farm.close_report_error", text="", icon="PANEL_CLOSE")
class frameRangePanel(Panel):
bl_space_type = "VIEW_3D"
......@@ -100,9 +110,9 @@ class frameRangePanel(Panel):
col = layout.column(align=True)
col.active = bpy.path.display_name_from_filepath(bpy.data.filepath) != ""
row = col.row(align=True)
row.operator("scene.list_frames", text="List Missing Frames", icon="LONGDISPLAY")
row.operator("render_farm.list_frames", text="List Missing Frames", icon="LONGDISPLAY")
row = col.row(align=True)
row.operator("scene.set_to_missing_frames", text="Set to Missing Frames", icon="FILE_PARENT")
row.operator("render_farm.set_to_missing_frames", text="Set to Missing Frames", icon="FILE_PARENT")
class serversPanel(Panel):
bl_space_type = "VIEW_3D"
......@@ -120,7 +130,7 @@ class serversPanel(Panel):
col = layout.column(align=True)
row = col.row(align=True)
row.operator("scene.edit_servers_dict", text="Edit Remote Servers", icon="TEXT")
row.operator("render_farm.edit_servers_dict", text="Edit Remote Servers", icon="TEXT")
col = layout.column(align=True)
row = col.row(align=True)
......
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