Changeset View
Changeset View
Standalone View
Standalone View
netrender/ui.py
| Context not available. | |||||
| PATH_PREFIX = "/tmp/" | PATH_PREFIX = "/tmp/" | ||||
| RENDER_CLIENT = "RENDER_CLIENT" | |||||
| RENDER_MASTER = "RENDER_MASTER" | |||||
| RENDER_SLAVE = "RENDER_SLAVE" | |||||
| LAST_ADDRESS_TEST = 0 | LAST_ADDRESS_TEST = 0 | ||||
| ADDRESS_TEST_TIMEOUT = 30 | ADDRESS_TEST_TIMEOUT = 30 | ||||
| Context not available. | |||||
| return netrender.valid_address | return netrender.valid_address | ||||
| def is_mode(context, mode): | |||||
| return context.scene.network_render.mode == mode | |||||
| class NeedValidAddress(): | class NeedValidAddress(): | ||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| Context not available. | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| netsettings = context.scene.network_render | netsettings = context.scene.network_render | ||||
| verify_address(netsettings) | verify_address(netsettings) | ||||
| layout.prop(netsettings, "mode", expand=True) | layout.prop(netsettings, "mode", expand=True) | ||||
| if netsettings.mode in {'RENDER_MASTER', 'RENDER_SLAVE'}: | if netsettings.mode in {RENDER_MASTER, RENDER_SLAVE}: | ||||
| layout.operator("render.netclientstart", icon='PLAY') | layout.operator("render.netclientstart", icon='PLAY') | ||||
| layout.prop(netsettings, "path") | layout.prop(netsettings, "path") | ||||
| row = layout.row() | split = layout.split(factor = 0.25) | ||||
| split = layout.split(percentage=0.5) | |||||
| col = split.column() | col = split.column() | ||||
| col.prop(netsettings, "server_address", text="Address") | col.label(text = "Address") | ||||
| col = split.column() | col = split.column() | ||||
| row = col.row() | row = col.row() | ||||
| row.prop(netsettings, "server_address", text="") | |||||
| row = col.row() | |||||
| row.prop(netsettings, "server_port", text="Port") | row.prop(netsettings, "server_port", text="Port") | ||||
| row.prop(netsettings, "use_ssl", text="SSL") | row.prop(netsettings, "use_ssl", text="SSL") | ||||
| if netsettings.mode != "RENDER_MASTER": | if netsettings.mode != RENDER_MASTER: | ||||
| layout.operator("render.netclientscan", icon='FILE_REFRESH', text="") | layout.operator("render.netclientscan", icon='FILE_REFRESH', text="") | ||||
| if not netrender.valid_address: | if not netrender.valid_address: | ||||
| layout.label(text="No master at specified address") | layout.label(text="No master at specified address") | ||||
| if netsettings.use_ssl and netsettings.mode == RENDER_MASTER: | |||||
| if netsettings.use_ssl and netsettings.mode == "RENDER_MASTER": | |||||
| layout.prop(netsettings, "cert_path", text="Certificate") | layout.prop(netsettings, "cert_path", text="Certificate") | ||||
| layout.prop(netsettings, "key_path", text="Key") | layout.prop(netsettings, "key_path", text="Key") | ||||
| layout.operator("render.netclientweb", icon='QUESTION') | layout.operator("render.netclientweb", icon='QUESTION') | ||||
| class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel): | class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel): | ||||
| bl_label = "Slave Settings" | bl_label = "Slave Settings" | ||||
| COMPAT_ENGINES = {'NET_RENDER'} | COMPAT_ENGINES = {'NET_RENDER'} | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return super().poll(context) and scene.network_render.mode == "RENDER_SLAVE" | return super().poll(context) and is_mode(context, RENDER_SLAVE) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return super().poll(context) and scene.network_render.mode == "RENDER_MASTER" | return super().poll(context) and is_mode(context, RENDER_MASTER) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return super().poll(context) and scene.network_render.mode == "RENDER_CLIENT" | return super().poll(context) and is_mode(context, RENDER_CLIENT) | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| def poll(cls, context): | def poll(cls, context): | ||||
| scene = context.scene | scene = context.scene | ||||
| return (super().poll(context) | return (super().poll(context) | ||||
| and scene.network_render.mode == "RENDER_CLIENT" | and is_mode(context, RENDER_CLIENT) | ||||
| and scene.network_render.job_type == "JOB_VCS") | and context.scene.network_render.job_type == "JOB_VCS") | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| netsettings = context.scene.network_render | return super().poll(context) and is_mode(context, RENDER_CLIENT) | ||||
| return super().poll(context) and netsettings.mode == "RENDER_CLIENT" | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| sub = row.column(align=True) | sub = row.column(align=True) | ||||
| sub.operator("render.netclientslaves", icon='FILE_REFRESH', text="") | sub.operator("render.netclientslaves", icon='FILE_REFRESH', text="") | ||||
| sub.operator("render.netclientblacklistslave", icon='ZOOMOUT', text="") | sub.operator("render.netclientblacklistslave", icon='ZOOM_OUT', text="") | ||||
| if len(netrender.slaves) > netsettings.active_slave_index >= 0: | if len(netrender.slaves) > netsettings.active_slave_index >= 0: | ||||
| layout.separator() | layout.separator() | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| netsettings = context.scene.network_render | return super().poll(context) and is_mode(context, RENDER_CLIENT) | ||||
| return super().poll(context) and netsettings.mode == "RENDER_CLIENT" | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| netsettings, "active_blacklisted_slave_index", rows=2) | netsettings, "active_blacklisted_slave_index", rows=2) | ||||
| sub = row.column(align=True) | sub = row.column(align=True) | ||||
| sub.operator("render.netclientwhitelistslave", icon='ZOOMOUT', text="") | sub.operator("render.netclientwhitelistslave", icon='ZOOM_OUT', text="") | ||||
| if len(netrender.blacklist) > netsettings.active_blacklisted_slave_index >= 0: | if len(netrender.blacklist) > netsettings.active_blacklisted_slave_index >= 0: | ||||
| layout.separator() | layout.separator() | ||||
| Context not available. | |||||
| @classmethod | @classmethod | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| netsettings = context.scene.network_render | return super().poll(context) and is_mode(context, RENDER_CLIENT) | ||||
| return super().poll(context) and netsettings.mode == "RENDER_CLIENT" | |||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Context not available. | |||||
| sub = row.column(align=True) | sub = row.column(align=True) | ||||
| sub.operator("render.netclientstatus", icon='FILE_REFRESH', text="") | sub.operator("render.netclientstatus", icon='FILE_REFRESH', text="") | ||||
| sub.operator("render.netclientcancel", icon='ZOOMOUT', text="") | sub.operator("render.netclientcancel", icon='CANCEL', text="") | ||||
| sub.operator("render.netclientcancelall", icon='PANEL_CLOSE', text="") | sub.operator("render.netclientcancelall", icon='PANEL_CLOSE', text="") | ||||
| sub.operator("render.netclientdownload", icon='RENDER_ANIMATION', text="") | sub.operator("render.netclientdownload", icon='RENDER_ANIMATION', text="") | ||||
| Context not available. | |||||
| layout.label(text="Done: %04i" % job.results[netrender.model.FRAME_DONE]) | layout.label(text="Done: %04i" % job.results[netrender.model.FRAME_DONE]) | ||||
| layout.label(text="Error: %04i" % job.results[netrender.model.FRAME_ERROR]) | layout.label(text="Error: %04i" % job.results[netrender.model.FRAME_ERROR]) | ||||
| import bl_ui.properties_render as properties_render | #import bl_ui.properties_render as properties_render | ||||
| class RENDER_PT_network_output(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel): | #class RENDER_PT_network_output(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel): | ||||
| bl_label = "Output" | # bl_label = "Output" | ||||
| COMPAT_ENGINES = {'NET_RENDER'} | # COMPAT_ENGINES = {'NET_RENDER'} | ||||
| @classmethod | # @classmethod | ||||
| def poll(cls, context): | # def poll(cls, context): | ||||
| netsettings = context.scene.network_render | # return super().poll(context) and is_mode(context, RENDER_CLIENT) | ||||
| return super().poll(context) and netsettings.mode == "RENDER_CLIENT" | |||||
| draw = properties_render.RENDER_PT_output.draw | |||||
| # TODO: where did this go? | |||||
| #draw = properties_render.RENDER_PT_output.draw | |||||
| #def draw(self, context): | |||||
| class NetRenderSlave(bpy.types.PropertyGroup): | class NetRenderSlave(bpy.types.PropertyGroup): | ||||
| @classmethod | @classmethod | ||||
| Context not available. | |||||
| NetRenderSettings.job_render_engine = EnumProperty( | NetRenderSettings.job_render_engine = EnumProperty( | ||||
| items = ( | items = ( | ||||
| ("BLENDER_RENDER", "BLENDER", "Standard Blender Render"), | ("EEVEE", "EEVEE", "Eeevee Render"), | ||||
| ("CYCLES", "CYCLES", "Cycle Render"), | ("CYCLES", "CYCLES", "Cycles Render"), | ||||
| ("OTHER", "OTHER", "Other non-default Render"), | ("OTHER", "OTHER", "Other non-default Render"), | ||||
| ), | ), | ||||
| name="render", | name="render", | ||||
| description="Render engine used to render this job", | description="Render engine used to render this job", | ||||
| default="BLENDER_RENDER") | default="EEVEE") | ||||
| NetRenderSettings.job_render_engine_other = StringProperty( | NetRenderSettings.job_render_engine_other = StringProperty( | ||||
| name="Render engine", | name="Render engine", | ||||
| Context not available. | |||||
| NetRenderSettings.mode = EnumProperty( | NetRenderSettings.mode = EnumProperty( | ||||
| items=( | items=( | ||||
| ("RENDER_CLIENT", "Client", "Act as render client"), | (RENDER_CLIENT, "Client", "Act as render client"), | ||||
| ("RENDER_MASTER", "Master", "Act as render master"), | (RENDER_MASTER, "Master", "Act as render master"), | ||||
| ("RENDER_SLAVE", "Slave", "Act as render slave"), | (RENDER_SLAVE, "Slave", "Act as render slave"), | ||||
| ), | ), | ||||
| name="Network mode", | name="Network mode", | ||||
| description="Mode of operation of this instance", | description="Mode of operation of this instance", | ||||
| default="RENDER_CLIENT") | default=RENDER_CLIENT) | ||||
| NetRenderSettings.slaves = CollectionProperty(type=NetRenderSlave, name="Slaves", description="") | NetRenderSettings.slaves = CollectionProperty(type=NetRenderSlave, name="Slaves", description="") | ||||
| NetRenderSettings.slaves_blacklist = CollectionProperty(type=NetRenderSlave, name="Slaves Blacklist", description="") | NetRenderSettings.slaves_blacklist = CollectionProperty(type=NetRenderSlave, name="Slaves Blacklist", description="") | ||||
| NetRenderSettings.jobs = CollectionProperty(type=NetRenderJob, name="Job List", description="") | NetRenderSettings.jobs = CollectionProperty(type=NetRenderJob, name="Job List", description="") | ||||
| bpy.types.Scene.network_render = PointerProperty(type=NetRenderSettings, name="Network Render", description="Network Render Settings") | bpy.types.Scene.network_render = PointerProperty(type=NetRenderSettings, name="Network Render", description="Network Render Settings") | ||||
| @classmethod | |||||
| def unregister(cls): | |||||
| del bpy.types.Scene.network_render | |||||
| Context not available. | |||||