diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-07-31 23:23:22 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-07-31 23:23:22 +0400 |
commit | a5e4fc782afefae0c2ab5fea48661f686b28b068 (patch) | |
tree | facf947c26e33584b6a18a42e2f0eb02e1160fab /release | |
parent | 9d68a27365b8fe83fa98931e6aa0c7fc8dba34fa (diff) |
netrender: fix reload
Note: this is tested and work with metaclass registering. If it doesn't work with registering lists (as currently in svn), I can still commit the metaclass method...
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/io/netrender/__init__.py | 43 | ||||
-rw-r--r-- | release/scripts/io/netrender/ui.py | 271 |
2 files changed, 163 insertions, 151 deletions
diff --git a/release/scripts/io/netrender/__init__.py b/release/scripts/io/netrender/__init__.py index 43f3094e628..5a705e95aa8 100644 --- a/release/scripts/io/netrender/__init__.py +++ b/release/scripts/io/netrender/__init__.py @@ -18,16 +18,31 @@ # This directory is a Python package. -from netrender import model -from netrender import operators -from netrender import client -from netrender import slave -from netrender import master -from netrender import master_html -from netrender import utils -from netrender import balancing -from netrender import ui -from netrender import repath +# To support reload properly, try to access a package var, if it's there, reload everything +try: + init_data + + reload(model) + reload(operators) + reload(client) + reload(slave) + reload(master) + reload(master_html) + reload(utils) + reload(balancing) + reload(ui) + reload(repath) +except: + from netrender import model + from netrender import operators + from netrender import client + from netrender import slave + from netrender import master + from netrender import master_html + from netrender import utils + from netrender import balancing + from netrender import ui + from netrender import repath jobs = [] slaves = [] @@ -38,14 +53,10 @@ init_data = True init_address = True def register(): - pass # TODO + ui.addProperties() + def unregister(): import bpy - bpy.types.Scene.RemoveProperty("network_render") - bpy.types.unregister(ui.NetRenderJob) - bpy.types.unregister(ui.NetRenderSettings) - bpy.types.unregister(ui.NetRenderSlave) - diff --git a/release/scripts/io/netrender/ui.py b/release/scripts/io/netrender/ui.py index c60b10c484a..c82a031100b 100644 --- a/release/scripts/io/netrender/ui.py +++ b/release/scripts/io/netrender/ui.py @@ -337,138 +337,139 @@ class NetRenderSlave(bpy.types.IDPropertyGroup): class NetRenderJob(bpy.types.IDPropertyGroup): pass -bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings") - -NetRenderSettings.StringProperty( attr="server_address", - name="Server address", - description="IP or name of the master render server", - maxlen = 128, - default = "[default]") - -NetRenderSettings.IntProperty( attr="server_port", - name="Server port", - description="port of the master render server", - default = 8000, - min=1, - max=65535) - -NetRenderSettings.BoolProperty( attr="master_broadcast", - name="Broadcast", - description="broadcast master server address on local network", - default = True) - -NetRenderSettings.BoolProperty( attr="slave_clear", - name="Clear on exit", - description="delete downloaded files on exit", - default = True) - -NetRenderSettings.BoolProperty( attr="slave_thumb", - name="Generate thumbnails", - description="Generate thumbnails on slaves instead of master", - default = False) - -NetRenderSettings.BoolProperty( attr="slave_outputlog", - name="Output render log on console", - description="Output render text log to console as well as sending it to the master", - default = True) - -NetRenderSettings.BoolProperty( attr="master_clear", - name="Clear on exit", - description="delete saved files on exit", - default = False) - -default_path = os.environ.get("TEMP") - -if not default_path: - if os.name == 'nt': - default_path = "c:/tmp/" - else: - default_path = "/tmp/" -elif not default_path.endswith(os.sep): - default_path += os.sep - -NetRenderSettings.StringProperty( attr="path", - name="Path", - description="Path for temporary files", - maxlen = 128, - default = default_path, - subtype='FILE_PATH') - -NetRenderSettings.StringProperty( attr="job_name", - name="Job name", - description="Name of the job", - maxlen = 128, - default = "[default]") - -NetRenderSettings.StringProperty( attr="job_category", - name="Job category", - description="Category of the job", - maxlen = 128, - default = "") - -NetRenderSettings.IntProperty( attr="chunks", - name="Chunks", - description="Number of frame to dispatch to each slave in one chunk", - default = 5, - min=1, - max=65535) - -NetRenderSettings.IntProperty( attr="priority", - name="Priority", - description="Priority of the job", - default = 1, - min=1, - max=10) - -NetRenderSettings.StringProperty( attr="job_id", - name="Network job id", - description="id of the last sent render job", - maxlen = 64, - default = "") - -NetRenderSettings.IntProperty( attr="active_slave_index", - name="Index of the active slave", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index", - name="Index of the active slave", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.IntProperty( attr="active_job_index", - name="Index of the active job", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.EnumProperty(attr="mode", - items=( - ("RENDER_CLIENT", "Client", "Act as render client"), - ("RENDER_MASTER", "Master", "Act as render master"), - ("RENDER_SLAVE", "Slave", "Act as render slave"), - ), - name="Network mode", - description="Mode of operation of this instance", - default="RENDER_CLIENT") - -NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="") -NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="") -NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="") - -NetRenderSlave.StringProperty( attr="name", - name="Name of the slave", - description="", - maxlen = 64, - default = "") - -NetRenderJob.StringProperty( attr="name", - name="Name of the job", - description="", - maxlen = 128, - default = "") +def addProperties(): + bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings") + + NetRenderSettings.StringProperty( attr="server_address", + name="Server address", + description="IP or name of the master render server", + maxlen = 128, + default = "[default]") + + NetRenderSettings.IntProperty( attr="server_port", + name="Server port", + description="port of the master render server", + default = 8000, + min=1, + max=65535) + + NetRenderSettings.BoolProperty( attr="master_broadcast", + name="Broadcast", + description="broadcast master server address on local network", + default = True) + + NetRenderSettings.BoolProperty( attr="slave_clear", + name="Clear on exit", + description="delete downloaded files on exit", + default = True) + + NetRenderSettings.BoolProperty( attr="slave_thumb", + name="Generate thumbnails", + description="Generate thumbnails on slaves instead of master", + default = False) + + NetRenderSettings.BoolProperty( attr="slave_outputlog", + name="Output render log on console", + description="Output render text log to console as well as sending it to the master", + default = True) + + NetRenderSettings.BoolProperty( attr="master_clear", + name="Clear on exit", + description="delete saved files on exit", + default = False) + + default_path = os.environ.get("TEMP") + + if not default_path: + if os.name == 'nt': + default_path = "c:/tmp/" + else: + default_path = "/tmp/" + elif not default_path.endswith(os.sep): + default_path += os.sep + + NetRenderSettings.StringProperty( attr="path", + name="Path", + description="Path for temporary files", + maxlen = 128, + default = default_path, + subtype='FILE_PATH') + + NetRenderSettings.StringProperty( attr="job_name", + name="Job name", + description="Name of the job", + maxlen = 128, + default = "[default]") + + NetRenderSettings.StringProperty( attr="job_category", + name="Job category", + description="Category of the job", + maxlen = 128, + default = "") + + NetRenderSettings.IntProperty( attr="chunks", + name="Chunks", + description="Number of frame to dispatch to each slave in one chunk", + default = 5, + min=1, + max=65535) + + NetRenderSettings.IntProperty( attr="priority", + name="Priority", + description="Priority of the job", + default = 1, + min=1, + max=10) + + NetRenderSettings.StringProperty( attr="job_id", + name="Network job id", + description="id of the last sent render job", + maxlen = 64, + default = "") + + NetRenderSettings.IntProperty( attr="active_slave_index", + name="Index of the active slave", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index", + name="Index of the active slave", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.IntProperty( attr="active_job_index", + name="Index of the active job", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.EnumProperty(attr="mode", + items=( + ("RENDER_CLIENT", "Client", "Act as render client"), + ("RENDER_MASTER", "Master", "Act as render master"), + ("RENDER_SLAVE", "Slave", "Act as render slave"), + ), + name="Network mode", + description="Mode of operation of this instance", + default="RENDER_CLIENT") + + NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="") + NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="") + NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="") + + NetRenderSlave.StringProperty( attr="name", + name="Name of the slave", + description="", + maxlen = 64, + default = "") + + NetRenderJob.StringProperty( attr="name", + name="Name of the job", + description="", + maxlen = 128, + default = "") |