[Durian-svn] [2168] update to finals config script, give commands to move cache into final dir
campbell
institute at blender.org
Mon Apr 19 14:29:35 CEST 2010
Revision: 2168
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=2168
Author: campbell
Date: 2010-04-19 14:29:35 +0200 (Mon, 19 Apr 2010)
Log Message:
-----------
update to finals config script, give commands to move cache into final dir
Modified Paths:
--------------
pro/scripts/modules/finals_config.py
Modified: pro/scripts/modules/finals_config.py
===================================================================
--- pro/scripts/modules/finals_config.py 2010-04-19 12:24:48 UTC (rev 2167)
+++ pro/scripts/modules/finals_config.py 2010-04-19 12:29:35 UTC (rev 2168)
@@ -2,13 +2,37 @@
'''
import finals_config
reload(finals_config)
-finals_config.setup()
+finals_config.setup(baked=True)
'''
import bpy
import os
-def setup():
+
+def setup(baked=False):
+
+ def pointcache_dirs(point_cache):
+ # cache path local: from
+ cache_dir = bpy.utils.expandpath(point_cache.id_data.library.filename) # expand //
+ cache_dir = os.path.normpath(cache_dir) # remove ../../
+ cache_dir = os.path.splitext(cache_dir)[0] # remove .blend
+ cache_base_dir, cache_base_name = os.path.split(cache_dir)
+ cache_path_from = os.path.join(cache_base_dir, "blendcache_" + cache_base_name)
+
+ # cache path global: to
+ base_dir, base_name = os.path.split(bpy.data.filename)
+ cache_path_to = os.path.join(base_dir, point_cache.name, point_cache.name)
+
+ return cache_path_from, cache_path_to
+
+
+ def pointcache_generic_setup(point_cache, frame_start, frame_end):
+ point_cache.frame_start = frame_start
+ point_cache.frame_end = frame_end
+ point_cache.step = 1
+ point_cache.disk_cache = True
+
+
base_dir, base_name = os.path.split(bpy.data.filename)
base_name = os.path.splitext(base_name)[0]
@@ -19,33 +43,46 @@
frame_end = bpy.context.scene.frame_end
# Sintel
- obj = bpy.data.objects.get("GEO-hair_emitter")
+ obj = bpy.data.objects.get("GEO-sintel_hair_emit")
if obj:
- print("finals_config.py: configuring sintel's hair")
+ psys = obj.particle_systems["sintel_hair"]
# change per scene
- obj.particle_systems[0].point_cache.frame_start = frame_start
- obj.particle_systems[0].point_cache.frame_end = frame_end
- # obj.particle_systems[0].point_cache.external = False
- obj.particle_systems[0].point_cache.name = "sintel_hair_" + base_name
- # obj.particle_systems[0].point_cache.filepath = base_dir
+ pointcache_generic_setup(psys.point_cache, frame_start, frame_end)
+ psys.point_cache.name = "sintel_hair_" + base_name
+
+ if baked:
+ psys.point_cache.external = True
+ psys.point_cache.filepath = os.path.join(base_dir, psys.point_cache.name)
+ else:
+ if psys.point_cache.external:
+ psys.point_cache.external = False
+
# static settings
- obj.particle_systems[0].point_cache.step = 1
- obj.particle_systems[0].point_cache.disk_cache = True
- obj.particle_systems[0].hair_dynamics = True
+ psys.hair_dynamics = True
- obj.particle_systems[0].cloth.settings.pin_stiffness = 0.4
- obj.particle_systems[0].cloth.settings.quality = 20
+ psys.cloth.settings.pin_stiffness = 0.4
+ psys.cloth.settings.quality = 20
- obj.particle_systems[0].settings.child_nbr = 40
- obj.particle_systems[0].settings.draw_step = 4
- obj.particle_systems[0].settings.mass = 0.03 # was 0.01
+ psys.settings.child_nbr = 40
+ psys.settings.draw_step = 4
+ psys.settings.mass = 0.03 # was 0.01
+ if not baked:
+ cache_path_from, cache_path_to = pointcache_dirs(psys.point_cache)
+ print("finals_config.py: configuring sintel's hair")
+
+ print(" mkdir '%s'" % (cache_path_to))
+ print(" mv %s/* %s/" % (cache_path_from, cache_path_to))
+
+ else:
+ print("finals_config.py: configuring sintel's hair (NEEDS BAKING)")
+
'''
- obj.particle_systems[0].settings.mass = 0.0
- obj.particle_systems[0].settings.keyframe_insert("mass", -1, 1)
- obj.particle_systems[0].settings.mass = 10.0
- obj.particle_systems[0].settings.keyframe_insert("mass", -1, 40)
+ psys.settings.mass = 0.0
+ psys.settings.keyframe_insert("mass", -1, 1)
+ psys.settings.mass = 10.0
+ psys.settings.keyframe_insert("mass", -1, 40)
'''
More information about the Durian-svn
mailing list