[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2374] trunk/py/scripts/addons/ render_renderfarmfi.py: Uploader version 9 features:
Jesse Kaukonen
jesse.kaukonen at gmail.com
Thu Sep 29 10:02:51 CEST 2011
Revision: 2374
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2374
Author: gekko
Date: 2011-09-29 08:02:49 +0000 (Thu, 29 Sep 2011)
Log Message:
-----------
Uploader version 9 features:
- You must now log in first before doing anything. Old system did everything in one call, while this new system has 3 calls:
1: Login and check password, downloading session information
2: Do optional session list refreshing
3: Handle file uploads to the service
- Changed the UI:
* You can no longer edit ore_resox or the other ore settings. These are copied from Blender's render settings directly
* You can change ore parts and ore memory usage, but these are tagged as "optional advanced settings"
* There is now a link to the Renderfarm.fi render panel in the main render panel. You can easily switch between Blender Render and Renderfarm.fi render
* The UI gives you visible errors instead of hiding these in the console, although not all errors are visible
- The preparation is performed once the user presses "upload" or changes to the Renderfarm.fi tab
* This no longer stops the upload, but instead gives a warning if there are issues
* If a texture is not found, give a warning
* If a linked file is not found, give a warning
- The file is no longer saved into the original master file, but a copy is created with the name "renderfarm.blend".
- Short description field was removed. This still exists code-wise, but it's simply filled with a dummy letter. Instead, the UI asks for simply "description" and "tags". Tags might be implemented soon-ish(tm).
- The old method of listing and canceling sessions is completely re-written:
* The new system fetches out all the user's sessions and stores them in lists, then fetching what is required. The old system required a new XMLRPC call if you wanted to switch your selected list from one to another such as "completed" to "canceled". I removed this "list by session type" -feature entirely and simply added one list that has everything. The sessions still have the % complete next to the name.
* Canceling works like before, except it gives a visible error if canceling isn't possible (ie session is already running or rejected)
* There is a refresh button that fetches out new listings from the server
- Particles generate a warning:
* If there are emitter type particles, recommend checking particle baking
* If there are hair type particles with child_type 'SIMPLE', change the mode to 'INTERPOLATED'. This seems to fix most of our problems. Also shows a note about this
- Fluid simulations generate a warning about them not working at all. This won't prevent uploading.
- Possibly some tiny fixes I forgot to mention
Modified Paths:
--------------
trunk/py/scripts/addons/render_renderfarmfi.py
Modified: trunk/py/scripts/addons/render_renderfarmfi.py
===================================================================
--- trunk/py/scripts/addons/render_renderfarmfi.py 2011-09-29 04:49:00 UTC (rev 2373)
+++ trunk/py/scripts/addons/render_renderfarmfi.py 2011-09-29 08:02:49 UTC (rev 2374)
@@ -19,9 +19,9 @@
bl_info = {
"name": "Renderfarm.fi",
"author": "Nathan Letwory <nathan at letworyinteractive.com>, Jesse Kaukonen <jesse.kaukonen at gmail.com>",
- "version": (8,),
- "blender": (2, 5, 7),
- "api": 36487,
+ "version": (9,),
+ "blender": (2, 5, 9),
+ "api": 40652,
"location": "Render > Engine > Renderfarm.fi",
"description": "Send .blend as session to http://www.renderfarm.fi to render",
"warning": "",
@@ -42,6 +42,7 @@
import xmlrpc.client
import math
from os.path import isabs, isfile
+import time
from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty
@@ -58,6 +59,7 @@
bpy.statusMessage = {
'title': 'TRIA_RIGHT',
'shortdesc': 'TRIA_RIGHT',
+ 'tags': 'TRIA_RIGHT',
'longdesc': 'TRIA_RIGHT',
'username': 'TRIA_RIGHT',
'password': 'TRIA_RIGHT'
@@ -65,7 +67,24 @@
bpy.errors = []
bpy.ore_sessions = []
+bpy.ore_completed_sessions = []
+bpy.ore_active_sessions = []
+bpy.ore_rejected_sessions = []
+bpy.ore_pending_sessions = []
+bpy.ore_active_session_queue = []
+bpy.ore_complete_session_queue = []
bpy.queue_selected = -1
+bpy.errorStartTime = -1.0
+bpy.infoError = False
+bpy.cancelError = False
+bpy.texturePackError = False
+bpy.linkedFileError = False
+bpy.uploadInProgress = False
+bpy.originalFileName = bpy.path.display_name_from_filepath(bpy.data.filepath)
+bpy.particleBakeWarning = False
+bpy.childParticleWarning = False
+bpy.simulationWarning = False
+bpy.ready = False
def renderEngine(render_engine):
bpy.utils.register_class(render_engine)
@@ -88,12 +107,13 @@
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='')
hash = StringProperty(name='Hash', description='hash calculated out of credentials', maxlen=33, default='')
-
- shortdesc = StringProperty(name='Short description', description='A short description of the scene (100 characters)', maxlen=101, default='')
- longdesc = StringProperty(name='Long description', description='A more elaborate description of the scene (2k)', maxlen=2048, 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='')
title = StringProperty(name='Title', description='Title for this session (128 characters)', maxlen=128, default='')
url = StringProperty(name='Project URL', description='Project URL. Leave empty if not applicable', maxlen=256, default='')
-
+
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)
@@ -101,15 +121,22 @@
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=256, default=25)
-
+
prepared = BoolProperty(name='Prepared', description='Set to True if preparation has been run', default=False)
+ loginInserted = BoolProperty(name='LoginInserted', description='Set to True if user has logged in', default=False)
+ passwordCorrect = BoolProperty(name='PasswordCorrect', description='Set to False if the password is incorrect', default=True)
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='source license', description='license speficied for the source files', default='1')
outlicense = EnumProperty(items=licenses, name='output license', description='license speficied for the output files', default='1')
sessions = CollectionProperty(type=ORESession, name='Sessions', description='Sessions on Renderfarm.fi')
+ completed_sessions = CollectionProperty(type=ORESession, name='Completed sessions', description='Sessions that have been already rendered')
+ rejected_sessions = CollectionProperty(type=ORESession, name='Rejected sessions', description='Sessions that have been rejected')
+ pending_sessions = CollectionProperty(type=ORESession, name='Pending sessions', description='Sessions that are waiting for approval')
+ active_sessions = CollectionProperty(type=ORESession, name='Active sessions', description='Sessions that are currently rendering')
+ all_sessions = CollectionProperty(type=ORESession, name='All sessions', description='List of all of the users sessions')
# session struct
@@ -143,159 +170,209 @@
except: pass
del properties_object
+def hasSSSMaterial():
+ for m in bpy.data.materials:
+ if m.subsurface_scattering.use:
+ return True
+ return False
+
+def tuneParticles():
+ for p in bpy.data.particles:
+ if (p.type == 'EMITTER'):
+ bpy.particleBakeWarning = True
+ if (p.type == 'HAIR'):
+ if (p.child_type == 'SIMPLE'):
+ p.child_type = 'INTERPOLATED'
+ bpy.childParticleWarning = True
+
+def hasParticleSystem():
+ if (len(bpy.data.particles) > 0):
+ print("Found particle system")
+ return True
+ return False
+
+def hasSimulation(t):
+ for o in bpy.data.objects:
+ for m in o.modifiers:
+ if isinstance(m, t):
+ print("Found simulation: " + str(t))
+ return True
+ return False
+
+def hasFluidSimulation():
+ return hasSimulation(bpy.types.FluidSimulationModifier)
+
+def hasSmokeSimulation():
+ return hasSimulation(bpy.types.SmokeModifier)
+
+def hasClothSimulation():
+ return hasSimulation(bpy.types.ClothModifier)
+
+def hasCollisionSimulation():
+ return hasSimulation(bpy.types.CollisionModifier)
+
+def hasSoftbodySimulation():
+ return hasSimulation(bpy.types.SoftBodyModifier)
+
+def hasUnsupportedSimulation():
+ return hasSoftbodySimulation() or hasCollisionSimulation() or hasClothSimulation() or hasSmokeSimulation() or hasFluidSimulation()
+
+def isFilterNode(node):
+ t = type(node)
+ return t==bpy.types.CompositorNodeBlur or t==bpy.types.CompositorNodeDBlur
+
+def changeSettings():
+
+ sce = bpy.context.scene
+ rd = sce.render
+ ore = sce.ore_render
+
+ # Necessary settings for BURP
+ ore.resox = rd.resolution_x
+ ore.resoy = rd.resolution_y
+ ore.start = sce.frame_start
+ ore.end = sce.frame_end
+ ore.fps = rd.fps
+
+ # 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:
+ bpy.simulationWarning = False
+
+def prepareScene():
+ sce = bpy.context.scene
+ rd = sce.render
+ ore = sce.ore_render
+
+ changeSettings()
+
+ print("Packing external textures...")
+ # Pack all external textures
+ try:
+ bpy.ops.file.pack_all()
+ bpy.texturePackError = False
+ except Exception as e:
+ bpy.texturePackError = True
+ print(e)
+
+ linkedData = bpy.utils.blend_paths()
+ if (len(linkedData) > 0):
+ print("Appending linked .blend files...")
+ try:
+ bpy.ops.object.make_local(type='ALL')
+ bpy.linkedFileError = False
+ except Exception as e:
+ bpy.linkedFileError = True
+ print(e)
+ else:
+ print("No external .blends used, skipping...")
+
+ # Save with a different name
+ print("Saving into a new file...")
+ try:
+ # If the filename is empty, we'll make one from the path of the Blender installation
+ if (len(bpy.originalFileName) == 0):
+ bpy.originalFileName = bpy.utils.resource_path(type='LOCAL') + "renderfarm.blend"
+ bpy.ops.wm.save_mainfile(filepath=bpy.originalFileName)
+ else:
+ savePath = bpy.originalFileName
+ savePath = savePath + "_renderfarm"
+ bpy.ops.wm.save_mainfile(filepath=savePath)
+ except Exception as e:
+ print(e)
+
+ print(".blend prepared")
+
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
-class SUMMARY_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
- # Prints a summary to the panel before uploading. If scene settings differ from ore settings, then display a warning icon
- bl_label = 'Summary'
- bl_options = {'DEFAULT_CLOSED'}
- COMPAT_ENGINES = set(['RENDERFARMFI_RENDER'])
+class OpSwitchRenderfarm(bpy.types.Operator):
+ bl_label = "Switch to Renderfarm.fi"
+ bl_idname = "ore.switch_to_renderfarm_render"
- @classmethod
- def poll(cls, context):
- rd = context.scene.render
- return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
+ def execute(self, context):
+ changeSettings()
+ bpy.context.scene.render.engine = 'RENDERFARMFI_RENDER'
+ return {'FINISHED'}
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list