def render(self, scene): global _render_count _render_count += 1 try: if not hasattr(scene, 'bitwrk_settings'): self.report({'ERROR'}, "Must first setup BitWrk") return if not probe_bitwrk_client(scene.bitwrk_settings): self.report({'ERROR'}, "Must first connect to BitWrk client") return with tempfile.TemporaryDirectory() as tmpdir: self._doRender(scene, tmpdir) except: self.report({'ERROR'}, "Exception while rendering: {}".format( traceback.format_exc())) finally: _render_count -= 1
def poll(cls, context): return bitwrkclient.probe_bitwrk_client(context.scene.bitwrk_settings)
def draw(self, context): settings=context.scene.bitwrk_settings if bitwrkclient.probe_bitwrk_client(settings): self.layout.operator("bitwrk.startbrowser", icon='URL') else: self.layout.label( "No BitWrk client at {}:{}".format(settings.bitwrk_client_host, settings.bitwrk_client_port), icon='ERROR') row = self.layout.row(align=True) row.operator("bitwrk.startclient", icon='PLAY') row.operator("bitwrk.stopclient", icon='X') if settings.expert_mode and not bitwrkclient.can_stop_bitwrk_client(): layout = self.layout.column() layout.enabled = not is_render_active() and not worker.worker_alive() row = layout.split(0.5) row.label("BitWrk client host:") row.prop(settings, "bitwrk_client_host", text="") row = layout.split(0.5) row.label("BitWrk client port:") row.prop(settings, "bitwrk_client_port", text="") if not bitwrkclient.probe_bitwrk_client(settings): row = self.layout.split(0.5) row.label("BitWrk client executable file:") row.prop(settings, "bitwrk_client_executable_path", text="") if settings.expert_mode: self.layout.label("BitWrk can dispatch jobs to local network computers:") row = self.layout.split(0.02) row.label(" ") row.prop(settings, "bitwrk_client_allow_nonlocal_workers") if bitwrkclient.probe_bitwrk_client(settings): self.layout.separator() if settings.expert_mode: row = self.layout.row() row.enabled = not worker.worker_alive() row.prop(settings, "complexity") row = self.layout.split(0.333) row.label("Article id: ", icon="RNDCURVE") row.label(get_article_id(settings.complexity)) resx, resy = render_resolution(context.scene) max_pixels = max_tilesize(context.scene) u,v = optimal_tiling(resx, resy, max_pixels) row = self.layout.split(0.333) row.label("Tiles per frame", icon='MESH_GRID') row.label("{} ({}x{}, efficiency: {:.1%})".format(u*v, u, v, resx*resy/u/v/max_pixels)) row = self.layout.split(0.333) row.label("Tiles at once", icon='NLA') row.prop(settings, "concurrency") if settings.expert_mode: row = self.layout.split(0.333) row.enabled = not is_render_active() row.label("Boost factor", icon='NEXT_KEYFRAME') row.prop(settings, "boost_factor") if settings.boost_factor > 1: self.layout.label("A boost factor greater than 1.0 makes rendering more expensive!", icon='ERROR') self.layout.separator() self.layout.label("Also render on this computer:") row = self.layout.row(align=True) row.operator("bitwrk.startworker", icon='PLAY') row.operator("bitwrk.stopworker", icon='X') row = self.layout.row() row.active = not worker.worker_alive() row.prop(settings, "worker_device") if settings.expert_mode: layout = self.layout.row() layout.enabled=not worker.worker_alive() layout.prop(settings, "use_custom_python_executable") if settings.use_custom_python_executable: layout.prop(settings, "custom_python_executable", text="") self.layout.separator() self.layout.prop(settings, "expert_mode")
def draw(self, context): settings = context.scene.bitwrk_settings if bitwrkclient.probe_bitwrk_client(settings): self.layout.operator("bitwrk.startbrowser", icon='URL') else: self.layout.label("No BitWrk client at {}:{}".format( settings.bitwrk_client_host, settings.bitwrk_client_port), icon='ERROR') row = self.layout.row(align=True) row.operator("bitwrk.startclient", icon='PLAY') row.operator("bitwrk.stopclient", icon='X') if settings.expert_mode and not bitwrkclient.can_stop_bitwrk_client(): layout = self.layout.column() layout.enabled = not is_render_active( ) and not worker.worker_alive() row = layout.split(0.5) row.label("BitWrk client host:") row.prop(settings, "bitwrk_client_host", text="") row = layout.split(0.5) row.label("BitWrk client port:") row.prop(settings, "bitwrk_client_port", text="") if not bitwrkclient.probe_bitwrk_client(settings): row = self.layout.split(0.5) row.label("BitWrk client executable file:") row.prop(settings, "bitwrk_client_executable_path", text="") if settings.expert_mode: self.layout.label( "BitWrk can dispatch jobs to local network computers:") row = self.layout.split(0.02) row.label(" ") row.prop(settings, "bitwrk_client_allow_nonlocal_workers") if bitwrkclient.probe_bitwrk_client(settings): self.layout.separator() row = self.layout.row() row.enabled = not worker.worker_alive() row.prop(settings, "complexity") row = self.layout.split(0.333) row.label("Article id: ", icon="RNDCURVE") row.label(get_article_id(settings.complexity)) resx, resy = render_resolution(context.scene) max_pixels = max_tilesize(context.scene) u, v = optimal_tiling(resx, resy, max_pixels) row = self.layout.split(0.333) row.label("Tiles per frame", icon='MESH_GRID') row.label("{} ({}x{}, efficiency: {:.1%})".format( u * v, u, v, resx * resy / u / v / max_pixels)) row = self.layout.split(0.333) row.label("Tiles at once", icon='NLA') row.prop(settings, "concurrency") if settings.expert_mode: row = self.layout.split(0.333) row.enabled = not is_render_active() row.label("Boost factor", icon='NEXT_KEYFRAME') row.prop(settings, "boost_factor") if settings.boost_factor > 1: self.layout.label( "A boost factor greater than 1.0 makes rendering more expensive!", icon='ERROR') self.layout.separator() self.layout.label("Also render on this computer:") row = self.layout.row(align=True) row.operator("bitwrk.startworker", icon='PLAY') row.operator("bitwrk.stopworker", icon='X') if settings.expert_mode: layout = self.layout.row() layout.enabled = not worker.worker_alive() layout.prop(settings, "use_custom_python_executable") if settings.use_custom_python_executable: layout.prop(settings, "custom_python_executable", text="") self.layout.separator() self.layout.prop(settings, "expert_mode")