[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4260] trunk/py/scripts/addons/ render_renderfarmfi: On startup bpy.data.filepath is not accessible, preventing proper addon enabling.
Nathan Letwory
nathan at letworyinteractive.com
Mon Feb 11 07:45:23 CET 2013
Revision: 4260
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4260
Author: jesterking
Date: 2013-02-11 06:45:22 +0000 (Mon, 11 Feb 2013)
Log Message:
-----------
On startup bpy.data.filepath is not accessible, preventing proper addon enabling.
Modified Paths:
--------------
trunk/py/scripts/addons/render_renderfarmfi/__init__.py
trunk/py/scripts/addons/render_renderfarmfi/prepare.py
Modified: trunk/py/scripts/addons/render_renderfarmfi/__init__.py
===================================================================
--- trunk/py/scripts/addons/render_renderfarmfi/__init__.py 2013-02-10 23:22:01 UTC (rev 4259)
+++ trunk/py/scripts/addons/render_renderfarmfi/__init__.py 2013-02-11 06:45:22 UTC (rev 4260)
@@ -89,7 +89,10 @@
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 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 @@
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 @@
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 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')
Modified: trunk/py/scripts/addons/render_renderfarmfi/prepare.py
===================================================================
--- trunk/py/scripts/addons/render_renderfarmfi/prepare.py 2013-02-10 23:22:01 UTC (rev 4259)
+++ trunk/py/scripts/addons/render_renderfarmfi/prepare.py 2013-02-11 06:45:22 UTC (rev 4260)
@@ -71,7 +71,7 @@
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 @@
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 @@
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 @@
sce = bpy.context.scene
rd = sce.render
ore = sce.ore_render
-
+
changeSettings()
print("Packing external textures...")
@@ -143,7 +143,7 @@
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 @@
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 @@
bpy.ops.wm.save_mainfile(filepath=savePath)
except Exception as e:
print(e)
-
+
print(".blend prepared")
More information about the Bf-extensions-cvs
mailing list