Newer
Older
doRefresh(self)
self.report(set(['INFO']), 'Session ' + s.title + ' with id ' + str(s.id) + ' cancelled')
except xmlrpc.client.Error as v:
self.report(set(['ERROR']), 'Could not cancel session ' + s.title + ' with id ' + str(s.id))
print(v)
bpy.cancelError = True
bpy.errorStartTime = time.time()
return {'FINISHED'}
class ORE_GetCompletedSessions(bpy.types.Operator):
bl_idname = 'ore.completed_sessions'
def execute(self, context):
sce = context.scene
ore = sce.ore_render
bpy.queue_selected = 1
bpy.ore_active_session_queue = bpy.ore_completed_sessions
updateSessionList(completed_sessions, ore)
return {'FINISHED'}
class ORE_GetCancelledSessions(bpy.types.Operator):
bl_idname = 'ore.cancelled_sessions'
def execute(self, context):
sce = context.scene
ore = sce.ore_render
bpy.queue_selected = 4
bpy.ore_active_session_queue = bpy.ore_cancelled_sessions
updateSessionList(cancelled_sessions, ore)
return {'FINISHED'}
class ORE_GetActiveSessions(bpy.types.Operator):
bl_idname = 'ore.active_sessions'
def execute(self, context):
sce = context.scene
ore = sce.ore_render
bpy.queue_selected = 2
bpy.ore_active_session_queue = bpy.ore_active_sessions
updateSessionList(active_sessions, ore)
return {'FINISHED'}
class ORE_GetPendingSessions(bpy.types.Operator):
bl_idname = 'ore.accept_sessions' # using ORE lingo in API. acceptQueue is session waiting for admin approval
def execute(self, context):
sce = context.scene
ore = sce.ore_render
bpy.queue_selected = 3
bpy.ore_active_session_queue = bpy.ore_pending_sessions
updateSessionList(pending_sessions, ore)
return {'FINISHED'}
class ORE_CheckUpdate(bpy.types.Operator):
bl_idname = 'ore.check_update'
bl_label = 'Check for a new version'
blenderproxy = xmlrpc.client.ServerProxy(r'http://xmlrpc.renderfarm.fi/renderfarmfi/blender', verbose=DEV)
try:
self.report(set(['INFO']), 'Checking for newer version on Renderfarm.fi')
dl_url = blenderproxy.blender.getCurrentVersion(bpy.CURRENT_VERSION)
if len(dl_url['url']) > 0:
self.report(set(['INFO']), 'Found a newer version on Renderfarm.fi ' + dl_url['url'])
bpy.download_location = dl_url['url']
bpy.found_newer_version = True
else:
bpy.up_to_date = True
self.report(set(['INFO']), 'Done checking for newer version on Renderfarm.fi')
except xmlrpc.client.Fault as f:
print('ERROR:', f)
self.report(set(['ERROR']), 'An error occurred while checking for newer version on Renderfarm.fi: ' + f.faultString)
except xmlrpc.client.ProtocolError as e:
print('ERROR:', e)
self.report(set(['ERROR']), 'An HTTP error occurred while checking for newer version on Renderfarm.fi: ' + str(e.errcode) + ' ' + e.errmsg)
return {'FINISHED'}
class ORE_LoginOp(bpy.types.Operator):
bl_idname = 'ore.login'
def execute(self, context):
sce = context.scene
ore = sce.ore_render
ore.password = ore.password.strip()
ore.username = ore.username.strip()
if ore.hash=='':
if ore.password != '' and ore.username != '':
ore.hash = hashlib.md5(ore.password.encode() + ore.username.encode()).hexdigest()
ore.password = ''
doRefresh(self, True)
ore.passwordCorrect = True
ore.loginInserted = True
except xmlrpc.client.Error as v:
bpy.ready = False
ore.loginInserted = False
ore.passwordCorrect = False
ore.hash = ''
ore.password = ''
self.report({'WARNING'}, "Incorrect login: " + v.faultString)
return {'CANCELLED'}
return {'FINISHED'}
class ORE_ResetOp(bpy.types.Operator):
bl_idname = "ore.reset"
bl_label = "Reset Preparation"
def execute(self, context):
sce = context.scene
ore = sce.ore_render
ore.prepared = False
ore.loginInserted = False
bpy.prepared = False
ore.hash = ''
ore.username = ''
ore.passowrd = ''
ore.longdesc = ''
ore.shortdesc = '-'
ore.tags = ''
ore.title = ''
ore.url = ''
return {'FINISHED'}
class ORE_TestRenderOp(bpy.types.Operator):
bl_idname = "ore.test_render"
bl_label = "Run a test render"
def execute(self, context):
rd = context.scene.render
rd.engine = 'BLENDER_RENDER'
rd.threads_mode = 'AUTO'
rd.threads = 1
bpy.ops.render.render()
rd.threads_mode = 'FIXED'
rd.threads = 1
rd.engine = 'RENDERFARMFI_RENDER'
return {'FINISHED'}
class ORE_UploaderOp(bpy.types.Operator):
bl_idname = "ore.upload"
bl_label = "Render on Renderfarm.fi"
def execute(self, context):
prepareScene()
returnValue = ore_upload(self, context)
bpy.uploadInProgress = False
return returnValue
class ORE_UseBlenderReso(bpy.types.Operator):
bl_idname = "ore.use_scene_settings"
bl_label = "Use Scene settings"
def execute(self, context):
sce = context.scene
ore = sce.ore_render
rd = context.scene.render
ore.resox = rd.resolution_x
ore.resoy = rd.resolution_y
ore.start = sce.frame_start
ore.end = sce.frame_end
ore.fps = rd.fps
class ORE_UseCyclesRender(bpy.types.Operator):
bl_idname = "ore.use_cycles_render"
bl_label = "Cycles"
def execute(self, context):
context.scene.ore_render.engine = 'cycles'
return {'FINISHED'}
class ORE_UseBlenderRender(bpy.types.Operator):
bl_idname = "ore.use_blender_render"
bl_label = "Blender Internal"
def execute(self, context):
context.scene.ore_render.engine = 'blender'
return {'FINISHED'}
class ORE_ChangeUser(bpy.types.Operator):
bl_idname = "ore.change_user"
bl_label = "Change user"
def execute(self, context):
ore = context.scene.ore_render
ore.password = ''
ore.hash = ''
ore.passwordCorrect = False
ore.loginInserted = False
return {'FINISHED'}
class RenderfarmFi(bpy.types.RenderEngine):
bl_idname = 'RENDERFARMFI_RENDER'
bl_label = "Renderfarm.fi"
def render(self, scene):
print('Do test renders with Blender Render')
#~ def menu_export(self, context):
#~ import os
#~ default_path = os.path.splitext(bpy.data.filepath)[0] + ".py"
#~ self.layout.operator(RenderfarmFi.bl_idname, text=RenderfarmFi.bl_label)
Campbell Barton
committed
bpy.utils.register_module(__name__)
bpy.types.Scene.ore_render = PointerProperty(type=ORESettings, name='ORE Render', description='ORE Render Settings')
Campbell Barton
committed
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()