2009-11-01 15:21:20 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# 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 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2009-12-29 00:04:57 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# 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.
|
2009-12-29 00:04:57 +00:00
|
|
|
#
|
2009-11-01 15:21:20 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-11-01 15:21:20 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
2009-08-29 17:25:22 +00:00
|
|
|
import bpy
|
|
|
|
import sys, os
|
2009-09-15 19:53:18 +00:00
|
|
|
import http, http.client, http.server, urllib, socket
|
2009-09-26 19:50:59 +00:00
|
|
|
import webbrowser
|
2009-08-29 17:25:22 +00:00
|
|
|
|
2009-11-18 18:00:46 +00:00
|
|
|
import netrender
|
2009-08-29 17:25:22 +00:00
|
|
|
from netrender.utils import *
|
2009-09-09 02:25:14 +00:00
|
|
|
import netrender.client as client
|
2009-08-29 17:25:22 +00:00
|
|
|
import netrender.model
|
|
|
|
|
2009-12-04 01:28:00 +00:00
|
|
|
class RENDER_OT_netslave_bake(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''NEED DESCRIPTION'''
|
|
|
|
bl_idname = "render.netslavebake"
|
|
|
|
bl_label = "Bake all in file"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
scene = context.scene
|
|
|
|
netsettings = scene.network_render
|
|
|
|
|
2010-06-02 17:58:28 +00:00
|
|
|
filename = bpy.data.filepath
|
2009-12-29 00:04:57 +00:00
|
|
|
path, name = os.path.split(filename)
|
|
|
|
root, ext = os.path.splitext(name)
|
|
|
|
default_path = path + os.sep + "blendcache_" + root + os.sep # need an API call for that
|
|
|
|
relative_path = os.sep + os.sep + "blendcache_" + root + os.sep
|
|
|
|
|
|
|
|
# Force all point cache next to the blend file
|
|
|
|
for object in bpy.data.objects:
|
|
|
|
for modifier in object.modifiers:
|
|
|
|
if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
|
|
|
|
modifier.settings.path = relative_path
|
|
|
|
bpy.ops.fluid.bake({"active_object": object, "scene": scene})
|
|
|
|
elif modifier.type == "CLOTH":
|
2010-08-19 12:51:31 +00:00
|
|
|
modifier.point_cache.frame_step = 1
|
|
|
|
modifier.point_cache.use_disk_cache = True
|
|
|
|
modifier.point_cache.use_external = False
|
2009-12-29 00:04:57 +00:00
|
|
|
elif modifier.type == "SOFT_BODY":
|
2010-08-19 12:51:31 +00:00
|
|
|
modifier.point_cache.frame_step = 1
|
|
|
|
modifier.point_cache.use_disk_cache = True
|
|
|
|
modifier.point_cache.use_external = False
|
2009-12-29 00:04:57 +00:00
|
|
|
elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
|
2010-08-19 12:51:31 +00:00
|
|
|
modifier.domain_settings.point_cache_low.use_step = 1
|
|
|
|
modifier.domain_settings.point_cache_low.use_disk_cache = True
|
|
|
|
modifier.domain_settings.point_cache_low.use_external = False
|
|
|
|
modifier.domain_settings.point_cache_high.use_step = 1
|
|
|
|
modifier.domain_settings.point_cache_high.use_disk_cache = True
|
|
|
|
modifier.domain_settings.point_cache_high.use_external = False
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
# particles modifier are stupid and don't contain data
|
|
|
|
# we have to go through the object property
|
|
|
|
for psys in object.particle_systems:
|
2010-08-19 12:51:31 +00:00
|
|
|
psys.point_cache.use_step = 1
|
|
|
|
psys.point_cache.use_disk_cache = True
|
|
|
|
psys.point_cache.use_external = False
|
2009-12-29 00:04:57 +00:00
|
|
|
psys.point_cache.filepath = relative_path
|
|
|
|
|
|
|
|
bpy.ops.ptcache.bake_all()
|
|
|
|
|
2010-06-14 03:52:10 +00:00
|
|
|
#bpy.ops.wm.save_mainfile(filepath = path + os.sep + root + "_baked.blend")
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
|
|
|
|
2009-09-14 16:30:53 +00:00
|
|
|
class RENDER_OT_netclientanim(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Start rendering an animation on network'''
|
|
|
|
bl_idname = "render.netclientanim"
|
|
|
|
bl_label = "Animation on network"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
scene = context.scene
|
|
|
|
netsettings = scene.network_render
|
|
|
|
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
# Sending file
|
|
|
|
scene.network_render.job_id = client.clientSendJob(conn, scene, True)
|
|
|
|
conn.close()
|
|
|
|
|
2010-03-12 03:12:27 +00:00
|
|
|
bpy.ops.render.render('INVOKE_AREA', animation=True)
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-09-14 16:30:53 +00:00
|
|
|
|
2010-01-05 20:47:23 +00:00
|
|
|
class RENDER_OT_netclientrun(bpy.types.Operator):
|
|
|
|
'''Start network rendering service'''
|
|
|
|
bl_idname = "render.netclientstart"
|
|
|
|
bl_label = "Start Service"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2010-01-05 20:47:23 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
2010-03-12 03:12:27 +00:00
|
|
|
bpy.ops.render.render('INVOKE_AREA', animation=True)
|
2010-01-05 20:47:23 +00:00
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
|
|
|
|
2009-08-29 17:25:22 +00:00
|
|
|
class RENDER_OT_netclientsend(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Send Render Job to the Network'''
|
|
|
|
bl_idname = "render.netclientsend"
|
|
|
|
bl_label = "Send job"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
scene = context.scene
|
|
|
|
netsettings = scene.network_render
|
|
|
|
|
|
|
|
try:
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
# Sending file
|
|
|
|
scene.network_render.job_id = client.clientSendJob(conn, scene, True)
|
|
|
|
conn.close()
|
|
|
|
self.report('INFO', "Job sent to master")
|
|
|
|
except Exception as err:
|
|
|
|
self.report('ERROR', str(err))
|
2010-05-01 20:39:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
|
|
|
|
|
|
|
class RENDER_OT_netclientsendframe(bpy.types.Operator):
|
|
|
|
'''Send Render Job with current frame to the Network'''
|
|
|
|
bl_idname = "render.netclientsendframe"
|
|
|
|
bl_label = "Send current frame job"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2010-05-01 20:39:04 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
scene = context.scene
|
|
|
|
netsettings = scene.network_render
|
|
|
|
|
|
|
|
try:
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
# Sending file
|
|
|
|
scene.network_render.job_id = client.clientSendJob(conn, scene, False)
|
|
|
|
conn.close()
|
|
|
|
self.report('INFO', "Job sent to master")
|
|
|
|
except Exception as err:
|
|
|
|
self.report('ERROR', str(err))
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-08-29 17:25:22 +00:00
|
|
|
|
|
|
|
class RENDER_OT_netclientstatus(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Refresh the status of the current jobs'''
|
|
|
|
bl_idname = "render.netclientstatus"
|
|
|
|
bl_label = "Client Status"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
conn.request("GET", "/status")
|
|
|
|
|
|
|
|
response = conn.getresponse()
|
2010-08-14 16:30:41 +00:00
|
|
|
response.read()
|
2009-12-29 00:04:57 +00:00
|
|
|
print( response.status, response.reason )
|
|
|
|
|
|
|
|
jobs = (netrender.model.RenderJob.materialize(j) for j in eval(str(response.read(), encoding='utf8')))
|
|
|
|
|
|
|
|
while(len(netsettings.jobs) > 0):
|
|
|
|
netsettings.jobs.remove(0)
|
|
|
|
|
|
|
|
netrender.jobs = []
|
|
|
|
|
|
|
|
for j in jobs:
|
|
|
|
netrender.jobs.append(j)
|
|
|
|
netsettings.jobs.add()
|
|
|
|
job = netsettings.jobs[-1]
|
|
|
|
|
|
|
|
j.results = j.framesStatus() # cache frame status
|
|
|
|
|
|
|
|
job.name = j.name
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-08-29 17:25:22 +00:00
|
|
|
|
|
|
|
class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Operator documentation text, will be used for the operator tooltip and python docs.'''
|
|
|
|
bl_idname = "render.netclientblacklistslave"
|
|
|
|
bl_label = "Client Blacklist Slave"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
|
|
|
|
if netsettings.active_slave_index >= 0:
|
|
|
|
|
|
|
|
# deal with data
|
|
|
|
slave = netrender.slaves.pop(netsettings.active_slave_index)
|
|
|
|
netrender.blacklist.append(slave)
|
|
|
|
|
|
|
|
# deal with rna
|
|
|
|
netsettings.slaves_blacklist.add()
|
|
|
|
netsettings.slaves_blacklist[-1].name = slave.name
|
|
|
|
|
|
|
|
netsettings.slaves.remove(netsettings.active_slave_index)
|
|
|
|
netsettings.active_slave_index = -1
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-08-29 17:25:22 +00:00
|
|
|
|
|
|
|
class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Operator documentation text, will be used for the operator tooltip and python docs.'''
|
|
|
|
bl_idname = "render.netclientwhitelistslave"
|
|
|
|
bl_label = "Client Whitelist Slave"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
|
|
|
|
if netsettings.active_blacklisted_slave_index >= 0:
|
|
|
|
|
|
|
|
# deal with data
|
|
|
|
slave = netrender.blacklist.pop(netsettings.active_blacklisted_slave_index)
|
|
|
|
netrender.slaves.append(slave)
|
|
|
|
|
|
|
|
# deal with rna
|
|
|
|
netsettings.slaves.add()
|
|
|
|
netsettings.slaves[-1].name = slave.name
|
|
|
|
|
|
|
|
netsettings.slaves_blacklist.remove(netsettings.active_blacklisted_slave_index)
|
|
|
|
netsettings.active_blacklisted_slave_index = -1
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-08-29 17:25:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RENDER_OT_netclientslaves(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Refresh status about available Render slaves'''
|
|
|
|
bl_idname = "render.netclientslaves"
|
|
|
|
bl_label = "Client Slaves"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
conn.request("GET", "/slaves")
|
|
|
|
|
|
|
|
response = conn.getresponse()
|
2010-08-14 16:30:41 +00:00
|
|
|
response.read()
|
2009-12-29 00:04:57 +00:00
|
|
|
print( response.status, response.reason )
|
|
|
|
|
|
|
|
slaves = (netrender.model.RenderSlave.materialize(s) for s in eval(str(response.read(), encoding='utf8')))
|
|
|
|
|
|
|
|
while(len(netsettings.slaves) > 0):
|
|
|
|
netsettings.slaves.remove(0)
|
|
|
|
|
|
|
|
netrender.slaves = []
|
|
|
|
|
|
|
|
for s in slaves:
|
|
|
|
for i in range(len(netrender.blacklist)):
|
|
|
|
slave = netrender.blacklist[i]
|
|
|
|
if slave.id == s.id:
|
|
|
|
netrender.blacklist[i] = s
|
|
|
|
netsettings.slaves_blacklist[i].name = s.name
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
netrender.slaves.append(s)
|
|
|
|
|
|
|
|
netsettings.slaves.add()
|
|
|
|
slave = netsettings.slaves[-1]
|
|
|
|
slave.name = s.name
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-08-29 17:25:22 +00:00
|
|
|
|
|
|
|
class RENDER_OT_netclientcancel(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Cancel the selected network rendering job.'''
|
|
|
|
bl_idname = "render.netclientcancel"
|
|
|
|
bl_label = "Client Cancel"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
netsettings = context.scene.network_render
|
|
|
|
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
job = netrender.jobs[netsettings.active_job_index]
|
|
|
|
|
|
|
|
conn.request("POST", cancelURL(job.id))
|
|
|
|
|
|
|
|
response = conn.getresponse()
|
2010-08-14 16:30:41 +00:00
|
|
|
response.read()
|
2009-12-29 00:04:57 +00:00
|
|
|
print( response.status, response.reason )
|
|
|
|
|
|
|
|
netsettings.jobs.remove(netsettings.active_job_index)
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
|
|
|
|
2009-09-23 21:46:29 +00:00
|
|
|
class RENDER_OT_netclientcancelall(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Cancel all running network rendering jobs.'''
|
|
|
|
bl_idname = "render.netclientcancelall"
|
|
|
|
bl_label = "Client Cancel All"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
conn.request("POST", "/clear")
|
|
|
|
|
|
|
|
response = conn.getresponse()
|
2010-08-14 16:30:41 +00:00
|
|
|
response.read()
|
2009-12-29 00:04:57 +00:00
|
|
|
print( response.status, response.reason )
|
|
|
|
|
|
|
|
while(len(netsettings.jobs) > 0):
|
|
|
|
netsettings.jobs.remove(0)
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-09-23 21:46:29 +00:00
|
|
|
|
2009-09-10 20:41:18 +00:00
|
|
|
class netclientdownload(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Download render results from the network'''
|
|
|
|
bl_idname = "render.netclientdownload"
|
|
|
|
bl_label = "Client Download"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
netsettings = context.scene.network_render
|
|
|
|
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
2010-02-23 12:48:35 +00:00
|
|
|
rd = context.scene.render
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
job = netrender.jobs[netsettings.active_job_index]
|
|
|
|
|
|
|
|
for frame in job.frames:
|
|
|
|
client.requestResult(conn, job.id, frame.number)
|
|
|
|
response = conn.getresponse()
|
2010-08-14 16:30:41 +00:00
|
|
|
response.read()
|
2009-12-29 00:04:57 +00:00
|
|
|
|
|
|
|
if response.status != http.client.OK:
|
|
|
|
print("missing", frame.number)
|
|
|
|
continue
|
|
|
|
|
|
|
|
print("got back", frame.number)
|
|
|
|
|
2010-08-14 16:30:41 +00:00
|
|
|
f = open(os.path.join(netsettings.path, "%06d.exr" % frame.number), "wb")
|
2009-12-29 00:04:57 +00:00
|
|
|
buf = response.read(1024)
|
|
|
|
|
|
|
|
while buf:
|
|
|
|
f.write(buf)
|
|
|
|
buf = response.read(1024)
|
|
|
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-09-15 19:53:18 +00:00
|
|
|
|
|
|
|
class netclientscan(bpy.types.Operator):
|
2010-01-05 20:47:23 +00:00
|
|
|
'''Listen on network for master server broadcasting its address and port.'''
|
2009-12-29 00:04:57 +00:00
|
|
|
bl_idname = "render.netclientscan"
|
|
|
|
bl_label = "Client Scan"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
address, port = clientScan(self.report)
|
|
|
|
|
|
|
|
if address:
|
|
|
|
scene = context.scene
|
|
|
|
netsettings = scene.network_render
|
|
|
|
netsettings.server_address = address
|
|
|
|
netsettings.server_port = port
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|
2009-09-26 19:50:59 +00:00
|
|
|
|
|
|
|
class netclientweb(bpy.types.Operator):
|
2009-12-29 00:04:57 +00:00
|
|
|
'''Open new window with information about running rendering jobs'''
|
|
|
|
bl_idname = "render.netclientweb"
|
|
|
|
bl_label = "Open Master Monitor"
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2009-12-29 00:04:57 +00:00
|
|
|
netsettings = context.scene.network_render
|
|
|
|
return netsettings.server_address != "[default]"
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
netsettings = context.scene.network_render
|
|
|
|
|
|
|
|
|
|
|
|
# open connection to make sure server exists
|
|
|
|
conn = clientConnection(netsettings.server_address, netsettings.server_port, self.report)
|
|
|
|
|
|
|
|
if conn:
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
webbrowser.open("http://%s:%i" % (netsettings.server_address, netsettings.server_port))
|
|
|
|
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
return self.execute(context)
|