Fix for cache path.
Operator for background baking (no support in netrender itself yet).
This commit is contained in:
@@ -26,6 +26,55 @@ from netrender.utils import *
|
||||
import netrender.client as client
|
||||
import netrender.model
|
||||
|
||||
@rnaOperator
|
||||
class RENDER_OT_netslave_bake(bpy.types.Operator):
|
||||
'''NEED DESCRIPTION'''
|
||||
bl_idname = "render.netslavebake"
|
||||
bl_label = "Bake all in file"
|
||||
|
||||
def poll(self, context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
|
||||
filename = bpy.data.filename
|
||||
path, name = os.path.split(filename)
|
||||
root, ext = os.path.splitext(name)
|
||||
default_path = path + os.sep + "blendcache_" + root + os.sep # need an API call for that
|
||||
|
||||
# Force all point cache next to the blend file
|
||||
for object in bpy.data.objects:
|
||||
for modifier in object.modifiers:
|
||||
if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
|
||||
modifier.settings.path = default_path
|
||||
bpy.ops.fluid.bake({"active_object": object, "scene": scene})
|
||||
elif modifier.type == "CLOTH":
|
||||
modifier.point_cache.disk_cache = True
|
||||
modifier.point_cache.external = False
|
||||
elif modifier.type == "SOFT_BODY":
|
||||
modifier.point_cache.disk_cache = True
|
||||
modifier.point_cache.external = False
|
||||
elif modifier.type == "SMOKE" and modifier.smoke_type == "TYPE_DOMAIN":
|
||||
modifier.domain_settings.point_cache_low.disk_cache = True
|
||||
modifier.domain_settings.point_cache_low.external = False
|
||||
modifier.domain_settings.point_cache_high.disk_cache = True
|
||||
modifier.domain_settings.point_cache_high.external = False
|
||||
|
||||
# particles modifier are stupid and don't contain data
|
||||
# we have to go through the object property
|
||||
for psys in object.particle_systems:
|
||||
psys.point_cache.disk_cache = True
|
||||
psys.point_cache.external = False
|
||||
|
||||
bpy.ops.ptcache.bake_all()
|
||||
|
||||
return ('FINISHED',)
|
||||
|
||||
def invoke(self, context, event):
|
||||
return self.execute(context)
|
||||
|
||||
@rnaOperator
|
||||
class RENDER_OT_netclientanim(bpy.types.Operator):
|
||||
'''Start rendering an animation on network'''
|
||||
|
||||
Reference in New Issue
Block a user