diff options
-rw-r--r-- | render_renderfarmfi/__init__.py | 17 | ||||
-rw-r--r-- | render_renderfarmfi/prepare.py | 33 |
2 files changed, 28 insertions, 22 deletions
diff --git a/render_renderfarmfi/__init__.py b/render_renderfarmfi/__init__.py index eec9ff6c..ca55368f 100644 --- a/render_renderfarmfi/__init__.py +++ b/render_renderfarmfi/__init__.py @@ -89,7 +89,10 @@ bpy.cancelError = False bpy.texturePackError = False bpy.linkedFileError = False bpy.uploadInProgress = False -bpy.originalFileName = bpy.data.filepath +try: + bpy.originalFileName = bpy.data.filepath +except: + bpy.originalFileName = 'untitled.blend' bpy.particleBakeWarning = False bpy.childParticleWarning = False bpy.simulationWarning = False @@ -117,7 +120,7 @@ class ORESession(bpy.types.PropertyGroup): class ORESettings(bpy.types.PropertyGroup): username = StringProperty(name='E-mail', description='E-mail for Renderfarm.fi', maxlen=256, default='') password = StringProperty(name='Password', description='Renderfarm.fi password', maxlen=256, default='') - + shortdesc = StringProperty(name='Short description', description='A short description of the scene (100 characters)', maxlen=101, default='-') tags = StringProperty(name='Tags', description='A list of tags that best suit the animation', maxlen=102, default='') longdesc = StringProperty(name='Description', description='Description of the scene (2k)', maxlen=2048, default='') @@ -127,7 +130,7 @@ class ORESettings(bpy.types.PropertyGroup): samples = IntProperty(name='Samples', description='Number of samples that is used (Cycles only)', min=1, max=1000000, soft_min=1, soft_max=100000, default=100) subsamples = IntProperty(name='Subsample Frames', description='Number of subsample frames that is used (Cycles only)', min=1, max=1000000, soft_min=1, soft_max=1000, default=10) file_format = StringProperty(name='File format', description='File format used for the rendering', maxlen=30, default='PNG_FORMAT') - + parts = IntProperty(name='Parts/Frame', description='', min=1, max=1000, soft_min=1, soft_max=64, default=1) resox = IntProperty(name='Resolution X', description='X of render', min=1, max=10000, soft_min=1, soft_max=10000, default=1920) resoy = IntProperty(name='Resolution Y', description='Y of render', min=1, max=10000, soft_min=1, soft_max=10000, default=1080) @@ -135,12 +138,12 @@ class ORESettings(bpy.types.PropertyGroup): start = IntProperty(name='Start Frame', description='Start Frame', default=1) end = IntProperty(name='End Frame', description='End Frame', default=250) fps = IntProperty(name='FPS', description='FPS', min=1, max=120, default=25) - + prepared = BoolProperty(name='Prepared', description='Set to True if preparation has been run', default=False) debug = BoolProperty(name='Debug', description='Verbose output in console', default=False) selected_session = IntProperty(name='Selected Session', description='The selected session', default=0) hasUnsupportedSimulation = BoolProperty(name='HasSimulation', description='Set to True if therea re unsupported simulations', default=False) - + inlicense = EnumProperty(items=licenses, name='Scene license', description='License speficied for the source files', default='1') outlicense = EnumProperty(items=licenses, name='Product license', description='License speficied for the output files', default='1') sessions = CollectionProperty(type=ORESession, name='Sessions', description='Sessions on Renderfarm.fi') @@ -155,11 +158,11 @@ class ORESettings(bpy.types.PropertyGroup): class RENDERFARM_MT_Session(bpy.types.Menu): bl_label = "Show Session" - + def draw(self, context): layout = self.layout ore = context.scene.ore_render - + if (bpy.loginInserted == True): layout.operator('ore.completed_sessions') layout.operator('ore.accept_sessions') diff --git a/render_renderfarmfi/prepare.py b/render_renderfarmfi/prepare.py index 08b61b98..e59230de 100644 --- a/render_renderfarmfi/prepare.py +++ b/render_renderfarmfi/prepare.py @@ -71,7 +71,7 @@ def isFilterNode(node): return t==bpy.types.CompositorNodeBlur or t==bpy.types.CompositorNodeDBlur def changeSettings(): - + sce = bpy.context.scene rd = sce.render ore = sce.ore_render @@ -82,17 +82,17 @@ def changeSettings(): sce.frame_start = ore.start sce.frame_end = ore.end rd.fps = ore.fps - + bpy.file_format_warning = False bpy.simulationWarning = False bpy.texturePackError = False bpy.particleBakeWarning = False bpy.childParticleWarning = False - + if (rd.image_settings.file_format == 'HDR'): rd.image_settings.file_format = 'PNG' bpy.file_format_warning = True - + # Convert between Blender's image format and BURP's formats if (rd.image_settings.file_format == 'PNG'): ore.file_format = 'PNG_FORMAT' @@ -104,26 +104,26 @@ def changeSettings(): ore.file_format = 'PNG_FORMAT' else: ore.file_format = 'PNG_FORMAT' - + if (ore.engine == 'cycles'): bpy.context.scene.cycles.samples = ore.samples - + if (ore.subsamples <= 0): ore.subsamples = 1 - + if (ore.samples / ore.subsamples < 100.0): ore.subsamples = float(ore.samples) / 100.0 - + # Multipart support doesn' work if SSS is used if ((rd.use_sss == True and hasSSSMaterial()) and ore.parts > 1): ore.parts = 1; - + if (hasParticleSystem()): tuneParticles() else: bpy.particleBakeWarning = False bpy.childParticleWarning = False - + if (hasUnsupportedSimulation()): simulationWarning = True else: @@ -133,7 +133,7 @@ def _prepare_scene(): sce = bpy.context.scene rd = sce.render ore = sce.ore_render - + changeSettings() print("Packing external textures...") @@ -143,7 +143,7 @@ def _prepare_scene(): except Exception as e: bpy.texturePackError = True print(e) - + linkedData = bpy.utils.blend_paths() if (len(linkedData) > 0): print("Appending linked .blend files...") @@ -155,10 +155,13 @@ def _prepare_scene(): print(e) else: print("No external .blends used, skipping...") - + # Save with a different name print("Saving into a new file...") - bpy.originalFileName = bpy.data.filepath + try: + bpy.originalFileName = bpy.data.filepath + except: + bpy.originalFileName = 'untitled.blend' print("Original path is " + bpy.originalFileName) try: # If the filename is empty, we'll make one from the path of the user's resource folder @@ -184,7 +187,7 @@ def _prepare_scene(): bpy.ops.wm.save_mainfile(filepath=savePath) except Exception as e: print(e) - + print(".blend prepared") |